| OLD | NEW |
| 1 <html> | 1 <html> |
| 2 <script src="../../resources/js-test.js"></script> | 2 <script src="../../resources/js-test.js"></script> |
| 3 <script> | 3 <script> |
| 4 function getCenterFor(element) | 4 function getCenterFor(element) |
| 5 { | 5 { |
| 6 var rect = element.getBoundingClientRect(); | 6 var rect = element.getBoundingClientRect(); |
| 7 return { x : parseInt((rect.left + rect.right) / 2) , y : parseInt((rect.top +
rect.bottom) / 2)}; | 7 return { x : parseInt((rect.left + rect.right) / 2) , y : parseInt((rect.top +
rect.bottom) / 2)}; |
| 8 } | 8 } |
| 9 | 9 |
| 10 function runTest() | 10 function runTest() |
| 11 { | 11 { |
| 12 if (!window.testRunner) | 12 if (!window.testRunner) |
| 13 return; | 13 return; |
| 14 if (!window.eventSender) | 14 if (!window.eventSender) |
| 15 return; | 15 return; |
| 16 | 16 |
| 17 testRunner.waitUntilDone(); | 17 testRunner.waitUntilDone(); |
| 18 testRunner.dumpAsText(); | 18 testRunner.dumpAsText(); |
| 19 | 19 |
| 20 alert("Scroll position " + document.body.scrollTop); | 20 alert("Scroll position " + document.scrollingElement.scrollTop); |
| 21 center = getCenterFor(document.getElementById("sp")); | 21 center = getCenterFor(document.getElementById("sp")); |
| 22 eventSender.mouseMoveTo(center.x, center.y); | 22 eventSender.mouseMoveTo(center.x, center.y); |
| 23 eventSender.mouseDown(); | 23 eventSender.mouseDown(); |
| 24 eventSender.mouseUp(); | 24 eventSender.mouseUp(); |
| 25 eventSender.keyDown("downArrow"); | 25 eventSender.keyDown("downArrow"); |
| 26 setTimeout(verifyScrolling, 15); | 26 setTimeout(verifyScrolling, 15); |
| 27 } | 27 } |
| 28 | 28 |
| 29 function verifyScrolling() | 29 function verifyScrolling() |
| 30 { | 30 { |
| 31 debug("Scroll position is more than 0"); | 31 debug("Scroll position is more than 0"); |
| 32 shouldBe("document.body.scrollTop > 0", "true"); | 32 shouldBe("document.scrollingElement.scrollTop > 0", "true"); |
| 33 testRunner.notifyDone(); | 33 testRunner.notifyDone(); |
| 34 } | 34 } |
| 35 | 35 |
| 36 </script> | 36 </script> |
| 37 <style> | 37 <style> |
| 38 </style> | 38 </style> |
| 39 <body onload="runTest();"> | 39 <body onload="runTest();"> |
| 40 <input type="radio" id="myradio">Click the text below and then try to scroll.<br
> | 40 <input type="radio" id="myradio">Click the text below and then try to scroll.<br
> |
| 41 <div id="console"></div> | 41 <div id="console"></div> |
| 42 <br><br><br><br><br><br><br><br><br><br> | 42 <br><br><br><br><br><br><br><br><br><br> |
| 43 <span tabindex=1 id="sp">My span</span> | 43 <span tabindex=1 id="sp">My span</span> |
| 44 <br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>
<br><br><br><br><br><br> | 44 <br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>
<br><br><br><br><br><br> |
| 45 </body> | 45 </body> |
| 46 </html> | 46 </html> |
| 47 | 47 |
| OLD | NEW |