3 <script src=
"../../resources/js-test.js"></script>
5 var expectedScrollTop
= 200;
6 var expectedScrollLeft
= 100;
10 if (window
.testRunner
)
11 testRunner
.waitUntilDone();
13 function dispatchWheelEvent()
15 var overflowElement
= document
.getElementById("overflow");
16 if (overflowElement
) {
17 overflowElement
.addEventListener("mousewheel", mousewheelHandler
, false);
19 // EventSender uses 40px per tick.
20 eventSender
.mouseMoveTo(overflowElement
.offsetLeft
+ 5, overflowElement
.offsetTop
+ 5);
21 eventSender
.mouseScrollBy(-2.5, -5);
24 setTimeout('checkOffsets();', 100);
27 function checkOffsets()
29 div
= document
.getElementById("overflow");
30 shouldBe("div.scrollTop", "window.expectedScrollTop");
31 shouldBe("div.scrollLeft", "window.expectedScrollLeft");
33 if (window
.testRunner
)
34 window
.testRunner
.notifyDone();
37 function mousewheelHandler(e
)
40 shouldBe("event.deltaY", "window.expectedScrollTop");
41 shouldBe("event.deltaX", "window.expectedScrollLeft");
42 shouldBe("event.wheelDeltaY", "-5*120");
43 shouldBe("event.wheelDeltaX", "-2.5*120");
46 shouldBe("event.wheelDelta", "-5*120");
48 shouldBe("event.wheelDelta", "-2.5*120");
53 <body style=
"margin:0" onload=
"setTimeout('dispatchWheelEvent();', 100)">
54 <div id=
"overflow" style=
"border:2px solid black;overflow:auto;height:200px;width:200px;">
55 <div style=
"background-color:red;height:200px;width:400px;"></div>
56 <div style=
"background-color:green;height:200px;width:400px;"></div>
57 <div style=
"background-color:red;height:200px;width:400px;"></div>
59 <div id=
"console"></div>