Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / accessibility / scroll-to-make-visible-with-subfocus.html
blob418fd7dc58d464615453769cc6848c41f6de0a2b
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>
10 <button id="target" style="height: 5000px;">Target</button>
12 <div id="console"></div>
14 <script>
15 description("Tests that scrolling to make a certain region within an element visible successfully scrolls the main window.");
17 function runTest() {
18 var target = document.getElementById("target");
20 if (window.accessibilityController) {
21 target.focus();
22 var targetAccessibleObject = accessibilityController.focusedElement;
25 // Reset the initial scroll position (since calling focus() can scroll the page too).
26 window.scrollTo(0, 0);
27 shouldBe("window.pageYOffset", "0");
29 // Scroll to make the midpoint of the target visible and check.
30 if (window.accessibilityController)
31 targetAccessibleObject.scrollToMakeVisibleWithSubFocus(0, 2500, 100, 2600);
32 window.minYOffset = target.offsetTop + 2500 - window.innerHeight;
33 window.maxYOffset = target.offsetTop + 2500;
34 shouldBe("window.pageYOffset >= minYOffset", "true");
35 shouldBe("window.pageYOffset <= maxYOffset", "true");
37 finishJSTest();
40 runTest();
42 </script>
44 </body>
45 </html>