| 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 <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> | |
| 12 | |
| 13 <div style="border: 1px solid #000; height: 5000px;">5000-pixel box</div> | |
| 14 | |
| 15 <div id="console"></div> | |
| 16 | |
| 17 <script> | |
| 18 description("Tests that scrolling to move an element to a specific point success
fully scrolls an iframe."); | |
| 19 | |
| 20 if (window.testRunner) | |
| 21 testRunner.waitUntilDone(); | |
| 22 | |
| 23 window.jsTestIsAsync = true; | |
| 24 | |
| 25 function runTest() { | |
| 26 window.frame = document.getElementById("frame"); | |
| 27 window.frameWindow = frame.contentWindow; | |
| 28 window.frameDoc = frameWindow.document; | |
| 29 window.target = frameDoc.getElementById("target"); | |
| 30 | |
| 31 if (window.accessibilityController) { | |
| 32 target.focus(); | |
| 33 var targetAccessibleObject = accessibilityController.focusedElement; | |
| 34 } | |
| 35 | |
| 36 // Reset the initial scroll position (since calling focus() can scroll the p
age too). | |
| 37 window.scrollTo(0, 0); | |
| 38 frameWindow.scrollTo(0, 0); | |
| 39 shouldBe("window.pageYOffset", "0"); | |
| 40 shouldBe("frameWindow.pageYOffset", "0"); | |
| 41 | |
| 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"); | |
| 52 | |
| 53 finishJSTest(); | |
| 54 } | |
| 55 | |
| 56 window.addEventListener('load', function() { | |
| 57 setTimeout(runTest, 10); | |
| 58 }, false); | |
| 59 | |
| 60 </script> | |
| 61 | |
| 62 </body> | |
| 63 </html> | |
| OLD | NEW |