3 <link rel="stylesheet" href="../js/resources/js-test-style.css">
4 <script src="../js/resources/js-test-pre.js"></script>
6 var givenScrollTop = 2; // Only one page per event, so this should be interpreted as 1
7 var givenScrollLeft = 2;
8 var expectedScrollTop = 511; // Window is 800x600. 15 pixel scrollbars. Scroll 87.5% of visible.
9 var expectedScrollLeft = 686;
13 if (window.layoutTestController)
14 layoutTestController.waitUntilDone();
16 function dispatchWheelEvent()
18 document.body.addEventListener("mousewheel", mousewheelHandler, false);
20 if (window.eventSender) {
21 eventSender.mouseMoveTo(100, 110);
22 eventSender.continuousMouseScrollBy(-window.givenScrollLeft, -window.givenScrollTop, true);
25 setTimeout('checkOffsets();', 100);
28 function checkOffsets()
30 shouldBe("document.body.scrollTop", "window.expectedScrollTop");
31 shouldBe("document.body.scrollLeft", "window.expectedScrollLeft");
33 if (window.layoutTestController)
34 window.layoutTestController.notifyDone();
37 function mousewheelHandler(e)
40 shouldBe("event.wheelDeltaY", "window.givenScrollTop * -3");
41 shouldBe("event.wheelDeltaX", "window.givenScrollLeft * -3");
44 shouldBe("event.wheelDelta", "window.givenScrollTop * -3");
46 shouldBe("event.wheelDelta", "window.givenScrollLeft * -3");
51 <body style="margin:0" onload="setTimeout('dispatchWheelEvent();', 100)">
52 <div style="height:900px;width:2400px">
53 <div style="background-color:red;height:900px;width:1200px;position:relative;left:0px;top:0px"></div>
54 <div style="background-color:green;height:900px;width:1200px;position:relative;left:1200px;top:-900px"></div>
56 <div style="height:900px;width:2400px">
57 <div style="background-color:blue;height:900px;width:1200px;position:relative;left:0px;top:0px"></div>
58 <div style="background-color:yellow;height:900px;width:1200px;position:relative;left:1200px;top:-900px"></div>
60 <div id="console"></div>