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