Index: LayoutTests/compositing/squashing/selection-repaint-with-gaps.html |
diff --git a/LayoutTests/compositing/squashing/selection-repaint-with-gaps.html b/LayoutTests/compositing/squashing/selection-repaint-with-gaps.html |
new file mode 100644 |
index 0000000000000000000000000000000000000000..85fd8561568ea619f329c0a7cb413880f81dd039 |
--- /dev/null |
+++ b/LayoutTests/compositing/squashing/selection-repaint-with-gaps.html |
@@ -0,0 +1,79 @@ |
+<!DOCTYPE html> |
+<style> |
+ .overlap { |
+ height: 500px; |
+ width: 300px; |
+ transform: translateZ(0); |
+ } |
+ |
+ .item { |
+ height: 50px; |
+ width: 100px; |
+ background: lightgray; |
+ margin: 15px; |
+ position: absolute; |
+ left: 0px; |
+ } |
+ .inline-block { |
+ display: inline-block; |
+ height: 10px; |
+ width: 40px; |
+ } |
+</style> |
+<script src="../../resources/run-after-display.js"></script> |
+ |
+<!-- This test checks whether repaint rects for selection on squashed layers is correct. --> |
+ |
+<div class="overlap"></div> |
+<div style="top: 20px" class="item"><div class="inline-block">lorem ipsum</div></div> |
+<div style="top: 100px" class="item" id="item1"><div class="inline-block">lorem ipsum</div></div> |
+<div style="top: 180px" class="item" id="item2"><div class="inline-block">lorem ipsum</div></div> |
+ |
+</div> |
+<div id="output" style="display: none"> |
+ <pre id="case1"></pre> |
+ <pre id="case2"></pre> |
+</div> |
+<script> |
+ if (window.testRunner) { |
+ testRunner.dumpAsText(); |
+ testRunner.waitUntilDone(); |
+ } |
+ |
+ if (window.internals) |
+ window.internals.settings.setLayerSquashingEnabled(true); |
+ |
+ runAfterDisplay(function() |
+ { |
+ if (window.internals) |
+ window.internals.startTrackingRepaints(document); |
+ var selection = getSelection(); |
+ |
+ // Case 1: selection that does not have any gaps. |
+ selection.setBaseAndExtent(document.querySelector("#item1"), 0, document.querySelector("#item1"), 1); |
+ |
+ if (window.internals) { |
+ document.querySelector('#case1').textContent = window.internals.layerTreeAsText(document, internals.LAYER_TREE_INCLUDES_REPAINT_RECTS); |
+ window.internals.stopTrackingRepaints(document); |
+ } |
+ |
+ selection.empty(); |
+ |
+ if (window.internals) |
+ window.internals.startTrackingRepaints(document); |
+ |
+ // Case 2: selection with a gap between item1 and item2. |
+ selection.setBaseAndExtent(document.querySelector("#item1"), 0, document.querySelector("#item2"), 1); |
+ |
+ if (window.internals) { |
+ document.querySelector('#case2').textContent = window.internals.layerTreeAsText(document, internals.LAYER_TREE_INCLUDES_REPAINT_RECTS); |
+ window.internals.stopTrackingRepaints(document); |
+ } |
+ |
+ document.querySelector('#output').style.display = 'block'; |
+ |
+ |
+ if (window.testRunner) |
+ testRunner.notifyDone(); |
+ }); |
+</script> |