OLD | NEW |
1 <!-- Based on fast/repaint/canvas-resize-no-full-invalidation.html --> | 1 <!-- Based on fast/repaint/canvas-resize-no-full-invalidation.html --> |
2 <!DOCTYPE html> | 2 <!DOCTYPE html> |
3 <style> | 3 <style> |
4 canvas { | 4 canvas { |
5 position: absolute; | 5 position: absolute; |
6 width: 600px; | 6 width: 600px; |
7 height: 500px; | 7 height: 500px; |
8 top: 50px; | 8 top: 50px; |
9 left: 50px; | 9 left: 50px; |
10 /* object-fit and object-position make the content of the canvas not affected | 10 /* object-fit and object-position make the content of the canvas not affected |
11 window.expectedPaintInvalidationObjects = [ | |
12 "LayoutHTMLCanvas (positioned) CANVAS id='canvas'", | |
13 ]; | |
14 by the resize in paintInvalidationTest(). */ | 11 by the resize in paintInvalidationTest(). */ |
15 object-fit: contain; | 12 object-fit: contain; |
16 object-position: 0 0; | 13 object-position: 0 0; |
17 background-color: #030; | 14 background-color: #030; |
18 } | 15 } |
19 </style> | 16 </style> |
20 Tests paint invalidation of canvas when it's resized which doesn't affect its co
ntents. Passes if there is only incremental invalidation for the resized backgro
und. | 17 Tests paint invalidation of canvas when it's resized which doesn't affect its co
ntents. Passes if there is only incremental invalidation for the resized backgro
und. |
21 <canvas id="canvas" width="500" height="500"></canvas> | 18 <canvas id="canvas" width="500" height="500"></canvas> |
22 | 19 |
23 <script src="resources/paint-invalidation-test.js"></script> | 20 <script src="resources/paint-invalidation-test.js"></script> |
24 <script> | 21 <script> |
25 window.expectedPaintInvalidationObjects = [ | |
26 "LayoutHTMLCanvas (positioned) CANVAS id='canvas'", | |
27 ]; | |
28 function paintInvalidationTest() { | 22 function paintInvalidationTest() { |
29 document.getElementById('canvas').style.width = '500px'; | 23 document.getElementById('canvas').style.width = '500px'; |
30 } | 24 } |
31 onload = runPaintInvalidationTest; | 25 onload = runPaintInvalidationTest; |
32 | 26 |
33 var ctx = document.getElementById('canvas').getContext('2d'); | 27 var ctx = document.getElementById('canvas').getContext('2d'); |
34 ctx.beginPath(); | 28 ctx.beginPath(); |
35 ctx.arc(250, 250, 250, 0, 2 * Math.PI); | 29 ctx.arc(250, 250, 250, 0, 2 * Math.PI); |
36 ctx.fillStyle = 'green'; | 30 ctx.fillStyle = 'green'; |
37 ctx.fill(); | 31 ctx.fill(); |
38 </script> | 32 </script> |
OLD | NEW |