Refactoring: Pull all fullscreen code out of Document and into its own helper class
[WebKit-https.git] / LayoutTests / accessibility / scroll-to-global-point-nested.html
1 <!DOCTYPE html>
2 <head>
3 <script src="../resources/js-test.js"></script>
4 <style>
5 button {
6   border: 0;
7 }
8 </style>
9 </head>
10 <body>
11
12 <p id="description"></p>
13
14 <div style="border: 1px solid #000; height: 5000px;">5000-pixel box</div>
15
16 <div id="outer_container" style="height: 100px; overflow: scroll">
17   <div style="border: 1px solid #000; height: 5000px;">5000-pixel box</div>
18   <div id="inner_container" style="height: 100px; overflow: scroll">
19     <div style="border: 1px solid #000; height: 5000px;">5000-pixel box</div>
20     <button id="target">Target</button>
21     <div style="border: 1px solid #000; height: 5000px;">5000-pixel box</div>
22   </div>
23   <div style="border: 1px solid #000; height: 5000px;">5000-pixel box</div>
24 </div>
25
26 <div style="border: 1px solid #000; height: 5000px;">5000-pixel box</div>
27
28 <div id="console"></div>
29
30 <script>
31 description("Tests that scrolling an element to a specific point can successfully scroll multiple nested scrolling views'.");
32
33 function runTest() {
34     window.outerContainer = document.getElementById("outer_container");
35     window.innerContainer = document.getElementById("inner_container");
36     window.target = document.getElementById("target");
37
38     var targetAccessibleObject;
39     if (window.accessibilityController) {
40         target.focus();
41         targetAccessibleObject = accessibilityController.focusedElement;
42     }
43
44     // Reset the initial scroll positions (since calling focus() can scroll the page too).
45     window.scrollTo(0, 0);
46     outerContainer.scrollTop = 0;
47     innerContainer.scrollTop = 0;
48     shouldBeZero("window.pageYOffset");
49     shouldBeZero("outerContainer.scrollTop");
50     shouldBeZero("innerContainer.scrollTop");
51     shouldBeGreaterThanOrEqual("target.getBoundingClientRect().top", "15000");
52
53     // Scroll to various locations and check.
54
55     if (window.accessibilityController)
56         targetAccessibleObject.scrollToGlobalPoint(0, 0);
57     shouldBeZero("target.getBoundingClientRect().top");
58
59     if (window.accessibilityController)
60         targetAccessibleObject.scrollToGlobalPoint(0, 300);
61     shouldBe("target.getBoundingClientRect().top", "300");
62
63     if (window.accessibilityController)
64         targetAccessibleObject.scrollToGlobalPoint(0, 3000);
65     shouldBe("target.getBoundingClientRect().top", "3000");
66
67   finishJSTest();
68 }
69
70 runTest();
71
72 </script>
73
74 </body>
75 </html>