Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / accessibility / scroll-to-global-point-main-window.html
blob2c8af05a5bbea96c25487e7d81be1d96af1ee114
1 <html>
2 <head>
3 <script src="../resources/js-test.js"></script>
4 <style>
5 button {
6 border: 0;
8 </style>
9 </head>
10 <body>
12 <p id="description"></p>
14 <div style="border: 1px solid #000; height: 5000px;">5000-pixel box</div>
15 <button id="target">Target</button>
16 <div style="border: 1px solid #000; height: 5000px;">5000-pixel box</div>
18 <div id="console"></div>
20 <script>
21 description("Tests that scrolling an element to a specific point successfully scrolls the main window.");
23 function runTest() {
24 var target = document.getElementById("target");
26 if (window.accessibilityController) {
27 target.focus();
28 var targetAccessibleObject = accessibilityController.focusedElement;
31 // Reset the initial scroll position (since calling focus() can scroll the page too).
32 window.scrollTo(0, 0);
33 shouldBe("window.pageYOffset", "0");
35 // Scroll to various locations and check.
36 if (window.accessibilityController)
37 targetAccessibleObject.scrollToGlobalPoint(0, 0);
38 shouldBe("target.getBoundingClientRect().top", "0");
39 if (window.accessibilityController)
40 targetAccessibleObject.scrollToGlobalPoint(0, 300);
41 shouldBe("target.getBoundingClientRect().top", "300");
42 if (window.accessibilityController)
43 targetAccessibleObject.scrollToGlobalPoint(0, 3000);
44 shouldBe("target.getBoundingClientRect().top", "3000");
46 finishJSTest();
49 runTest();
51 </script>
53 </body>
54 </html>