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
45
46
47
48
49
50
|
<html>
<head>
<style>
div {
width:600px;
height:500px;
border:2px solid black;
content: -webkit-canvas(squares);
}
</style>
<script type="application/x-javascript">
if (window.testRunner)
testRunner.waitUntilDone();
var canvasContext;
function runRepaintTest()
{
canvasContext = document.getCSSCanvasContext("2d", "squares", 300, 300);
if (window.testRunner) {
document.body.offsetTop;
testRunner.display();
repaintTest();
testRunner.notifyDone();
} else {
setTimeout(repaintTest, 2000);
}
}
function repaintTest()
{
draw();
}
function draw()
{
var ctx = canvasContext;
ctx.fillStyle = "rgb(200,0,0)";
ctx.fillRect (10, 10, 100, 100);
ctx.fillStyle = "rgba(0, 0, 200, 0.5)";
ctx.fillRect (50, 50, 100, 100);
}
</script>
</head>
<body onload="runRepaintTest()">
<div></div>
</body>
</html>
|