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

Unified Diff: LayoutTests/plugins/overlay-scrollbar-mouse-capture.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, 7 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/plugins/overlay-scrollbar-mouse-capture.html
diff --git a/LayoutTests/plugins/overlay-scrollbar-mouse-capture.html b/LayoutTests/plugins/overlay-scrollbar-mouse-capture.html
new file mode 100644
index 0000000000000000000000000000000000000000..01c3adab45ce0ae9f1634f718f6003c9853c1b18
--- /dev/null
+++ b/LayoutTests/plugins/overlay-scrollbar-mouse-capture.html
@@ -0,0 +1,80 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <script src="../resources/js-test.js"></script>
+ <script>
+ description('This tests whether scrolling still works correctly when an overlay scrollbar is over a plugin. The plugin should still receive mouse down/up events when clicking an overlay scrollbar. Scrolling should still work correctly too. However mouse capture should not be started on the plugin as this would interfere with events going to the scrollbar.');
+ if (window.testRunner) {
+ testRunner.dumpAsText();
+ testRunner.waitUntilDone();
+ }
+ if (window.internals)
+ window.internals.settings.setOverlayScrollbarsEnabled(true);
+
+ function finish() {
+ shouldBe('window.eventHistory.length', '2');
+ shouldBe('window.eventHistory[0]', '"plugin.mousedown"');
+ shouldBe('window.eventHistory[1]', '"plugin.mouseup"');
+ shouldNotBe('window.scrollY', '0');
+ window.testRunner.notifyDone();
Rick Byers 2014/05/31 04:32:33 again this could probably be a little simpler as a
raymes 2014/06/03 00:09:36 Done.
+ }
+
+ window.onload = function() {
+ window.startLogging = false;
+ window.eventHistory = [];
+
+ var d = document.getElementById('container');
+ var plugin = document.createElement('object');
+ plugin.type = 'application/x-webkit-test-netscape';
+ plugin.width = window.innerWidth * 2;
+ plugin.height = window.innerHeight * 2;
+ plugin.addEventListener('mousedown', function(e) {
+ startLogging = true;
+ eventHistory.push('plugin.mousedown');
+ });
+ plugin.addEventListener('mouseup', function(e) {
+ if (startLogging) {
+ mouseupFired = true;
Rick Byers 2014/05/31 04:32:33 looks like this is unused, remove it
raymes 2014/06/03 00:09:36 Done.
+ eventHistory.push('plugin.mouseup');
+ finish();
+ }
+ });
+ plugin.addEventListener('mousemove', function(e) {
+ if (startLogging)
+ eventHistory.push('plugin.mousemove');
+ });
+ d.appendChild(plugin);
+
+ if (window.eventSender) {
+ // Mouse down on the scrollbar which is over the plugin.
+ eventSender.mouseMoveTo(window.innerWidth - 1,
+ window.innerHeight - 1);
+ eventSender.mouseDown();
+ eventSender.mouseUp();
+ // Move outside the plugin, it shouldn't receive any events
+ // because there shouldn't be any mouse capture.
Rick Byers 2014/05/31 04:32:33 isn't capture released as soon as there's a mouseu
raymes 2014/06/03 00:09:36 Sorry - yes this is a spurious mouseUp that I thre
+ eventSender.mouseMoveTo(5, 5);
+ // A mouse up will be received because when dragging off a
+ // scrollbar and releasing, it dispatches an event to the last
+ // element under the mouse.
+ eventSender.mouseUp();
Rick Byers 2014/05/31 04:32:33 oh, was the above mouseUp a typo? You shouldn't h
raymes 2014/06/03 00:09:36 Done.
+ }
+ }
+ </script>
+ <style>
+ body {
+ /* Hide the horizontal-scrollbar so that clicking right at the
+ bottom of the vertical scrollbar will trigger a scroll */
+ overflow-x: hidden;
+ }
+ #container {
+ /* The plugin is guaranteed not to be in the margin. */
+ margin-left: 10px;
+ }
+ </style>
+</head>
+<body>
+ <div id="container"></div>
+ <pre id="console"></pre>
+</body>
+</html>

Powered by Google App Engine
This is Rietveld 408576698