| OLD | NEW |
| (Empty) |
| 1 <html> | |
| 2 <head> | |
| 3 <link rel="stylesheet" href="../../../fast/js/resources/js-test-style.css"> | |
| 4 <script src="../../../fast/js/resources/js-test-pre.js"></script> | |
| 5 </head> | |
| 6 <body> | |
| 7 | |
| 8 <p id="description"></p> | |
| 9 | |
| 10 <div style="border: 1px solid #000; height: 5000px;">5000-pixel box</div> | |
| 11 | |
| 12 <div id="outer_container" style="height: 100px; overflow: scroll"> | |
| 13 <div style="border: 1px solid #000; height: 5000px;">5000-pixel box</div> | |
| 14 <div id="inner_container" style="height: 100px; overflow: scroll"> | |
| 15 <div style="border: 1px solid #000; height: 5000px;">5000-pixel box</div> | |
| 16 <button id="target">Target</button> | |
| 17 </div> | |
| 18 </div> | |
| 19 | |
| 20 <div id="console"></div> | |
| 21 | |
| 22 <script> | |
| 23 description("Tests that scrolling to make an element visible successfully scroll
s multiple nested scrolling views'."); | |
| 24 | |
| 25 function runTest() { | |
| 26 window.outerContainer = document.getElementById("outer_container"); | |
| 27 window.innerContainer = document.getElementById("inner_container"); | |
| 28 window.target = document.getElementById("target"); | |
| 29 | |
| 30 if (window.accessibilityController) { | |
| 31 target.focus(); | |
| 32 var targetAccessibleObject = accessibilityController.focusedElement; | |
| 33 } | |
| 34 | |
| 35 // Reset the initial scroll positions (since calling focus() can scroll the
page too). | |
| 36 window.scrollTo(0, 0); | |
| 37 outerContainer.scrollTop = 0; | |
| 38 innerContainer.scrollTop = 0; | |
| 39 shouldBe("window.pageYOffset", "0"); | |
| 40 shouldBe("outerContainer.scrollTop", "0"); | |
| 41 shouldBe("innerContainer.scrollTop", "0"); | |
| 42 shouldBeGreaterThanOrEqual("target.getBoundingClientRect().top", "15000"); | |
| 43 | |
| 44 // Scroll to make target visible. | |
| 45 if (window.accessibilityController) | |
| 46 targetAccessibleObject.scrollToMakeVisible(); | |
| 47 | |
| 48 // Instead of testing the exact scroll offsets of the two containers, just t
est that | |
| 49 // the new absolute position of the target is on-screen. | |
| 50 shouldBeGreaterThanOrEqual("window.innerHeight", "target.getBoundingClientRe
ct().bottom"); | |
| 51 | |
| 52 finishJSTest(); | |
| 53 } | |
| 54 | |
| 55 runTest(); | |
| 56 | |
| 57 </script> | |
| 58 | |
| 59 <script src="../../../fast/js/resources/js-test-post.js"></script> | |
| 60 </body> | |
| 61 </html> | |
| OLD | NEW |