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

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
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..4d244266dafcd5d569fa3c035786723580c65055
--- /dev/null
+++ b/LayoutTests/fast/scrolling/scrollbar-prevent-default.html
@@ -0,0 +1,68 @@
+<!DOCTYPE html>
+<html>
ojan 2014/06/06 02:02:55 Nit: normally we leave out the html/head/body elem
raymes 2014/06/06 04:47:40 I've kept the <head> tags for <style> is that ok?
+<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)
+
+ window.receivedMousedownEvent = false;
+
+ document.addEventListener('mousedown', function(e) {
+ e.preventDefault();
+ window.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('window.receivedMousedownEvent', 'true');
+
+ // Test a div scrollbar.
+ window.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('window.receivedMousedownEvent', 'true');
+</script>
+</html>

Powered by Google App Engine
This is Rietveld 408576698