13 transform: translatez(
0);
18 background-color: gray;
24 background-color: blue;
30 background-color: lime;
36 background-color: magenta;
40 background-color: green;
44 background-color: green;
57 if (window
.testRunner
)
58 testRunner
.dumpAsText();
60 var isInteractive
= true;
63 isInteractive
= false;
65 function resetLayers()
67 document
.getElementById("A").style
.display
= "block";
68 document
.getElementById("B").style
.display
= "block";
69 document
.getElementById("C").style
.display
= "none";
71 document
.removeEventListener("click", resetLayers
);
72 document
.addEventListener("click", addOverlap3
);
76 function addOverlap2()
78 document
.getElementById("B").style
.display
= "block";
80 document
.removeEventListener("click", addOverlap2
);
81 document
.addEventListener("click", resetLayers
);
85 function removeOverlap1()
87 document
.getElementById("A").style
.display
= "none";
89 document
.removeEventListener("click", removeOverlap1
);
90 document
.addEventListener("click", addOverlap2
);
95 function removeOverlap2()
97 document
.getElementById("B").style
.display
= "none";
99 document
.removeEventListener("click", removeOverlap2
);
100 document
.addEventListener("click", removeOverlap1
);
104 function addOverlap3()
106 document
.getElementById("C").style
.display
= "block";
108 document
.removeEventListener("click", addOverlap3
);
109 document
.addEventListener("click", removeOverlap2
);
113 document
.addEventListener("click", addOverlap3
);
117 if (!window
.internals
)
121 document
.getElementById('Case1').textContent
= window
.internals
.layerTreeAsText(document
);
124 window
.internals
.startTrackingRepaints(document
);
126 document
.getElementById('Case2').textContent
= window
.internals
.layerTreeAsText(document
, internals
.LAYER_TREE_INCLUDES_REPAINT_RECTS
);
127 window
.internals
.stopTrackingRepaints(document
);
130 window
.internals
.startTrackingRepaints(document
);
132 document
.getElementById('Case3').textContent
= window
.internals
.layerTreeAsText(document
, internals
.LAYER_TREE_INCLUDES_REPAINT_RECTS
);
133 window
.internals
.stopTrackingRepaints(document
);
136 window
.internals
.startTrackingRepaints(document
);
138 document
.getElementById('Case4').textContent
= window
.internals
.layerTreeAsText(document
, internals
.LAYER_TREE_INCLUDES_REPAINT_RECTS
);
139 window
.internals
.stopTrackingRepaints(document
);
142 window
.internals
.startTrackingRepaints(document
);
144 document
.getElementById('Case5').textContent
= window
.internals
.layerTreeAsText(document
, internals
.LAYER_TREE_INCLUDES_REPAINT_RECTS
);
145 window
.internals
.stopTrackingRepaints(document
);
148 window
.internals
.startTrackingRepaints(document
);
150 document
.getElementById('Case6').textContent
= window
.internals
.layerTreeAsText(document
, internals
.LAYER_TREE_INCLUDES_REPAINT_RECTS
);
151 window
.internals
.stopTrackingRepaints(document
);
153 // Display the test results only after test is done so that it does not affect repaint rect results.
154 document
.getElementById('testResults').style
.display
= "block";
159 <body onload=
"runTest()">
161 <p>Test that layers can be nicely added or removed from a squashed layer, without unnecessary repaints on any layer.
162 Click anywhere to test interactively; keep clicking to proceed through the test.
</p>
164 <div class=
"composited"></div>
165 <div id=
"A" class=
"overlap1"></div>
166 <div id=
"B" class=
"overlap2"></div>
167 <div id=
"C" class=
"overlap3"></div>
169 <div id=
"testResults">
170 CASE
1, original layer tree with overlap1 and overlap2:
171 <pre id=
"Case1"></pre>
173 CASE
2, overlap3 gets added:
174 <pre id=
"Case2"></pre>
176 CASE
3, overlap2 gets removed. Since this does not resize the layer, there should only be a repaint of overlap2:
177 <pre id=
"Case3"></pre>
179 CASE
4, overlap1 gets removed:
180 <pre id=
"Case4"></pre>
182 CASE
5, overlap2 gets added back:
183 <pre id=
"Case5"></pre>
185 CASE
6, overlap1 gets added back, and overlap3 gets removed:
186 <pre id=
"Case6"></pre>