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/repaint.js"></script> |
16 <script> | 16 <script> |
17 if (window.testRunner) | 17 if (window.testRunner) |
18 testRunner.dumpAsText(true); | 18 testRunner.dumpAsTextWithPixelResults(); |
19 | 19 |
20 function runTest() { | 20 function runTest() { |
21 var canvas = document.getElementById('canvas'); | 21 var canvas = document.getElementById('canvas'); |
22 var ctx = canvas.getContext('2d'); | 22 var ctx = canvas.getContext('2d'); |
23 ctx.fillStyle = 'red'; | 23 ctx.fillStyle = 'red'; |
24 ctx.fillRect(0, 0, 300, 300); | 24 ctx.fillRect(0, 0, 300, 300); |
25 runRepaintTest(); | 25 runRepaintTest(); |
26 } | 26 } |
27 | 27 |
28 function repaintTest() { | 28 function repaintTest() { |
29 var canvas = document.getElementById('canvas'); | 29 var canvas = document.getElementById('canvas'); |
30 // This changes the resolution of the canvas but keeps its layout size c
onstant. | 30 // This changes the resolution of the canvas but keeps its layout size c
onstant. |
31 canvas.width = canvas.width / 2; | 31 canvas.width = canvas.width / 2; |
32 } | 32 } |
33 </script> | 33 </script> |
34 </head> | 34 </head> |
35 <body onload="runTest();"> | 35 <body onload="runTest();"> |
36 <canvas id="canvas" width="300" height="300"/> | 36 <canvas id="canvas" width="300" height="300"/> |
37 </body> | 37 </body> |
38 </html> | 38 </html> |
OLD | NEW |