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

Unified Diff: LayoutTests/fast/scrolling/scrollbar-prevent-default.html

Issue 296003011: Fix event passing to overlay scrollbars when over a plugin (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 6 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 | « LayoutTests/TestExpectations ('k') | LayoutTests/fast/scrolling/scrollbar-prevent-default-expected.txt » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: LayoutTests/fast/scrolling/scrollbar-prevent-default.html
diff --git a/LayoutTests/fast/scrolling/scrollbar-prevent-default.html b/LayoutTests/fast/scrolling/scrollbar-prevent-default.html
new file mode 100644
index 0000000000000000000000000000000000000000..847e77224b25b27981983666113759af21e138c4
--- /dev/null
+++ b/LayoutTests/fast/scrolling/scrollbar-prevent-default.html
@@ -0,0 +1,65 @@
+<head>
+ <script src="../../resources/js-test.js"></script>
+ <style>
+ body {
+ height: 200vh;
+ width: 200vw;
+ margin: 0;
+ }
+ #subframe {
+ width: 100px;
+ height: 100px;
+ background-color: black;
+ overflow: scroll;
+ }
+ #subframe-content {
+ width: 200px;
+ height: 200px;
+ background-color: black;
+ }
+ </style>
+</head>
+<body>
+ <div id="subframe">
+ <div id="subframe-content"></div>
+ </div>
+ <pre id="console"></pre>
+</body>
+<script>
+ description('This tests that scrollbars always receive events even when there is an element underneath the scrollbar which swallows the event. In this case an event handler is added to the window which swallows the event but this may also happen with elements underneath of overlay scrollbars.');
+ if (window.testRunner)
+ testRunner.dumpAsText();
+ if (window.internals)
+ internals.settings.setMockScrollbarsEnabled(true)
+
+ var receivedMousedownEvent = false;
+
+ document.addEventListener('mousedown', function(e) {
+ e.preventDefault();
+ receivedMousedownEvent = true;
+ });
+
+ // Test the frame scrollbar.
+ window.scrollTo(0, 10);
+ if (window.eventSender) {
+ eventSender.mouseMoveTo(window.innerWidth - 5, 1);
+ eventSender.mouseDown();
+ eventSender.mouseUp();
+ }
+
+ shouldBe('window.scrollY', '0');
+ shouldBe('receivedMousedownEvent', 'true');
+
+ // Test a div scrollbar.
+ receivedMousedownEvent = false;
+ var subframe = document.getElementById('subframe');
+ subframe.scrollTop = 10;
+ if (window.eventSender) {
+ eventSender.mouseMoveTo(100 - 5, 1);
+ eventSender.mouseDown();
+ eventSender.mouseUp();
+ }
+
+ shouldBe('subframe.scrollTop', '0');
+ shouldBe('receivedMousedownEvent', 'true');
+</script>
« no previous file with comments | « LayoutTests/TestExpectations ('k') | LayoutTests/fast/scrolling/scrollbar-prevent-default-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698