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 <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><button id='target'>Target</button><div style='border: 1px solid #000; height: 5000px;'>5000-pixel box</div></body>"></iframe>
13 <div style=
"border: 1px solid #000; height: 5000px;">5000-pixel box
</div>
15 <div id=
"console"></div>
18 description("Tests that scrolling to move an element to a specific point successfully scrolls an iframe.");
20 if (window
.testRunner
)
21 testRunner
.waitUntilDone();
23 window
.jsTestIsAsync
= true;
26 window
.frame
= document
.getElementById("frame");
27 window
.frameWindow
= frame
.contentWindow
;
28 window
.frameDoc
= frameWindow
.document
;
29 window
.target
= frameDoc
.getElementById("target");
31 if (window
.accessibilityController
) {
33 var targetAccessibleObject
= accessibilityController
.focusedElement
;
36 // Reset the initial scroll position (since calling focus() can scroll the page too).
37 window
.scrollTo(0, 0);
38 frameWindow
.scrollTo(0, 0);
39 shouldBe("window.pageYOffset", "0");
40 shouldBe("frameWindow.pageYOffset", "0");
42 // Scroll to various locations and check.
43 if (window
.accessibilityController
)
44 targetAccessibleObject
.scrollToGlobalPoint(0, 0);
45 shouldBe("target.getBoundingClientRect().top", "0");
46 if (window
.accessibilityController
)
47 targetAccessibleObject
.scrollToGlobalPoint(0, 300);
48 shouldBe("target.getBoundingClientRect().top", "300");
49 if (window
.accessibilityController
)
50 targetAccessibleObject
.scrollToGlobalPoint(0, 3000);
51 shouldBe("target.getBoundingClientRect().top", "3000");
56 window
.addEventListener('load', function() {
57 setTimeout(runTest
, 10);