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