Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / events / continuous-platform-wheelevent-in-scrolling-div.html
blob809c51e1a12edcf40a34c6511370ca49c2f165f4
1 <html>
2 <head>
3 <script src="../../resources/js-test.js"></script>
4 <script>
5 var expectedScrollTop = 200;
6 var expectedScrollLeft = 100;
7 var event;
8 var div;
10 if (window.testRunner) {
11 testRunner.waitUntilDone();
14 function dispatchWheelEvent()
16 var overflowElement = document.getElementById("overflow");
17 if (overflowElement)
18 overflowElement.addEventListener("mousewheel", mousewheelHandler, false);
20 if (window.eventSender) {
21 eventSender.mouseMoveTo(100, 110);
22 eventSender.continuousMouseScrollBy(-window.expectedScrollLeft, -window.expectedScrollTop);
25 setTimeout('checkOffsets();', 100);
28 function checkOffsets()
30 div = document.getElementById("overflow");
31 shouldBe("div.scrollTop", "window.expectedScrollTop");
32 shouldBe("div.scrollLeft", "window.expectedScrollLeft");
34 if (window.testRunner)
35 window.testRunner.notifyDone();
38 function mousewheelHandler(e)
40 event = e;
41 shouldBe("event.wheelDeltaY", "window.expectedScrollTop*-3");
42 shouldBe("event.wheelDeltaX", "window.expectedScrollLeft*-3");
44 if (e.wheelDeltaY)
45 shouldBe("event.wheelDelta", "window.expectedScrollTop*-3");
46 else
47 shouldBe("event.wheelDelta", "window.expectedScrollLeft*-3");
49 </script>
50 </head>
52 <body style="margin:0" onload="setTimeout('dispatchWheelEvent();', 100)">
53 <div id="overflow" style="border:2px solid black;overflow:auto;height:200px;width:200px;">
54 <div style="background-color:red;height:200px;width:400px;"></div>
55 <div style="background-color:green;height:200px;width:400px;"></div>
56 <div style="background-color:red;height:200px;width:400px;"></div>
57 </div>
58 <div id="console"></div>
59 </body>
60 </html>