OLD | NEW |
1 <!DOCTYPE HTML> | 1 <!DOCTYPE HTML> |
2 <html> | 2 <html> |
3 <head> | 3 <head> |
4 <title>Canvas 2D Test: Red Box over Black Background</title> | 4 <title>Canvas 2D Test: Red 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 </style> | 9 </style> |
10 <script> | 10 <script> |
(...skipping 24 matching lines...) Expand all Loading... |
35 c2d.fillRect(50, 50, 100, 100); | 35 c2d.fillRect(50, 50, 100, 100); |
36 } | 36 } |
37 | 37 |
38 function waitForFinish() | 38 function waitForFinish() |
39 { | 39 { |
40 if (g_swapsBeforeAck == 0) { | 40 if (g_swapsBeforeAck == 0) { |
41 domAutomationController.setAutomationId(1); | 41 domAutomationController.setAutomationId(1); |
42 domAutomationController.send("resized"); | 42 domAutomationController.send("resized"); |
43 } else { | 43 } else { |
44 g_swapsBeforeAck--; | 44 g_swapsBeforeAck--; |
45 draw(); | 45 document.getElementById('container').style.zIndex = g_swapsBeforeAck + 1; |
46 window.webkitRequestAnimationFrame(waitForFinish); | 46 window.webkitRequestAnimationFrame(waitForFinish); |
47 } | 47 } |
48 } | 48 } |
49 | 49 |
50 function notifyLoadFinished() | 50 function notifyLoadFinished() |
51 { | 51 { |
52 domAutomationController.setAutomationId(1); | 52 domAutomationController.setAutomationId(1); |
53 domAutomationController.send("ok"); | 53 domAutomationController.send("ok"); |
54 } | 54 } |
55 | 55 |
56 function preCallResizeInChromium(targetWidth, targetHeight) | 56 function preCallResizeInChromium(targetWidth, targetHeight) |
57 { | 57 { |
58 g_targetWidth = targetWidth; | 58 g_targetWidth = targetWidth; |
59 g_targetHeight = targetHeight; | 59 g_targetHeight = targetHeight; |
60 window.onresize = onresized; | 60 window.onresize = onresized; |
61 // Call main() on a timeout in case the window did not resize for whatever | 61 // Call main() on a timeout in case the window did not resize for whatever |
62 // reason. | 62 // reason. |
63 setTimeout(main, 10000); | 63 setTimeout(main, 10000); |
64 } | 64 } |
65 </script> | 65 </script> |
66 </head> | 66 </head> |
67 <body onload="notifyLoadFinished()"> | 67 <body onload="notifyLoadFinished()"> |
68 <div style="position:relative; width:200px; height:200px; background-color:black
"> | 68 <div style="position:relative; width:200px; height:200px; background-color:black
"> |
69 </div> | 69 </div> |
70 <div style="position:absolute; top:0px; left:0px"> | 70 <div id="container" style="position:absolute; top:0px; left:0px"> |
71 <canvas id="c" width="200" height="200" class="nomargin"></canvas> | 71 <canvas id="c" width="200" height="200" class="nomargin"></canvas> |
72 </div> | 72 </div> |
73 </body> | 73 </body> |
74 </html> | 74 </html> |
OLD | NEW |