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