Index: LayoutTests/compositing/overflow/invisible-descendants-should-not-affect-opt-in.html |
diff --git a/LayoutTests/compositing/overflow/invisible-descendants-should-not-affect-opt-in.html b/LayoutTests/compositing/overflow/invisible-descendants-should-not-affect-opt-in.html |
new file mode 100644 |
index 0000000000000000000000000000000000000000..7dcb3b069c4fe2e2cc46adb01c513d9acd0a03ac |
--- /dev/null |
+++ b/LayoutTests/compositing/overflow/invisible-descendants-should-not-affect-opt-in.html |
@@ -0,0 +1,115 @@ |
+<!DOCTYPE html> |
+ |
+<html> |
+<head> |
+ <style> |
+ .container { |
+ width: 200px; |
+ height: 200px; |
+ overflow: scroll; |
+ margin: 20px; |
+ border: 1px solid black; |
+ } |
+ |
+ .scrolled { |
+ width: 180px; |
+ height: 90px; |
+ margin: 10px; |
+ background-color: gray; |
+ position: relative; |
+ } |
+ |
+ .positioned { |
+ width: 120px; |
+ height: 240px; |
+ background-color: green; |
+ position: absolute; |
+ } |
+ |
+ #descendant { |
+ left: 90px; |
+ top: 20px; |
+ background-color: blue; |
+ z-index: -20; |
+ } |
+ </style> |
+ <script> |
+ var debugMode = false; |
+ |
+ if (window.testRunner) |
+ testRunner.dumpAsText(); |
+ |
+ if (window.internals) |
+ window.internals.settings.setAcceleratedCompositingForOverflowScrollEnabled(true); |
+ |
+ function write(str) |
+ { |
+ var pre = document.getElementById('console'); |
+ var text = document.createTextNode(str + '\n'); |
+ pre.appendChild(text); |
+ } |
+ |
+ var iteration = 0; |
+ function printResult(expectedResult) |
+ { |
+ // Force a style recalc. |
+ document.body.offsetTop; |
+ |
+ if (window.internals) { |
+ var layerTree = window.internals.layerTreeAsText(document); |
+ |
+ if (!layerTree == !expectedResult) |
+ write('Iteration ' + iteration.toString() + ': Passed') |
+ else |
+ write('Iteration ' + iteration.toString() + ': FAILED') |
+ |
+ if (layerTree) { |
+ write('Iteration ' + iteration.toString() + ', layer tree'); |
+ if (debugMode) |
+ write(layerTree); |
+ } else |
+ write('Iteration ' + iteration.toString() + ', no layer tree'); |
+ } |
+ iteration++; |
+ } |
+ |
+ function doTest() |
+ { |
+ var descendant = document.getElementById('descendant'); |
+ |
+ // Check that we don't promote if we have an out of flow descendant. |
+ // We need to hide the predecessor and successor so they don't interfere |
+ // with this experiment. |
+ for (i = 0; i < 3; ++i) { |
+ if (i == 0) { |
+ descendant.style.visibility = 'hidden'; |
+ descendant.style.display = ''; |
+ } else if (i == 1) { |
+ descendant.style.visibility = ''; |
+ descendant.style.display = ''; |
+ } else { |
+ descendant.style.visibility = ''; |
+ descendant.style.display = 'none'; |
+ } |
+ |
+ // If the out of flow positioned descendant is visible, we cannot opt |
+ // into composited scrolling. |
+ printResult(i != 1); |
+ } // for i |
+ |
+ } // function doTest |
+ |
+ window.addEventListener('load', doTest, false); |
+ </script> |
+</head> |
+ |
+<body> |
+ <div class="container" id="container"> |
+ <div class="scrolled" id="firstChild"></div> |
+ <div class="scrolled" id="secondChild"></div> |
+ <div class="positioned" id="descendant"></div> |
+ </div> |
+ <pre id="console"></pre> |
+</body> |
+</html> |
+ |