Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / canvas / canvas-resize-after-paint-without-layout.html
blobe5d8d7d386490f6e7e6ba79d982b6376e5a1edb1
1 <!DOCTYPE html>
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
4 output is a blank canvas.
5 https://bugs.webkit.org/show_bug.cgi?id=80871 -->
6 <html>
7 <head>
8 <style>
9 #canvas {
10 outline: solid 1px black;
11 width: 300px;
12 height: 300px;
14 </style>
15 <script src="../../resources/run-after-layout-and-paint.js"></script>
16 <script>
17 if (window.testRunner) {
18 testRunner.dumpAsTextWithPixelResults();
19 testRunner.waitUntilDone();
22 function runTest() {
23 var canvas = document.getElementById('canvas');
24 var ctx = canvas.getContext('2d');
25 ctx.fillStyle = 'red';
26 ctx.fillRect(0, 0, 300, 300);
27 runAfterLayoutAndPaint(repaintTest);
30 function repaintTest() {
31 var canvas = document.getElementById('canvas');
32 // This changes the resolution of the canvas but keeps its layout size constant.
33 canvas.width = canvas.width / 2;
34 if (window.testRunner)
35 testRunner.notifyDone();
37 </script>
38 </head>
39 <body onload="runTest();">
40 <canvas id="canvas" width="300" height="300"/>
41 </body>
42 </html>