summaryrefslogtreecommitdiffstats
path: root/third_party/WebKit/LayoutTests/compositing/squashing/squash-transform-repainting-child.html
blob: 62945ea140bfe7817d2168c3bab64cab24400763 (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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
<!DOCTYPE html>
<head>
<script src="../../resources/run-after-layout-and-paint.js"></script>
<style>
.composited {
transform: translatez(0);
}

.box {
  width: 100px;
  height: 100px;
}

.behind {
  position: absolute;
  z-index: 1;
  top: 100px;
  left: 100px;
  background-color: blue;
}

.middle {
  position: absolute;
  z-index: 1;
  top: 20px;
  left: 20px;
  background-color: lime;
  transform: rotate(45deg);
}

.top {
  position: absolute;
  z-index: 1;
  top: 180px;
  left: 180px;
  background-color: cyan;
}

.smallbox {
  position: absolute;
  top: 25px;
  left: 20px;
  width: 50px;
  height: 50px;
  background-color: magenta;
}

div:hover {
  background-color: green;
}

.smallbox:hover {
  background-color: lime;
}

</style>
<script>
    if (window.testRunner) {
        testRunner.dumpAsText();
        testRunner.waitUntilDone();
    }

    function runTest()
    {
        runAfterLayoutAndPaint(executeTestCases);
    }

    function executeTestCases()
    {
        window.internals.startTrackingRepaints(document);
        document.getElementById('Case1').textContent = window.internals.layerTreeAsText(document, internals.LAYER_TREE_INCLUDES_REPAINT_RECTS);
        window.internals.stopTrackingRepaints(document);

        eventSender.mouseMoveTo(0, 0);
        window.internals.startTrackingRepaints(document);
        hoverOverOuterDiv();
        document.getElementById('Case2').textContent = window.internals.layerTreeAsText(document, internals.LAYER_TREE_INCLUDES_REPAINT_RECTS);
        window.internals.stopTrackingRepaints(document);

        eventSender.mouseMoveTo(0, 0);
        window.internals.startTrackingRepaints(document);
        hoverOverInnerDiv();
        document.getElementById('Case3').textContent = window.internals.layerTreeAsText(document, internals.LAYER_TREE_INCLUDES_REPAINT_RECTS);
        window.internals.stopTrackingRepaints(document);

        // Display the test results only after test is done so that it does not affect repaint rect results.
        document.getElementById('testResults').style.display = "block";

        if (window.testRunner)
            testRunner.notifyDone();
    }

    function hoverOverOuterDiv()
    {
        internals.setIsCursorVisible(document, true);
        eventSender.mouseMoveTo(10, 65);

    }

    function hoverOverInnerDiv()
    {
        internals.setIsCursorVisible(document, true);
        eventSender.mouseMoveTo(40, 65);

    }
</script>
</head>
<body onload="runTest()">
  <div class="composited box behind"></div>

  <div class="box middle">
    <div class="smallbox"></div>
  </div>

  <div class="box top"></div>

  <div id="testResults" style="display:none">
    CASE 1, original layer tree
    <pre id="Case1"></pre>

    CASE 2, hovering over the outer div
    <pre id="Case2"></pre>

    CASE 3, hovering over the inner div
    <pre id="Case3"></pre>
  </div>
</body>