OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <!-- Check that resizing a (potentially accelerated) canvas properly clears its | 2 <!-- Check that resizing a (potentially accelerated) canvas properly clears its |
3 contents even if the layout size of the canvas does not change. Expected | 3 contents even if the layout size of the canvas does not change. Expected |
4 output is a blank canvas. | 4 output is a blank canvas. |
5 https://bugs.webkit.org/show_bug.cgi?id=80871 --> | 5 https://bugs.webkit.org/show_bug.cgi?id=80871 --> |
6 <html> | 6 <html> |
7 <head> | 7 <head> |
8 <style> | 8 <style> |
9 #canvas { | 9 #canvas { |
10 outline: solid 1px black; | 10 outline: solid 1px black; |
11 width: 300px; | 11 width: 300px; |
12 height: 300px; | 12 height: 300px; |
13 } | 13 } |
14 </style> | 14 </style> |
15 <script src="resources/repaint.js"></script> | 15 <script src="../../resources/run-after-display.js"></script> |
16 <script> | 16 <script> |
17 if (window.testRunner) | 17 if (window.testRunner) { |
18 testRunner.dumpAsTextWithPixelResults(); | 18 testRunner.dumpAsTextWithPixelResults(); |
| 19 testRunner.waitUntilDone(); |
| 20 } |
19 | 21 |
20 function runTest() { | 22 function runTest() { |
21 var canvas = document.getElementById('canvas'); | 23 var canvas = document.getElementById('canvas'); |
22 var ctx = canvas.getContext('2d'); | 24 var ctx = canvas.getContext('2d'); |
23 ctx.fillStyle = 'red'; | 25 ctx.fillStyle = 'red'; |
24 ctx.fillRect(0, 0, 300, 300); | 26 ctx.fillRect(0, 0, 300, 300); |
25 runRepaintTest(); | 27 runAfterDisplay(repaintTest); |
26 } | 28 } |
27 | 29 |
28 function repaintTest() { | 30 function repaintTest() { |
29 var canvas = document.getElementById('canvas'); | 31 var canvas = document.getElementById('canvas'); |
30 // This changes the resolution of the canvas but keeps its layout size c
onstant. | 32 // This changes the resolution of the canvas but keeps its layout size c
onstant. |
31 canvas.width = canvas.width / 2; | 33 canvas.width = canvas.width / 2; |
| 34 if (window.testRunner) |
| 35 testRunner.notifyDone(); |
32 } | 36 } |
33 </script> | 37 </script> |
34 </head> | 38 </head> |
35 <body onload="runTest();"> | 39 <body onload="runTest();"> |
36 <canvas id="canvas" width="300" height="300"/> | 40 <canvas id="canvas" width="300" height="300"/> |
37 </body> | 41 </body> |
38 </html> | 42 </html> |
OLD | NEW |