| 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 <iframe id="frame" src="data:text/html,<body><button id='upper_target'>Upper Tar
get</button><div style='border: 1px solid #000; height: 5000px;'>5000-pixel box<
/div><button id='lower_target'>Lower Target</button></body>"></iframe> | |
| 11 | |
| 12 <div id="console"></div> | |
| 13 | |
| 14 <script> | |
| 15 description("Tests that scrolling to make an element visible successfully scroll
s an iframe."); | |
| 16 | |
| 17 if (window.testRunner) | |
| 18 testRunner.waitUntilDone(); | |
| 19 | |
| 20 window.jsTestIsAsync = true; | |
| 21 | |
| 22 function runTest() { | |
| 23 window.frame = document.getElementById("frame"); | |
| 24 window.frameWindow = frame.contentWindow; | |
| 25 window.frameDoc = frameWindow.document; | |
| 26 | |
| 27 var upperTarget = frameDoc.getElementById("upper_target"); | |
| 28 var lowerTarget = frameDoc.getElementById("lower_target"); | |
| 29 | |
| 30 if (window.accessibilityController) { | |
| 31 lowerTarget.focus(); | |
| 32 var lowerTargetAccessibleObject = accessibilityController.focusedElement
; | |
| 33 upperTarget.focus(); | |
| 34 var upperTargetAccessibleObject = accessibilityController.focusedElement
; | |
| 35 } | |
| 36 | |
| 37 // Reset the initial scroll position (since calling focus() can scroll the p
age too). | |
| 38 frameWindow.scrollTo(0, 0); | |
| 39 shouldBe("frameWindow.pageYOffset", "0"); | |
| 40 | |
| 41 // Scroll to make lower target visible and check. | |
| 42 if (window.accessibilityController) | |
| 43 lowerTargetAccessibleObject.scrollToMakeVisible(); | |
| 44 window.minYOffset = lowerTarget.offsetTop + lowerTarget.offsetHeight - frame
Window.innerHeight; | |
| 45 window.maxYOffset = lowerTarget.offsetTop; | |
| 46 shouldBe("frameWindow.pageYOffset >= minYOffset", "true"); | |
| 47 shouldBe("frameWindow.pageYOffset <= maxYOffset", "true"); | |
| 48 | |
| 49 // Scroll to make upper target visible and check. | |
| 50 if (window.accessibilityController) | |
| 51 upperTargetAccessibleObject.scrollToMakeVisible(); | |
| 52 window.minYOffset = upperTarget.offsetTop + upperTarget.offsetHeight - frame
Window.innerHeight; | |
| 53 window.maxYOffset = upperTarget.offsetTop; | |
| 54 shouldBe("frameWindow.pageYOffset >= minYOffset", "true"); | |
| 55 shouldBe("frameWindow.pageYOffset <= maxYOffset", "true"); | |
| 56 | |
| 57 finishJSTest(); | |
| 58 } | |
| 59 | |
| 60 window.addEventListener('load', function() { | |
| 61 setTimeout(runTest, 10); | |
| 62 }, false); | |
| 63 | |
| 64 </script> | |
| 65 | |
| 66 <script src="../../../fast/js/resources/js-test-post.js"></script> | |
| 67 </body> | |
| 68 </html> | |
| OLD | NEW |