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

Side by Side 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, 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 unified diff | Download patch
OLDNEW
(Empty)
1 <!DOCTYPE html>
2 <html>
3 <head>
4 <script src="../resources/js-test.js"></script>
5 <script>
6 description('This tests whether scrolling still works correctly when an overlay scrollbar is over a plugin. The plugin should still receive mouse down/u p events when clicking an overlay scrollbar. Scrolling should still work correct ly too. However mouse capture should not be started on the plugin as this would interfere with events going to the scrollbar.');
7 if (window.testRunner) {
8 testRunner.dumpAsText();
9 testRunner.waitUntilDone();
10 }
11 if (window.internals)
12 window.internals.settings.setOverlayScrollbarsEnabled(true);
13
14 function finish() {
15 shouldBe('window.eventHistory.length', '2');
16 shouldBe('window.eventHistory[0]', '"plugin.mousedown"');
17 shouldBe('window.eventHistory[1]', '"plugin.mouseup"');
18 shouldNotBe('window.scrollY', '0');
19 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.
20 }
21
22 window.onload = function() {
23 window.startLogging = false;
24 window.eventHistory = [];
25
26 var d = document.getElementById('container');
27 var plugin = document.createElement('object');
28 plugin.type = 'application/x-webkit-test-netscape';
29 plugin.width = window.innerWidth * 2;
30 plugin.height = window.innerHeight * 2;
31 plugin.addEventListener('mousedown', function(e) {
32 startLogging = true;
33 eventHistory.push('plugin.mousedown');
34 });
35 plugin.addEventListener('mouseup', function(e) {
36 if (startLogging) {
37 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.
38 eventHistory.push('plugin.mouseup');
39 finish();
40 }
41 });
42 plugin.addEventListener('mousemove', function(e) {
43 if (startLogging)
44 eventHistory.push('plugin.mousemove');
45 });
46 d.appendChild(plugin);
47
48 if (window.eventSender) {
49 // Mouse down on the scrollbar which is over the plugin.
50 eventSender.mouseMoveTo(window.innerWidth - 1,
51 window.innerHeight - 1);
52 eventSender.mouseDown();
53 eventSender.mouseUp();
54 // Move outside the plugin, it shouldn't receive any events
55 // 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
56 eventSender.mouseMoveTo(5, 5);
57 // A mouse up will be received because when dragging off a
58 // scrollbar and releasing, it dispatches an event to the last
59 // element under the mouse.
60 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.
61 }
62 }
63 </script>
64 <style>
65 body {
66 /* Hide the horizontal-scrollbar so that clicking right at the
67 bottom of the vertical scrollbar will trigger a scroll */
68 overflow-x: hidden;
69 }
70 #container {
71 /* The plugin is guaranteed not to be in the margin. */
72 margin-left: 10px;
73 }
74 </style>
75 </head>
76 <body>
77 <div id="container"></div>
78 <pre id="console"></pre>
79 </body>
80 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698