summaryrefslogtreecommitdiffstats
path: root/third_party/WebKit/LayoutTests/fast/canvas/setWidthResetAfterForcedRender.html
blob: 47990bc6c67e96b0b639a6544fef6887fb14b1f3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
        "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<script src="../../resources/run-after-layout-and-paint.js"></script>
<script>
if (window.testRunner) {
  testRunner.dumpAsTextWithPixelResults();
  testRunner.waitUntilDone();
}

function repaintTest()
{
    var canvas = document.getElementById('c1');
    var offset = document.body.offsetLeft; // Forces layout
    canvas.width = canvas.width; // Should wipe canvas clean
    if (window.testRunner)
        testRunner.notifyDone();
}
</script>
</head>
<body onload="runAfterLayoutAndPaint(repaintTest);">
<p><b>BUG ID:</b> <a href="https://bugs.webkit.org/show_bug.cgi?id=43341">Bugzilla bug 43341</a>
Setting canvas width after canvas already rendered resets canvas data appropriately, but doesn't repaint immediately.
<p id="success" style="background-color:palegreen; padding:3px;"><b>TEST PASS:</b> 
The canvas should go blank due to setting on the canvas width.
</p>

<hr>

<p class="output">Actual output: (blank canvas)</p>
<canvas id="c1" class="output" width="100" height="50" ></canvas>

<script>

var canvas = document.getElementById('c1');
var ctx = canvas.getContext('2d');
ctx.fillStyle = '#0f0';
ctx.fillRect(0, 0, 100, 50);

</script>

</body>
</html>