Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(111)

Side by Side Diff: LayoutTests/fast/events/wheelevent-in-scrolling-div.html

Issue 429803002: Revert of Remove WheelEvent.initWebKitWheelEvent() (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | LayoutTests/fast/events/wheelevent-in-scrolling-div-expected.txt » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 var expectedScrollTop = 200; 5 var expectedScrollTop = 200;
6 var expectedScrollLeft = 100; 6 var expectedScrollLeft = 100;
7 var event; 7 var event;
8 var div; 8 var div;
9 9
10 if (window.testRunner) 10 if (window.testRunner)
11 testRunner.waitUntilDone(); 11 testRunner.waitUntilDone();
12 12
13 function dispatchWheelEvent() 13 function dispatchWheelEvent()
14 { 14 {
15 var overflowElement = document.getElementById("overflow"); 15 var overflowElement = document.getElementById("overflow");
16 if (overflowElement) { 16 if (overflowElement) {
17 overflowElement.addEventListener("mousewheel", mousewheelHan dler, false); 17 overflowElement.addEventListener("mousewheel", mousewheelHan dler, false);
18 18
19 var deltaX = window.expectedScrollLeft; 19 var wheelEvent = document.createEvent("WheelEvent");
20 var deltaY = window.expectedScrollTop; 20 wheelEvent.initWebKitWheelEvent(-window.expectedScrollLeft, -window.expectedScrollTop, window, 0, 0, 0, 0, false, false, false, false);
21 var eventInit = { 21 overflowElement.dispatchEvent(wheelEvent);
22 deltaX: deltaX,
23 deltaY: deltaY,
24 wheelDeltaX: -120 * deltaX,
25 wheelDeltaY: -120 * deltaY,
26 };
27 var event = new WheelEvent("mousewheel", eventInit);
28 overflowElement.dispatchEvent(event);
29 } 22 }
30 23
31 setTimeout('checkOffsets();', 100); 24 setTimeout('checkOffsets();', 100);
32 } 25 }
33 26
34 function checkOffsets() 27 function checkOffsets()
35 { 28 {
36 div = document.getElementById("overflow"); 29 div = document.getElementById("overflow");
37 shouldBe("div.scrollTop", "window.expectedScrollTop"); 30 shouldBe("div.scrollTop", "window.expectedScrollTop");
38 shouldBe("div.scrollLeft", "window.expectedScrollLeft"); 31 shouldBe("div.scrollLeft", "window.expectedScrollLeft");
39 32
40 if (window.testRunner) 33 if (window.testRunner)
41 window.testRunner.notifyDone(); 34 window.testRunner.notifyDone();
42 } 35 }
43 36
44 function mousewheelHandler(e) 37 function mousewheelHandler(e)
45 { 38 {
46 event = e; 39 event = e;
47 shouldBe("event.deltaY", "window.expectedScrollTop");
48 shouldBe("event.deltaX", "window.expectedScrollLeft");
49 shouldBe("event.wheelDeltaY", "window.expectedScrollTop*-120"); 40 shouldBe("event.wheelDeltaY", "window.expectedScrollTop*-120");
50 shouldBe("event.wheelDeltaX", "window.expectedScrollLeft*-120"); 41 shouldBe("event.wheelDeltaX", "window.expectedScrollLeft*-120");
51 42
52 if (e.wheelDeltaY) 43 if (e.wheelDeltaY)
53 shouldBe("event.wheelDelta", "window.expectedScrollTop*-120" ); 44 shouldBe("event.wheelDelta", "window.expectedScrollTop*-120" );
54 else 45 else
55 shouldBe("event.wheelDelta", "window.expectedScrollLeft*-120 "); 46 shouldBe("event.wheelDelta", "window.expectedScrollLeft*-120 ");
56 } 47 }
57 </script> 48 </script>
58 </head> 49 </head>
59 50
60 <body style="margin:0" onload="setTimeout('dispatchWheelEvent();', 100)"> 51 <body style="margin:0" onload="setTimeout('dispatchWheelEvent();', 100)">
61 <div id="overflow" style="border:2px solid black;overflow:auto;height:20 0px;width:200px;"> 52 <div id="overflow" style="border:2px solid black;overflow:auto;height:20 0px;width:200px;">
62 <div style="background-color:red;height:200px;width:400px;"></div> 53 <div style="background-color:red;height:200px;width:400px;"></div>
63 <div style="background-color:green;height:200px;width:400px;"></div> 54 <div style="background-color:green;height:200px;width:400px;"></div>
64 <div style="background-color:red;height:200px;width:400px;"></div> 55 <div style="background-color:red;height:200px;width:400px;"></div>
65 </div> 56 </div>
66 <div id="console"></div> 57 <div id="console"></div>
67 </body> 58 </body>
68 </html> 59 </html>
OLDNEW
« no previous file with comments | « no previous file | LayoutTests/fast/events/wheelevent-in-scrolling-div-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698