Index: LayoutTests/compositing/squashing/squashed-repaints.html |
diff --git a/LayoutTests/compositing/squashing/squashed-repaints.html b/LayoutTests/compositing/squashing/squashed-repaints.html |
new file mode 100644 |
index 0000000000000000000000000000000000000000..31ab0009cf8fb0e321414843a8158d37dea4f785 |
--- /dev/null |
+++ b/LayoutTests/compositing/squashing/squashed-repaints.html |
@@ -0,0 +1,130 @@ |
+<!DOCTYPE html> |
+<html> |
+<head> |
+<style> |
+div { |
+ position: absolute; |
+ z-index: 1; |
+ width: 100px; |
+ height: 100px; |
+} |
+ |
+.composited { |
+ -webkit-transform: translatez(0); |
+ top: 60px; |
+ left: 60px; |
+ background-color: gray; |
+} |
+ |
+.overlap1 { |
+ top: 140px; |
+ left: 140px; |
+ background-color: blue; |
+} |
+ |
+.overlap2 { |
+ top: 220px; |
+ left: 220px; |
+ background-color: lime; |
+} |
+ |
+.overlap3 { |
+ top: 300px; |
+ left: 300px; |
+ background-color: magenta; |
+} |
+ |
+div:hover { |
+ background-color: green; |
+} |
+ |
+.green { |
+ background-color: green; |
+} |
+ |
+#testResults { |
+ display: none; |
+} |
+ |
+</style> |
+<script> |
+ if (window.testRunner) |
+ testRunner.dumpAsText(); |
+ |
+ if (window.internals) |
+ internals.settings.setLayerSquashingEnabled(true); |
+ |
+ function runTest() |
+ { |
+ if (!window.internals) |
+ return; |
+ |
+ testRunner.display(); |
+ |
+ // Case 1 |
+ document.getElementById('Case1').textContent = window.internals.layerTreeAsText(document, internals.LAYER_TREE_INCLUDES_REPAINT_RECTS); |
+ |
+ // Case 2 |
+ window.internals.startTrackingRepaints(document); |
+ document.getElementById("A").style.backgroundColor = "green"; |
+ document.getElementById('Case2').textContent = window.internals.layerTreeAsText(document, internals.LAYER_TREE_INCLUDES_REPAINT_RECTS); |
+ window.internals.stopTrackingRepaints(document); |
+ |
+ // Case 3 |
+ window.internals.startTrackingRepaints(document); |
+ document.getElementById("A").style.backgroundColor = "blue"; |
+ document.getElementById("B").style.backgroundColor = "green"; |
+ document.getElementById('Case3').textContent = window.internals.layerTreeAsText(document, internals.LAYER_TREE_INCLUDES_REPAINT_RECTS); |
+ window.internals.stopTrackingRepaints(document); |
+ |
+ // Case 4 |
+ window.internals.startTrackingRepaints(document); |
+ document.getElementById("B").style.backgroundColor = "blue"; |
+ document.getElementById("C").style.backgroundColor = "green"; |
+ document.getElementById('Case4').textContent = window.internals.layerTreeAsText(document, internals.LAYER_TREE_INCLUDES_REPAINT_RECTS); |
+ window.internals.stopTrackingRepaints(document); |
+ |
+ // Case 5 |
+ window.internals.startTrackingRepaints(document); |
+ document.getElementById("C").style.backgroundColor = "blue"; |
+ document.getElementById("A").style.backgroundColor = "green"; |
+ document.getElementById('Case5').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"; |
+ } |
+</script> |
+</head> |
+ |
+<body onload="runTest()"> |
+ |
+ <p>Basic repaint test for squashed layers. The entire squashing layer should not need repainting when |
+ only a portion of it is invalidated. Test interactively by using --show-paint-rects and hovering |
+ over elements to change their color.</p> |
+ |
+ <div class="composited"></div> |
+ <div id="A" class="overlap1"></div> |
+ <div id="B" class="overlap2"></div> |
+ <div id="C" class="overlap3"></div> |
+ |
+ <div id="testResults"> |
+ CASE 1, original layer tree: |
+ <pre id="Case1"></pre> |
+ |
+ CASE 2, overlap1 changes color: |
+ <pre id="Case2"></pre> |
+ |
+ CASE 3, overlap1 and overlap2 change color: |
+ <pre id="Case3"></pre> |
+ |
+ CASE 4, overlap2 and overlap3 change color: |
+ <pre id="Case4"></pre> |
+ |
+ CASE 5, overlap3 and overlap1 change color: |
+ <pre id="Case5"></pre> |
+ </div> |
+ |
+</body> |
+ |
+</html> |