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