Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / accessibility / scroll-to-make-visible-nested.html
blob661bfccbca33c06c27e71a39aa59c2d3511dec7a
1 <html>
2 <head>
3 <script src="../resources/js-test.js"></script>
4 </head>
5 <body>
7 <p id="description"></p>
9 <div style="border: 1px solid #000; height: 5000px;">5000-pixel box</div>
11 <div id="outer_container" style="height: 100px; overflow: scroll">
12 <div style="border: 1px solid #000; height: 5000px;">5000-pixel box</div>
13 <div id="inner_container" style="height: 100px; overflow: scroll">
14 <div style="border: 1px solid #000; height: 5000px;">5000-pixel box</div>
15 <button id="target">Target</button>
16 </div>
17 </div>
19 <div id="console"></div>
21 <script>
22 description("Tests that scrolling to make an element visible successfully scrolls multiple nested scrolling views'.");
24 function runTest() {
25 window.outerContainer = document.getElementById("outer_container");
26 window.innerContainer = document.getElementById("inner_container");
27 window.target = document.getElementById("target");
29 if (window.accessibilityController) {
30 target.focus();
31 var targetAccessibleObject = accessibilityController.focusedElement;
34 // Reset the initial scroll positions (since calling focus() can scroll the page too).
35 window.scrollTo(0, 0);
36 outerContainer.scrollTop = 0;
37 innerContainer.scrollTop = 0;
38 shouldBe("window.pageYOffset", "0");
39 shouldBe("outerContainer.scrollTop", "0");
40 shouldBe("innerContainer.scrollTop", "0");
41 shouldBeGreaterThanOrEqual("target.getBoundingClientRect().top", "15000");
43 // Scroll to make target visible.
44 if (window.accessibilityController)
45 targetAccessibleObject.scrollToMakeVisible();
47 // Instead of testing the exact scroll offsets of the two containers, just test that
48 // the new absolute position of the target is on-screen.
49 shouldBeGreaterThanOrEqual("window.innerHeight", "target.getBoundingClientRect().bottom");
51 finishJSTest();
54 runTest();
56 </script>
58 </body>
59 </html>