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

Unified 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, 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | LayoutTests/fast/events/wheelevent-ctrl-expected.txt » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: LayoutTests/fast/events/wheelevent-ctrl.html
diff --git a/LayoutTests/fast/events/wheelevent-ctrl.html b/LayoutTests/fast/events/wheelevent-ctrl.html
new file mode 100644
index 0000000000000000000000000000000000000000..c4027b2bab22e086d66f4395f55ee633f4701dd2
--- /dev/null
+++ b/LayoutTests/fast/events/wheelevent-ctrl.html
@@ -0,0 +1,63 @@
+<!DOCTYPE html>
+<html>
+<head>
+<link rel="help" href="http://www.w3.org/TR/DOM-Level-3-Events/#events-WheelEvent">
+<script src="../../resources/js-test.js"></script>
+<script>
+var deltaY = 0;
+var scrollAmount = -2;
+var expectedDeltaY = scrollAmount * -40;
+
+var testDiv;
+function runTest() {
+
+ testDiv = document.getElementById('target');
+ testDiv.addEventListener('wheel', wheelHandler);
+ if (!window.eventSender) {
+ debug("FAIL: This test requires window.eventSender.");
+ return;
+ }
+
+ // Verify that wheel with ctrl modifier is fired property but doesn't scroll.
+ eventSender.mouseMoveTo(testDiv.offsetLeft + 5, testDiv.offsetTop + 5);
+ eventSender.mouseScrollBy(0, scrollAmount, false, true, "ctrlKey");
+ shouldBe("wheelEventCount", "1");
+ shouldEvaluateTo("deltaY", expectedDeltaY);
+ shouldBeTrue("ctrlKey");
+ shouldBe("testDiv.scrollTop", "0");
+
+ // Verify that without the ctrl modifier we scroll as normal.
+ eventSender.mouseMoveTo(testDiv.offsetLeft + 5, testDiv.offsetTop + 5);
+ eventSender.mouseScrollBy(0, scrollAmount, false, true);
+ shouldBe("wheelEventCount", "2");
+ shouldEvaluateTo("deltaY", expectedDeltaY);
+ shouldBeFalse("ctrlKey");
+ shouldBe("testDiv.scrollTop", "deltaY");
+}
+
+var wheelEventCount = 0;
+var ctrlKey = false;
+function wheelHandler(e) {
+ wheelEventCount++;
+ deltaY = e.deltaY;
+ ctrlKey = e.ctrlKey;
+}
+
+</script>
+</head>
+<body>
+<span id="parent">
+ <div id="target" style="border:solid 1px green; width:220px; height:70px; overflow:scroll; white-space:nowrap;">
+ TOP<br/><br/><br/><br/>
+ Scroll mouse wheel over here<br/><br/><br/><br/>
+ END
+ </div>
+</span>
+<div id="console"></div>
+<script>
+description("Tests that wheel events with the ctrl modifier are handled properly");
+
+runTest();
+</script>
+</body>
+</html>
« 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