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

Side by Side Diff: LayoutTests/fast/events/wheelevent-ctrl.html

Issue 183403002: Disable scrolling on mousewheel events with ctrl modifier set (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 9 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-ctrl-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
(Empty)
1 <!DOCTYPE html>
2 <html>
3 <head>
4 <link rel="help" href="http://www.w3.org/TR/DOM-Level-3-Events/#events-WheelEven t">
5 <script src="../../resources/js-test.js"></script>
6 <script>
7 var deltaY = 0;
8 var scrollAmount = -2;
9 var expectedDeltaY = scrollAmount * -40;
10
11 var testDiv;
12 function runTest() {
13
14 testDiv = document.getElementById('target');
15 testDiv.addEventListener('wheel', wheelHandler);
16 if (!window.eventSender) {
17 debug("FAIL: This test requires window.eventSender.");
18 return;
19 }
20
21 // Verify that wheel with ctrl modifier is fired property but doesn't scroll .
22 eventSender.mouseMoveTo(testDiv.offsetLeft + 5, testDiv.offsetTop + 5);
23 eventSender.mouseScrollBy(0, scrollAmount, false, true, "ctrlKey");
24 shouldBe("wheelEventCount", "1");
25 shouldEvaluateTo("deltaY", expectedDeltaY);
26 shouldBeTrue("ctrlKey");
27 shouldBe("testDiv.scrollTop", "0");
28
29 // Verify that without the ctrl modifier we scroll as normal.
30 eventSender.mouseMoveTo(testDiv.offsetLeft + 5, testDiv.offsetTop + 5);
31 eventSender.mouseScrollBy(0, scrollAmount, false, true);
32 shouldBe("wheelEventCount", "2");
33 shouldEvaluateTo("deltaY", expectedDeltaY);
34 shouldBeFalse("ctrlKey");
35 shouldBe("testDiv.scrollTop", "deltaY");
36 }
37
38 var wheelEventCount = 0;
39 var ctrlKey = false;
40 function wheelHandler(e) {
41 wheelEventCount++;
42 deltaY = e.deltaY;
43 ctrlKey = e.ctrlKey;
44 }
45
46 </script>
47 </head>
48 <body>
49 <span id="parent">
50 <div id="target" style="border:solid 1px green; width:220px; height:70px; ov erflow:scroll; white-space:nowrap;">
51 TOP<br/><br/><br/><br/>
52 Scroll mouse wheel over here<br/><br/><br/><br/>
53 END
54 </div>
55 </span>
56 <div id="console"></div>
57 <script>
58 description("Tests that wheel events with the ctrl modifier are handled properly ");
59
60 runTest();
61 </script>
62 </body>
63 </html>
OLDNEW
« no previous file with comments | « no previous file | LayoutTests/fast/events/wheelevent-ctrl-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698