3 <script src=
"../resources/js-test.js"></script>
7 <p id=
"description"></p>
9 <div style=
"border: 1px solid #000; height: 5000px;">5000-pixel box
</div>
11 <!-- The contents of this iframe, more nicely formatted:
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>
24 <div style='border: 1px solid #000; height: 5000px;'>5000-pixel box</div>
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 id='container' style='height: 100px; overflow: scroll'><div style='border: 1px solid #000; height: 5000px;'>5000-pixel box</div><button id='target'>Target</button><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>
29 <div style=
"border: 1px solid #000; height: 5000px;">5000-pixel box
</div>
31 <div id=
"console"></div>
34 description("Tests that scrolling to move an element to a specific point successfully scrolls both an iframe and a div with overflow.");
36 if (window
.testRunner
)
37 testRunner
.waitUntilDone();
39 window
.jsTestIsAsync
= true;
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");
48 if (window
.accessibilityController
) {
50 var targetAccessibleObject
= accessibilityController
.focusedElement
;
53 // Reset the initial scroll position (since calling focus() can scroll the page 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");
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");
75 window
.addEventListener('load', function() {
76 setTimeout(runTest
, 10);