blob: e5d8d7d386490f6e7e6ba79d982b6376e5a1edb1 (
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
|
<!DOCTYPE html>
<!-- Check that resizing a (potentially accelerated) canvas properly clears its
contents even if the layout size of the canvas does not change. Expected
output is a blank canvas.
https://bugs.webkit.org/show_bug.cgi?id=80871 -->
<html>
<head>
<style>
#canvas {
outline: solid 1px black;
width: 300px;
height: 300px;
}
</style>
<script src="../../resources/run-after-layout-and-paint.js"></script>
<script>
if (window.testRunner) {
testRunner.dumpAsTextWithPixelResults();
testRunner.waitUntilDone();
}
function runTest() {
var canvas = document.getElementById('canvas');
var ctx = canvas.getContext('2d');
ctx.fillStyle = 'red';
ctx.fillRect(0, 0, 300, 300);
runAfterLayoutAndPaint(repaintTest);
}
function repaintTest() {
var canvas = document.getElementById('canvas');
// This changes the resolution of the canvas but keeps its layout size constant.
canvas.width = canvas.width / 2;
if (window.testRunner)
testRunner.notifyDone();
}
</script>
</head>
<body onload="runTest();">
<canvas id="canvas" width="300" height="300"/>
</body>
</html>
|