summaryrefslogtreecommitdiffstats
path: root/third_party/WebKit/LayoutTests/inspector/layer-tree-model.html
blob: 81fa43d802c9dec7ab1302506dcb12ec593aa0db (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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
<html>
<head>
<style>
.layer {
    -webkit-transform: translateZ(10px);
    opacity: 0.8;
}
</style>
<script src="../http/tests/inspector/inspector-test.js"></script>
<script src="../http/tests/inspector/layers-test.js"></script>
<script>
window.quietUntilDone = true;

function updateTree()
{
    document.getElementById("c").appendChild(document.getElementById("b1"));
    var b3 = document.getElementById("b3");
    b3.parentElement.removeChild(b3);
    var b4 = document.createElement("div");
    b4.id = "b4";
    b4.className = "layer";
    document.getElementById("a").appendChild(b4);
}

function updateGeometry()
{
    document.getElementById("c").style.width = "80px";
}

function test()
{
    function addDepthMarker(layer)
    {
        layer.__extraData = layer.parent() ? layer.parent().__extraData + 1 : 0;
    }

    InspectorTest.requestLayers(step1);

    function step1()
    {
        // Assure layer objects are not re-created during updates.
        InspectorTest._layerTreeModel.forEachLayer(addDepthMarker);
        InspectorTest.addResult("Initial layer tree");
        InspectorTest.dumpLayerTree();
        InspectorTest.evaluateAndRunWhenTreeChanges("requestAnimationFrame(updateTree)", step2);
    }

    function step2()
    {
        InspectorTest.addResult("Updated layer tree");
        InspectorTest.dumpLayerTree();
        InspectorTest.evaluateAndRunWhenTreeChanges("requestAnimationFrame(updateGeometry)", step3);
    }

    function step3()
    {
        InspectorTest.addResult("Updated layer geometry");
        InspectorTest.dumpLayerTree();
        InspectorTest.completeTest();
    }
}

</script>
</head>
<body onload="runTest()">
<div id="a" style="width: 200px; height: 200px" class="layer">
    <div class="layer" id="b1" style="width: 150px; height: 100px"></div>
    <div id="b2" class="layer" style="width: 140px; height: 110px">
        <div id="c" class="layer" style="width: 100px; height: 90px"></div>
    </div>
    <div id="b3" class="layer" style="width: 140px; height: 110px"></div>
</div>
<iframe id="frame" src="resources/composited-iframe.html" width="200" height="200"></div>
</body>
</html>