OLD | NEW |
| (Empty) |
1 <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 <!-- The contents of this iframe, more nicely formatted: | |
12 <body> | |
13 <style> | |
14 button { | |
15 border: 0; | |
16 } | |
17 </style> | |
18 <div style='border: 1px solid #000; height: 5000px;'>5000-pixel box</div> | |
19 <div id='container' style='height: 100px; overflow: scroll'> | |
20 <div style='border: 1px solid #000; height: 5000px;'>5000-pixel box</div> | |
21 <button id='target'>Target</button> | |
22 <div style='border: 1px solid #000; height: 5000px;'>5000-pixel box</div> | |
23 </div> | |
24 <div style='border: 1px solid #000; height: 5000px;'>5000-pixel box</div> | |
25 </body> | |
26 --> | |
27 <iframe id="frame" src="data:text/html,<body><style>button { border: 0; }</style
><div style='border: 1px solid #000; height: 5000px;'>5000-pixel box</div><div i
d='container' style='height: 100px; overflow: scroll'><div style='border: 1px so
lid #000; height: 5000px;'>5000-pixel box</div><button id='target'>Target</butto
n><div style='border: 1px solid #000; height: 5000px;'>5000-pixel box</div></div
><div style='border: 1px solid #000; height: 5000px;'>5000-pixel box</div></body
>"></iframe> | |
28 | |
29 <div style="border: 1px solid #000; height: 5000px;">5000-pixel box</div> | |
30 | |
31 <div id="console"></div> | |
32 | |
33 <script> | |
34 description("Tests that scrolling to move an element to a specific point success
fully scrolls both an iframe and a div with overflow."); | |
35 | |
36 if (window.testRunner) | |
37 testRunner.waitUntilDone(); | |
38 | |
39 window.jsTestIsAsync = true; | |
40 | |
41 function runTest() { | |
42 window.frame = document.getElementById("frame"); | |
43 window.frameWindow = frame.contentWindow; | |
44 window.frameDoc = frameWindow.document; | |
45 window.container = frameDoc.getElementById("container"); | |
46 window.target = frameDoc.getElementById("target"); | |
47 | |
48 if (window.accessibilityController) { | |
49 target.focus(); | |
50 var targetAccessibleObject = accessibilityController.focusedElement; | |
51 } | |
52 | |
53 // Reset the initial scroll position (since calling focus() can scroll the p
age too). | |
54 window.scrollTo(0, 0); | |
55 frameWindow.scrollTo(0, 0); | |
56 container.scrollTop = 0; | |
57 shouldBe("window.pageYOffset", "0"); | |
58 shouldBe("frameWindow.pageYOffset", "0"); | |
59 shouldBe("container.scrollTop", "0"); | |
60 | |
61 // Scroll to various locations and check. | |
62 if (window.accessibilityController) | |
63 targetAccessibleObject.scrollToGlobalPoint(0, 0); | |
64 shouldBe("target.getBoundingClientRect().top", "0"); | |
65 if (window.accessibilityController) | |
66 targetAccessibleObject.scrollToGlobalPoint(0, 300); | |
67 shouldBe("target.getBoundingClientRect().top", "300"); | |
68 if (window.accessibilityController) | |
69 targetAccessibleObject.scrollToGlobalPoint(0, 3000); | |
70 shouldBe("target.getBoundingClientRect().top", "3000"); | |
71 | |
72 finishJSTest(); | |
73 } | |
74 | |
75 window.addEventListener('load', function() { | |
76 setTimeout(runTest, 10); | |
77 }, false); | |
78 | |
79 </script> | |
80 | |
81 </body> | |
82 </html> | |
OLD | NEW |