| <!DOCTYPE html> |
| <meta name="viewport" content="width=device-width, user-scalable=no" /> |
| <script src="../resources/testharness.js"></script> |
| <script src="../resources/testharnessreport.js"></script> |
| <script src="../resources/run-after-layout-and-paint.js"></script> |
| <script> |
| // Set the browser controls to be 100px and hidden. |
| // NOTE: It is important that this test be run with the Android viewport |
| // flags turned on. |
| if (window.internals) |
| internals.setBrowserControlsState(100, 0, false); |
| |
| var t = async_test("test"); |
| addEventListener("load", function() { |
| const iframe = document.getElementById("iframe"); |
| const scroller = iframe.contentDocument.getElementById("scroller"); |
| document.rootScroller = iframe; |
| iframe.contentDocument.rootScroller = scroller; |
| runAfterLayoutAndPaint(t.step_func_done(() => { |
| assert_equals( |
| internals.effectiveRootScroller(document), iframe, |
| "rootScroller in main document should be iframe."); |
| assert_equals( |
| internals.effectiveRootScroller(iframe.contentDocument), scroller, |
| "rootScroller in iframe should be scroller element."); |
| })); |
| }); |
| </script> |
| <style> |
| ::-webkit-scrollbar { |
| width: 0px; |
| height: 0px; |
| } |
| html, body { |
| height: 100%; |
| width: 100%; |
| margin: 0; |
| } |
| #iframe { |
| position: absolute; |
| width: 100%; |
| height: 100%; |
| border: 0; |
| } |
| </style> |
| |
| <iframe id="iframe" srcdoc=" |
| <style> |
| ::-webkit-scrollbar { |
| width: 0px; |
| height: 0px; |
| } |
| html,body { |
| height: 100%; |
| width: 100%; |
| margin:0; |
| background-color: blue; |
| } |
| #scroller { |
| position: absolute; |
| width: 100%; |
| height: 100%; |
| background-color: #808080; |
| overflow: auto; |
| } |
| </style> |
| <div id='scroller'> |
| <div style='height:2000px'></div> |
| </div> |
| "></iframe> |
| <script> |
| document.rootScroller = document.getElementById("iframe"); |
| </script> |