| 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 <script> | 4 <script> |
| 5 var givenScrollTop = 0; | 5 var givenScrollTop = 0; |
| 6 var givenScrollLeft = 2; // When paging, this is ignored. Every even
t is one page. | 6 var givenScrollLeft = 2; // When paging, this is ignored. Every even
t is one page. |
| 7 var expectedScrollTop = 0; | 7 var expectedScrollTop = 0; |
| 8 var expectedScrollLeft = 700; // Window is 800x600. Scroll 87.5% of
visible. | 8 var expectedScrollLeft = 700; // Window is 800x600. Scroll 87.5% of
visible. |
| 9 var event; | 9 var event; |
| 10 var div; | 10 var div; |
| 11 | 11 |
| 12 window.jsTestIsAsync = true; | 12 window.jsTestIsAsync = true; |
| 13 if (window.testRunner) | 13 if (window.testRunner) |
| 14 testRunner.waitUntilDone(); | 14 testRunner.waitUntilDone(); |
| 15 | 15 |
| 16 function dispatchWheelEvent() | 16 function dispatchWheelEvent() |
| 17 { | 17 { |
| 18 document.body.addEventListener("mousewheel", mousewheelHandler,
false); | 18 document.body.addEventListener("mousewheel", mousewheelHandler,
false); |
| 19 | 19 |
| 20 if (window.eventSender) { | 20 if (window.eventSender) { |
| 21 eventSender.mouseMoveTo(100, 110); | 21 eventSender.mouseMoveTo(100, 110); |
| 22 eventSender.continuousMouseScrollBy(-window.givenScrollLeft,
-window.givenScrollTop, true); | 22 eventSender.continuousMouseScrollBy(-window.givenScrollLeft,
-window.givenScrollTop, true); |
| 23 } | 23 } |
| 24 | 24 |
| 25 setTimeout('checkOffsets();', 100); | 25 setTimeout('checkOffsets();', 100); |
| 26 } | 26 } |
| 27 | 27 |
| 28 function checkOffsets() | 28 function checkOffsets() |
| 29 { | 29 { |
| 30 shouldBe("document.body.scrollTop", "window.expectedScrollTop"); | 30 shouldBe("document.scrollingElement.scrollTop", "window.expected
ScrollTop"); |
| 31 shouldBe("document.body.scrollLeft", "window.expectedScrollLeft"
); | 31 shouldBe("document.scrollingElement.scrollLeft", "window.expecte
dScrollLeft"); |
| 32 finishJSTest(); | 32 finishJSTest(); |
| 33 } | 33 } |
| 34 | 34 |
| 35 function mousewheelHandler(e) | 35 function mousewheelHandler(e) |
| 36 { | 36 { |
| 37 event = e; | 37 event = e; |
| 38 shouldBe("event.wheelDeltaY", "0"); | 38 shouldBe("event.wheelDeltaY", "0"); |
| 39 shouldBe("event.wheelDeltaX", "window.givenScrollLeft * -3"); | 39 shouldBe("event.wheelDeltaX", "window.givenScrollLeft * -3"); |
| 40 | 40 |
| 41 if (e.wheelDeltaY) | 41 if (e.wheelDeltaY) |
| 42 shouldBe("event.wheelDelta", "0"); | 42 shouldBe("event.wheelDelta", "0"); |
| 43 else | 43 else |
| 44 shouldBe("event.wheelDelta", "window.givenScrollLeft * -3"); | 44 shouldBe("event.wheelDelta", "window.givenScrollLeft * -3"); |
| 45 } | 45 } |
| 46 </script> | 46 </script> |
| 47 </head> | 47 </head> |
| 48 | 48 |
| 49 <body style="margin:0;padding:0" onload="setTimeout('dispatchWheelEvent();',
100)"> | 49 <body style="margin:0;padding:0" onload="setTimeout('dispatchWheelEvent();',
100)"> |
| 50 <div style="margin:0;padding:0;height:200px;width:2400px"> | 50 <div style="margin:0;padding:0;height:200px;width:2400px"> |
| 51 <div style="margin:0;padding:0;background-color:red;height:200px;width
:1200px;position:relative;left:0px;top:0px"></div> | 51 <div style="margin:0;padding:0;background-color:red;height:200px;width
:1200px;position:relative;left:0px;top:0px"></div> |
| 52 <div style="margin:0;padding:0;background-color:green;height:200px;wid
th:1200px;position:relative;left:1200px;top:-200px"></div> | 52 <div style="margin:0;padding:0;background-color:green;height:200px;wid
th:1200px;position:relative;left:1200px;top:-200px"></div> |
| 53 </div> | 53 </div> |
| 54 <div style="margin:0;padding:0;height:200px;width:2400px"> | 54 <div style="margin:0;padding:0;height:200px;width:2400px"> |
| 55 <div style="margin:0;padding:0;background-color:blue;height:200px;widt
h:1200px;position:relative;left:0px;top:0px"></div> | 55 <div style="margin:0;padding:0;background-color:blue;height:200px;widt
h:1200px;position:relative;left:0px;top:0px"></div> |
| 56 <div style="margin:0;padding:0;background-color:yellow;height:200px;wi
dth:1200px;position:relative;left:1200px;top:-200px"></div> | 56 <div style="margin:0;padding:0;background-color:yellow;height:200px;wi
dth:1200px;position:relative;left:1200px;top:-200px"></div> |
| 57 </div> | 57 </div> |
| 58 <div id="console"></div> | 58 <div id="console"></div> |
| 59 </body> | 59 </body> |
| 60 </html> | 60 </html> |
| OLD | NEW |