| OLD | NEW |
| 1 <html> | 1 <html> |
| 2 <head> | 2 <head> |
| 3 <script src="../resources/js-test.js"></script> | 3 <script src="../resources/js-test.js"></script> |
| 4 </head> | 4 </head> |
| 5 <body> | 5 <body> |
| 6 | 6 |
| 7 <p id="description"></p> | 7 <p id="description"></p> |
| 8 | 8 |
| 9 <div id="container" style="height: 100px; overflow: scroll"> | 9 <div id="container" style="height: 100px; overflow: scroll"> |
| 10 <button id="upper_target">Upper Target</button> | 10 <button id="upper_target">Upper Target</button> |
| (...skipping 24 matching lines...) Expand all Loading... |
| 35 | 35 |
| 36 // Scroll to make lower target visible and check. | 36 // Scroll to make lower target visible and check. |
| 37 if (window.accessibilityController) | 37 if (window.accessibilityController) |
| 38 lowerTargetAccessibleObject.scrollToMakeVisible(); | 38 lowerTargetAccessibleObject.scrollToMakeVisible(); |
| 39 var top = lowerTarget.offsetTop - container.offsetTop; | 39 var top = lowerTarget.offsetTop - container.offsetTop; |
| 40 window.minYOffset = top + lowerTarget.offsetHeight - container.offsetHeight; | 40 window.minYOffset = top + lowerTarget.offsetHeight - container.offsetHeight; |
| 41 window.maxYOffset = top; | 41 window.maxYOffset = top; |
| 42 shouldBe("container.scrollTop >= minYOffset", "true"); | 42 shouldBe("container.scrollTop >= minYOffset", "true"); |
| 43 shouldBe("container.scrollTop <= maxYOffset", "true"); | 43 shouldBe("container.scrollTop <= maxYOffset", "true"); |
| 44 | 44 |
| 45 // Do it again. It shouldn't scroll. |
| 46 if (window.accessibilityController) |
| 47 lowerTargetAccessibleObject.scrollToMakeVisible(); |
| 48 var top = lowerTarget.offsetTop - container.offsetTop; |
| 49 window.minYOffset = top + lowerTarget.offsetHeight - container.offsetHeight; |
| 50 window.maxYOffset = top; |
| 51 shouldBe("container.scrollTop >= minYOffset", "true"); |
| 52 shouldBe("container.scrollTop <= maxYOffset", "true"); |
| 53 |
| 45 // Scroll to make upper target visible and check. | 54 // Scroll to make upper target visible and check. |
| 46 if (window.accessibilityController) | 55 if (window.accessibilityController) |
| 47 upperTargetAccessibleObject.scrollToMakeVisible(); | 56 upperTargetAccessibleObject.scrollToMakeVisible(); |
| 48 top = upperTarget.offsetTop - container.offsetTop; | 57 top = upperTarget.offsetTop - container.offsetTop; |
| 49 window.minYOffset = top + upperTarget.offsetHeight - container.offsetHeight; | 58 window.minYOffset = top + upperTarget.offsetHeight - container.offsetHeight; |
| 50 window.maxYOffset = top; | 59 window.maxYOffset = top; |
| 51 shouldBe("container.scrollTop >= minYOffset", "true"); | 60 shouldBe("container.scrollTop >= minYOffset", "true"); |
| 52 shouldBe("container.scrollTop <= maxYOffset", "true"); | 61 shouldBe("container.scrollTop <= maxYOffset", "true"); |
| 53 | 62 |
| 54 finishJSTest(); | 63 finishJSTest(); |
| 55 } | 64 } |
| 56 | 65 |
| 57 runTest(); | 66 runTest(); |
| 58 | 67 |
| 59 </script> | 68 </script> |
| 60 | 69 |
| 61 </body> | 70 </body> |
| 62 </html> | 71 </html> |
| OLD | NEW |