| OLD | NEW |
| (Empty) |
| 1 <html> | |
| 2 <head> | |
| 3 <link rel="stylesheet" href="../../../fast/js/resources/js-test-style.css"> | |
| 4 <script src="../../../fast/js/resources/js-test-pre.js"></script> | |
| 5 </head> | |
| 6 <body> | |
| 7 | |
| 8 <p id="description"></p> | |
| 9 | |
| 10 <div style="border: 1px solid #000; height: 5000px;">5000-pixel box</div> | |
| 11 | |
| 12 <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><butto
n id='target'>Target</button><div style='border: 1px solid #000; height: 5000px;
'>5000-pixel box</div></body>"></iframe> | |
| 13 | |
| 14 <div style="border: 1px solid #000; height: 5000px;">5000-pixel box</div> | |
| 15 | |
| 16 <div id="console"></div> | |
| 17 | |
| 18 <script> | |
| 19 description("Tests that scrolling to move an element to a specific point success
fully scrolls an iframe."); | |
| 20 | |
| 21 if (window.testRunner) | |
| 22 testRunner.waitUntilDone(); | |
| 23 | |
| 24 window.jsTestIsAsync = true; | |
| 25 | |
| 26 function runTest() { | |
| 27 window.frame = document.getElementById("frame"); | |
| 28 window.frameWindow = frame.contentWindow; | |
| 29 window.frameDoc = frameWindow.document; | |
| 30 window.target = frameDoc.getElementById("target"); | |
| 31 | |
| 32 if (window.accessibilityController) { | |
| 33 target.focus(); | |
| 34 var targetAccessibleObject = accessibilityController.focusedElement; | |
| 35 } | |
| 36 | |
| 37 // Reset the initial scroll position (since calling focus() can scroll the p
age too). | |
| 38 window.scrollTo(0, 0); | |
| 39 frameWindow.scrollTo(0, 0); | |
| 40 shouldBe("window.pageYOffset", "0"); | |
| 41 shouldBe("frameWindow.pageYOffset", "0"); | |
| 42 | |
| 43 // Scroll to various locations and check. | |
| 44 if (window.accessibilityController) | |
| 45 targetAccessibleObject.scrollToGlobalPoint(0, 0); | |
| 46 shouldBe("target.getBoundingClientRect().top", "0"); | |
| 47 if (window.accessibilityController) | |
| 48 targetAccessibleObject.scrollToGlobalPoint(0, 300); | |
| 49 shouldBe("target.getBoundingClientRect().top", "300"); | |
| 50 if (window.accessibilityController) | |
| 51 targetAccessibleObject.scrollToGlobalPoint(0, 3000); | |
| 52 shouldBe("target.getBoundingClientRect().top", "3000"); | |
| 53 | |
| 54 finishJSTest(); | |
| 55 } | |
| 56 | |
| 57 window.addEventListener('load', function() { | |
| 58 setTimeout(runTest, 10); | |
| 59 }, false); | |
| 60 | |
| 61 </script> | |
| 62 | |
| 63 <script src="../../../fast/js/resources/js-test-post.js"></script> | |
| 64 </body> | |
| 65 </html> | |
| OLD | NEW |