OLD | NEW |
1 <!DOCTYPE HTML> | 1 <!DOCTYPE HTML> |
2 <html> | 2 <html> |
3 <head> | 3 <head> |
4 <title>CSS 3D Test: Projected Blue Box over Black Background</title> | 4 <title>CSS 3D Test: Projected Blue Box over Black Background</title> |
5 <style type="text/css"> | 5 <style type="text/css"> |
6 .nomargin { | 6 .nomargin { |
7 margin: 0px auto; | 7 margin: 0px auto; |
8 } | 8 } |
9 | 9 |
10 #container { | 10 #container { |
11 -webkit-perspective: 500; | 11 -webkit-perspective: 500; |
12 } | 12 } |
13 | 13 |
14 #container > div { | 14 #container > div { |
15 position: relative; | 15 position: relative; |
16 margin: 50px; | 16 margin: 50px; |
17 width: 125px; | 17 width: 125px; |
18 height: 75px; | 18 height: 75px; |
19 } | 19 } |
20 | 20 |
21 #container > :first-child { | 21 #container > :first-child { |
22 background-color: blue; | 22 background-color: blue; |
23 -webkit-transform: rotateY(45deg); | 23 -webkit-transform: rotateY(45deg); |
24 } | 24 } |
25 </style> | 25 </style> |
26 <script> | 26 <script> |
27 var g_swapsBeforeAck = 15; | 27 var g_swapsBeforeAck = 15; |
28 var g_paintLoopStarted = false; | 28 var g_targetWidth, g_targetHeight; |
29 | 29 |
30 function main() | 30 function main() |
31 { | 31 { |
32 g_swapsBeforeAck = 15; | 32 if (g_targetWidth != window.outerWidth || |
33 if (!g_paintLoopStarted) { | 33 g_targetHeight != window.outerHeight) |
34 g_paintLoopStarted = true; | 34 return; |
35 waitForFinish(); | 35 |
36 } | 36 waitForFinish(); |
37 } | 37 } |
38 | 38 |
39 function waitForFinish() | 39 function waitForFinish() |
40 { | 40 { |
41 if (g_swapsBeforeAck == 0) { | 41 if (g_swapsBeforeAck == 0) { |
42 domAutomationController.setAutomationId(1); | 42 domAutomationController.setAutomationId(1); |
43 domAutomationController.send("resized"); | 43 domAutomationController.send("resized"); |
44 } else { | 44 } else { |
45 g_swapsBeforeAck--; | 45 g_swapsBeforeAck--; |
46 document.getElementById('blue_box').style.zIndex = g_swapsBeforeAck + 1; | 46 document.getElementById('blue_box').style.zIndex = g_swapsBeforeAck + 1; |
47 window.webkitRequestAnimationFrame(waitForFinish); | 47 window.webkitRequestAnimationFrame(waitForFinish); |
48 } | 48 } |
49 } | 49 } |
50 | 50 |
51 function notifyLoadFinished() | 51 function notifyLoadFinished() |
52 { | 52 { |
53 domAutomationController.setAutomationId(1); | 53 domAutomationController.setAutomationId(1); |
54 domAutomationController.send("ok"); | 54 domAutomationController.send("ok"); |
55 } | 55 } |
56 | 56 |
57 function preCallResizeInChromium() | 57 function preCallResizeInChromium(targetWidth, targetHeight) |
58 { | 58 { |
| 59 g_targetWidth = targetWidth; |
| 60 g_targetHeight = targetHeight; |
59 window.onresize = main; | 61 window.onresize = main; |
| 62 |
60 // Call main() on a timeout in case the window did not resize for whatever | 63 // Call main() on a timeout in case the window did not resize for whatever |
61 // reason. | 64 // reason. |
62 setTimeout(main, 10000); | 65 setTimeout(main, 10000); |
63 } | 66 } |
64 </script> | 67 </script> |
65 </head> | 68 </head> |
66 <body onload="notifyLoadFinished()"> | 69 <body onload="notifyLoadFinished()"> |
67 <div style="position:relative; width:200px; height:200px; background-color:black
; zindex-0"> | 70 <div style="position:relative; width:200px; height:200px; background-color:black
; zindex-0"> |
68 </div> | 71 </div> |
69 <div id="container" style="position:absolute; top:0px; left:0px"> | 72 <div id="container" style="position:absolute; top:0px; left:0px"> |
70 <div id="blue_box"></div> | 73 <div id="blue_box"></div> |
71 </div> | 74 </div> |
72 </body> | 75 </body> |
73 </html> | 76 </html> |
OLD | NEW |