| OLD | NEW |
| 1 <!-- Based on fast/repaint/canvas-resize-no-full-invalidation.html --> |
| 1 <!DOCTYPE html> | 2 <!DOCTYPE html> |
| 2 <style> | 3 <style> |
| 3 canvas { | 4 canvas { |
| 4 position: absolute; | 5 position: absolute; |
| 5 width: 600px; | 6 width: 600px; |
| 6 height: 500px; | 7 height: 500px; |
| 7 top: 50px; | 8 top: 50px; |
| 8 left: 50px; | 9 left: 50px; |
| 9 /* 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 |
| 10 by the resize in repaintTest(). */ | 11 window.expectedPaintInvalidationObjects = [ |
| 12 "LayoutHTMLCanvas (positioned) CANVAS id='canvas'", |
| 13 ]; |
| 14 by the resize in paintInvalidationTest(). */ |
| 11 object-fit: contain; | 15 object-fit: contain; |
| 12 object-position: 0 0; | 16 object-position: 0 0; |
| 13 background-color: #030; | 17 background-color: #030; |
| 14 } | 18 } |
| 15 </style> | 19 </style> |
| 16 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. | 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 <canvas id="canvas" width="500" height="500"></canvas> | 21 <canvas id="canvas" width="500" height="500"></canvas> |
| 18 | 22 |
| 19 <script src="resources/text-based-repaint.js"></script> | 23 <script src="resources/paint-invalidation-test.js"></script> |
| 20 <script> | 24 <script> |
| 21 function repaintTest() { | 25 window.expectedPaintInvalidationObjects = [ |
| 26 "LayoutHTMLCanvas (positioned) CANVAS id='canvas'", |
| 27 ]; |
| 28 function paintInvalidationTest() { |
| 22 document.getElementById('canvas').style.width = '500px'; | 29 document.getElementById('canvas').style.width = '500px'; |
| 23 } | 30 } |
| 24 onload = runRepaintTest; | 31 onload = runPaintInvalidationTest; |
| 25 | 32 |
| 26 var ctx = document.getElementById('canvas').getContext('2d'); | 33 var ctx = document.getElementById('canvas').getContext('2d'); |
| 27 ctx.beginPath(); | 34 ctx.beginPath(); |
| 28 ctx.arc(250, 250, 250, 0, 2 * Math.PI); | 35 ctx.arc(250, 250, 250, 0, 2 * Math.PI); |
| 29 ctx.fillStyle = 'green'; | 36 ctx.fillStyle = 'green'; |
| 30 ctx.fill(); | 37 ctx.fill(); |
| 31 </script> | 38 </script> |
| OLD | NEW |