1<!-- Test for https://bugs.webkit.org/show_bug.cgi?id=46319 -->
2<head>
3 <style>
4 canvas {
5 object-fit: contain;
6 border: 1px solid black;
7 width: 200px;
8 height: 100px;
9 }
10 </style>
11</head>
12<body>
13 <canvas id="canvas" width="200" height="200"></canvas>
14<pre id="layers"></pre>
15 <script>
16 if (window.testRunner) {
17 testRunner.dumpAsText();
18 testRunner.waitUntilDone();
19 }
20
21 var canvas = document.getElementById('canvas');
22 var ctx = canvas.getContext('2d');
23
24 ctx.fillStyle = "rgb(0, 128, 0)";
25 ctx.fillRect(0, 0, 200, 200);
26
27 function repaintTest()
28 {
29 if (window.internals)
30 window.internals.startTrackingRepaints();
31
32 ctx.fillStyle = "rgb(0, 0, 128)";
33 ctx.fillRect(40, 40, 10, 10);
34
35 if (window.internals)
36 document.getElementById('layers').textContent = window.internals.layerTreeAsText(document, internals.LAYER_TREE_INCLUDES_REPAINT_RECTS);
37
38 if (window.testRunner)
39 testRunner.notifyDone();
40 }
41
42 function startTest()
43 {
44 setTimeout(function() {
45 repaintTest();
46 }, 0)
47 }
48 window.addEventListener('load', startTest, false);
49 </script>
50</body>