| <!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="../../fast/js/resources/js-test-pre.js"></script> |
| <script> |
| if (window.testRunner) { |
| // 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); |
| } |
| |
| // (Barely) modified version of shouldBeUndefined from js-test-pre.js. |
| function isUndefined(value) |
| { |
| var exception; |
| var _av; |
| try { |
| _av = eval(value); |
| } catch (e) { |
| exception = e; |
| } |
| |
| if (exception) |
| return false; |
| |
| if (typeof _av == "undefined") |
| return true; |
| |
| return false; |
| } |
| |
| function runTest() { |
| if (window.internals) { |
| var reasons = internals.mainThreadScrollingReasons(document); |
| if (isUndefined(reasons)) |
| testPassed("Main thread scrolling reasons were undefined."); |
| else |
| testFailed("Main thread scrolling reasons should have been undefined. " + |
| "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"); |
| } |
| } |
| |
| window.onload = runTest; |
| </script> |
| <script src="../../fast/js/resources/js-test-pre.js"></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> |