summaryrefslogtreecommitdiffstats
path: root/third_party/WebKit/LayoutTests/compositing/layer-creation/should-invoke-deferred-compositing.html
blob: 085a7c264ffae7c352c3c244366004b33a5ff3ff (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
45
46
47
48
49
50
51
52
53
54
55
56
<!DOCTYPE html>

<!-- crbug.com/336676 - layer creation should not accidentally skip requesting
     the compositor for a frame to be produced. When there were no other
     repaints or layout/style changes, the simple act of adding a layer was not
     triggering compositing updates by itself. To recreate this scenario, an
     out-of-flow canvas element is added to an empty composited layer. The
     actual container layer does not get added to the tree until it realizes
     that it receives the canvas content. -->


<html>
<head>
<script src="../../fast/repaint/resources/text-based-repaint.js"></script>
<style>

.composited {
  transform: translatez(0);
}

.box {
  position: absolute;
  z-index: 1;
  width: 300px;
  height: 300px;
  top: 0px;
  left: 0px;
}

canvas {
  position: absolute;
  z-index: 1;
  top: 0px;
  left: 0px;
}

</style>

<script>
  function repaintTest() {
    var canvasElement = document.createElement("canvas");
    canvasElement.width = 200;
    canvasElement.height = 200;
    var context = canvasElement.getContext("2d");
    context.fillStyle = "green";
    context.fillRect(80, 80, 50, 50);
    document.getElementById("container").appendChild(canvasElement);
  }
</script>
</head>

<body onload="runRepaintAndPixelTest()">
  <div id="container" class="composited box"></div>
</body>

</html>