OLD | NEW |
1 <html> | 1 <html> |
2 <head> | 2 <head> |
3 <style> | 3 <style> |
4 body { | 4 body { |
5 zoom: 1.2; | 5 zoom: 1.2; |
6 padding: 0; | 6 padding: 0; |
7 margin: 0; | 7 margin: 0; |
8 } | 8 } |
9 | 9 |
10 .box { | 10 .box { |
11 width: 100px; | 11 width: 100px; |
12 height: 100px; | 12 height: 100px; |
13 background-color: blue; | 13 background-color: blue; |
14 position: absolute; | 14 position: absolute; |
15 top: 60px; | 15 top: 60px; |
16 left: 40px; | 16 left: 40px; |
17 } | 17 } |
18 | 18 |
19 .translate { | 19 .translate { |
20 transform: translate(100px, 50px); | 20 transform: perspective(200px) translate3d(100px, 50px, 25px) rotateY(45deg); |
21 background-color: red; | 21 background-color: red; |
22 } | 22 } |
23 | 23 |
24 .matrix { | 24 .matrix { |
25 background-color: green; | 25 background-color: green; |
26 } | 26 } |
27 </style> | 27 </style> |
28 <script type="text/javascript"> | 28 <script type="text/javascript"> |
29 | 29 |
30 function runTest() { | 30 function runTest() { |
31 | 31 |
32 if (!window.testRunner) { | 32 if (!window.testRunner) { |
33 | 33 |
34 var id1 = "a"; | 34 var id1 = "a"; |
35 var id2 = "b"; | 35 var id2 = "b"; |
36 var element1 = document.getElementById(id1); | 36 var element1 = document.getElementById(id1); |
37 var element2 = document.getElementById(id2); | 37 var element2 = document.getElementById(id2); |
38 var x1 = element1.getBoundingClientRect().left; | 38 var x1 = element1.getBoundingClientRect().left; |
39 var y1 = element1.getBoundingClientRect().top; | 39 var y1 = element1.getBoundingClientRect().top; |
40 var x2 = element2.getBoundingClientRect().left; | 40 var x2 = element2.getBoundingClientRect().left; |
41 var y2 = element2.getBoundingClientRect().top; | 41 var y2 = element2.getBoundingClientRect().top; |
42 | 42 |
43 var resultString = ''; | 43 var resultString = ''; |
44 if (x1 == x2 && y1 == y2) { | 44 var tolerance = 1e-2; |
| 45 if (Math.abs(x1 - x2) < tolerance && Math.abs(y1 - y2) < tolerance) { |
45 resultString += "PASS - Element " + id1 + " and Element " + id2 + "
had identical positions"; | 46 resultString += "PASS - Element " + id1 + " and Element " + id2 + "
had identical positions"; |
46 } else { | 47 } else { |
47 resultString += "FAIL - Element " + id1 + " and Element " + id2 + "
had different positions"; | 48 resultString += "FAIL - Element " + id1 + " and Element " + id2 + "
had different positions"; |
48 } | 49 } |
49 | 50 |
50 document.body.appendChild(document.createTextNode(resultString)); | 51 document.body.appendChild(document.createTextNode(resultString)); |
51 } | 52 } |
52 } | 53 } |
53 </script> | 54 </script> |
54 </head> | 55 </head> |
55 <body onload="runTest();"> | 56 <body onload="runTest();"> |
56 | 57 |
57 <!-- You should see green box only. If you see red, the test has failed --> | 58 <!-- You should see green box only. If you see red, the test has failed --> |
58 | 59 |
59 <div id='a' class="box translate"></div> | 60 <div id='a' class="box translate"></div> |
60 <div id='b' class="box matrix"></div> | 61 <div id='b' class="box matrix"></div> |
61 | 62 |
62 <script> | 63 <script> |
63 document.getElementById('b').style.webkitTransform = new WebKitCSSMatrix('ma
trix3d(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 100, 50, 0, 1)'); | 64 document.getElementById('b').style.webkitTransform = new WebKitCSSMatrix('ma
trix3d(0.707107, 0, -0.707107, 0.00353553, 0, 1, 0, 0, 0.707107, 0, 0.707107, -0
.00353553, 100, 50, 25, 0.875)'); |
64 </script> | 65 </script> |
65 </body> | 66 </body> |
66 </html> | 67 </html> |
OLD | NEW |