OLD | NEW |
1 <!doctype html> | 1 <!doctype html> |
2 <html> | 2 <html> |
3 <head> | 3 <head> |
4 <!-- | 4 <!-- |
5 This test performs an animation of the matrix operator. The matrix is de
fined so that the | 5 This test performs an animation of the matrix operator. The matrix is de
fined so that the |
6 decomposition (unmatrix) algorithm is tested on the path where the matri
x is negated and the | 6 decomposition (unmatrix) algorithm is tested on the path where the matri
x is negated and the |
7 the scaling factors are also negated. | 7 the scaling factors are also negated. |
8 The animation is started and a snapshot is taken after start. The "d" co
mponent of matrix | 8 The animation is started and a snapshot is taken after start. The "d" co
mponent of matrix |
9 should be negative. | 9 should be negative. |
10 --> | 10 --> |
11 <style type="text/css" media="screen"> | 11 <style type="text/css" media="screen"> |
12 #box { | 12 #box { |
13 width: 100px; | 13 width: 100px; |
14 height: 100px; | 14 height: 100px; |
15 background-color: blue; | 15 background-color: blue; |
16 -webkit-animation-duration: 10s; | 16 animation-duration: 10s; |
17 } | 17 } |
18 | 18 |
19 @-webkit-keyframes anim { | 19 @keyframes anim { |
20 from { transform: matrix(1, 0, 0, -1, 0, 0); } | 20 from { transform: matrix(1, 0, 0, -1, 0, 0); } |
21 to { transform: matrix(1, 0, 0, 1, 0, 0); } | 21 to { transform: matrix(1, 0, 0, 1, 0, 0); } |
22 } | 22 } |
23 </style> | 23 </style> |
24 <script type="text/javascript" charset="utf-8"> | 24 <script type="text/javascript" charset="utf-8"> |
25 if (window.testRunner) { | 25 if (window.testRunner) { |
26 testRunner.dumpAsText(); | 26 testRunner.dumpAsText(); |
27 testRunner.waitUntilDone(); | 27 testRunner.waitUntilDone(); |
28 } | 28 } |
29 | 29 |
30 result = "PASS"; | 30 result = "PASS"; |
31 | 31 |
32 function snapshot() | 32 function snapshot() |
33 { | 33 { |
34 var boxComputedStyle = window.getComputedStyle(document.getEleme
ntById('box')); | 34 var boxComputedStyle = window.getComputedStyle(document.getEleme
ntById('box')); |
35 var matrix = new WebKitCSSMatrix(boxComputedStyle.webkitTransfor
m); | 35 var matrix = new WebKitCSSMatrix(boxComputedStyle.transform); |
36 | 36 |
37 // "d" component (scaleY) should be negative. | 37 // "d" component (scaleY) should be negative. |
38 if (matrix["d"] > 0) | 38 if (matrix["d"] > 0) |
39 result = "FAIL(scaleY was positive, expected to be negative)
"; | 39 result = "FAIL(scaleY was positive, expected to be negative)
"; |
40 | 40 |
41 document.getElementById('result').innerHTML = result; | 41 document.getElementById('result').innerHTML = result; |
42 if (window.testRunner) | 42 if (window.testRunner) |
43 testRunner.notifyDone(); | 43 testRunner.notifyDone(); |
44 } | 44 } |
45 | 45 |
46 function startAnimation() | 46 function startAnimation() |
47 { | 47 { |
48 document.getElementById("box").style.webkitAnimationName = "anim
"; | 48 document.getElementById("box").style.animationName = "anim"; |
49 } | 49 } |
50 | 50 |
51 document.addEventListener('webkitAnimationStart', snapshot, false); | 51 document.addEventListener('webkitAnimationStart', snapshot, false); |
52 </script> | 52 </script> |
53 </head> | 53 </head> |
54 <body> | 54 <body> |
55 <div id="box"></div> | 55 <div id="box"></div> |
56 <div id="result"></div> | 56 <div id="result"></div> |
57 <script> | 57 <script> |
58 startAnimation(); | 58 startAnimation(); |
59 </script> | 59 </script> |
60 </body> | 60 </body> |
61 </html> | 61 </html> |
OLD | NEW |