Index: LayoutTests/compositing/overflow/ignore-main-thread-scroll-reasons-when-main-frame-not-scrollable.html |
diff --git a/LayoutTests/compositing/overflow/ignore-main-thread-scroll-reasons-when-main-frame-not-scrollable.html b/LayoutTests/compositing/overflow/ignore-main-thread-scroll-reasons-when-main-frame-not-scrollable.html |
new file mode 100644 |
index 0000000000000000000000000000000000000000..8e85e587cbc31ad5d0625c9cd141d59695eb44aa |
--- /dev/null |
+++ b/LayoutTests/compositing/overflow/ignore-main-thread-scroll-reasons-when-main-frame-not-scrollable.html |
@@ -0,0 +1,117 @@ |
+<!DOCTYPE html> |
+<html> |
+<head> |
+<style> |
+.non-layer-viewport-constrained { |
+ position: fixed; |
+} |
+ |
+.box { |
+ width: 50px; |
+ height: 50px; |
+} |
+ |
+.container { |
+ overflow: scroll; |
+ border: 1px solid black; |
+} |
+ |
+.container-element { |
+ position: relative; |
+ background-color: blue; |
+ margin: 10px; |
+} |
+ |
+#sibling { |
+ top: 220px; |
+ left: 10px; |
+ background-color: green; |
+} |
+ |
+#parent { |
+ position: absolute; |
+ left: 10px; |
+ top: 10px; |
+ width: 200px; |
+ height: 200px; |
+} |
+ |
+#description { |
+ position: absolute; |
+ top: 300px; |
+ left: 10px; |
+} |
+ |
+#console { |
+ position: absolute; |
+ top: 290px; |
+ left: 10px; |
+} |
+ |
+</style> |
+<script src="../../resources/js-test.js"></script> |
+<script> |
+if (window.internals) { |
+ // Our fixed position element must not be composited; this is a trigger for |
+ // forcing main thread compositing. |
+ window.internals.settings.setForceCompositingMode(true); |
+ window.internals.settings.setAcceleratedCompositingForFixedPositionEnabled(false); |
+ window.internals.settings.setAcceleratedCompositingForOverflowScrollEnabled(true); |
+} |
+ |
+window.jsTestIsAsync = true; |
+ |
+function shouldIgnore() { |
+ if (window.internals) { |
+ var reasons = internals.mainThreadScrollingReasons(document); |
+ if (reasons === '') |
+ testPassed("No main thread scrolling reasons."); |
+ else |
+ testFailed("Should have found no main thread scrolling reasons. " + |
+ "Instead, they were '" + reasons + "'."); |
+ } else { |
+ debug("This test requires window.internals."); |
+ description("This test ensures that when the main frame cannot be " + |
+ "scrolled, we ignore reasons for scrolling on the main " + |
+ "thread that only matter when the main frame scrolls"); |
+ } |
+} |
+ |
+function shouldNotIgnore() { |
+ document.body.style.height = "3000px"; |
+ document.body.offsetTop; |
+ |
+ if (window.internals) { |
+ var reasons = internals.mainThreadScrollingReasons(document); |
+ if (reasons === '') |
+ testFailed("Should have found main thread scrolling reasons, but didn't."); |
+ else |
+ testPassed("Found main thread scrolling reasons: " + reasons + "."); |
+ } else { |
+ debug("This test requires window.internals."); |
+ description("This test ensures that when the main frame cannot be " + |
+ "scrolled, we ignore reasons for scrolling on the main " + |
+ "thread that only matter when the main frame scrolls"); |
+ } |
+} |
+ |
+function runTests() { |
+ shouldIgnore(); |
+ shouldNotIgnore(); |
+ finishJSTest(); |
+} |
+ |
+window.onload = runTests; |
+</script> |
+</head> |
+<body> |
+ <div class="non-layer-viewport-constrained box" id="sibling"></div> |
+ <div class="container" id="parent"> |
+ <div class="box container-element"></div> |
+ <div class="box container-element"></div> |
+ <div class="box container-element"></div> |
+ <div class="box container-element"></div> |
+ <div class="box container-element"></div> |
+ </div> |
+</body> |
+</html> |