OLD | NEW |
(Empty) | |
| 1 <!DOCTYPE html> |
| 2 <html> |
| 3 <body style="zoom: 1.2"> |
| 4 <p>An all green square should appear below</p> |
| 5 <canvas id="A" width=300 height=300></canvas> |
| 6 <script type="text/javascript" charset="utf-8"> |
| 7 if (window.testRunner) |
| 8 testRunner.waitUntilDone(); |
| 9 var context; |
| 10 |
| 11 window.onload = function() { |
| 12 context = document.getElementById("A").getContext("2d"); |
| 13 context.fillStyle = 'red'; |
| 14 context.fillRect(1, 1, 298, 298); |
| 15 requestAnimationFrame(doUpdate1); |
| 16 } |
| 17 |
| 18 function doUpdate1() { |
| 19 context.fillStyle = 'red'; |
| 20 context.fillRect(1, 1, 298, 298); |
| 21 // We need to chain 2 rAFs because the first rAF may be called |
| 22 // before the initial presentation. |
| 23 requestAnimationFrame(doUpdate2); |
| 24 } |
| 25 |
| 26 function doUpdate2() { |
| 27 context.fillStyle = 'green'; |
| 28 context.fillRect(1, 1, 298, 298); |
| 29 testRunner.notifyDone(); |
| 30 } |
| 31 |
| 32 </script> |
| 33 </body> |
| 34 </html> |
OLD | NEW |