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

Side by Side Diff: third_party/WebKit/LayoutTests/plugins/overlay-scrollbar-mouse-capture.html

Issue 2467693002: Implement overlay scrollbar fade out for non-composited scrollers. (Closed)
Patch Set: sigh....git cl format Created 4 years, 1 month 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
1 <head> 1 <head>
2 <script src="../resources/js-test.js"></script> 2 <script src="../resources/js-test.js"></script>
3 <style> 3 <style>
4 body { 4 body {
5 /* Hide the horizontal-scrollbar so that clicking right at the 5 /* Hide the horizontal-scrollbar so that clicking right at the
6 bottom of the vertical scrollbar will trigger a scroll */ 6 bottom of the vertical scrollbar will trigger a scroll */
7 overflow-x: hidden; 7 overflow-x: hidden;
8 } 8 }
9 #container { 9 #container {
10 /* The plugin is guaranteed not to be in the margin. */ 10 /* The plugin is guaranteed not to be in the margin. */
11 margin-left: 10px; 11 margin-left: 10px;
12 } 12 }
13 </style> 13 </style>
14 </head> 14 </head>
15 <body> 15 <body>
16 <div id="container"></div> 16 <div id="container"></div>
17 <pre id="console"></pre> 17 <pre id="console"></pre>
18 </body> 18 </body>
19 <script> 19 <script>
20 description('This tests whether scrolling still works correctly when an over lay scrollbar is over a plugin. The plugin should still receive mouse down/up ev ents when clicking an overlay scrollbar. Scrolling should still work correctly t oo. However mouse capture should not be started on the plugin as this would inte rfere with events going to the scrollbar.'); 20 description('This tests whether scrolling still works correctly when an '
21 + 'overlay scrollbar is over a plugin. Clicking on the overlay scrollbar '
22 + 'should cause it to activate and capture input.');
21 23
22 window.jsTestIsAsync = true; 24 window.jsTestIsAsync = true;
23 var startLogging = false; 25 var startLogging = false;
24 var eventHistory = []; 26 var eventHistory = [];
25 27
26 function runTest() { 28 function runTest() {
27 // Mouse down on the scrollbar which is over the plugin. 29 // Mouse down on the scrollbar thumb which is over the plugin.
28 eventSender.mouseMoveTo(window.innerWidth - 1, 30 eventSender.mouseMoveTo(window.innerWidth - 1,
29 window.innerHeight - 1); 31 15);
30 eventSender.mouseDown(); 32 eventSender.mouseDown();
31 // Move outside the plugin, it shouldn't receive any events 33 // Drag the thumb down but move off the thumb, the plugin shouldn't
32 // because there shouldn't be any mouse capture. 34 // receive any events because there shouldn't be any mouse capture.
33 eventSender.mouseMoveTo(5, 5); 35 eventSender.mouseMoveTo(window.innerWidth - 20, window.innerHeight - 10) ;
34 // A mouse up will be received because when dragging off a 36 // A mouse up will be received because when dragging off a
35 // scrollbar and releasing, it dispatches an event to the last 37 // scrollbar and releasing, it dispatches an event to the last
36 // element under the mouse. 38 // element under the mouse.
37 eventSender.mouseUp(); 39 eventSender.mouseUp();
38 40
41 // TODO(bokan): This is wrong, if the scrollbar captures the input the
42 // plugin shouldn't be receiving events. crbug.com/636436.
39 shouldBe('eventHistory.length', '2'); 43 shouldBe('eventHistory.length', '2');
40 shouldBe('eventHistory[0]', '"plugin.mousedown"'); 44 shouldBe('eventHistory[0]', '"plugin.mousedown"');
41 shouldBe('eventHistory[1]', '"plugin.mouseup"'); 45 shouldBe('eventHistory[1]', '"plugin.mouseup"');
42 shouldBecomeEqual('window.scrollY > 0', 'true', finishJSTest); 46 requestAnimationFrame(function() {
47 shouldBeTrue('window.scrollY > 0');
48 finishJSTest();
49 });
43 } 50 }
44 51
45 window.onload = function() { 52 window.onload = function() {
46 if (!window.eventSender || !window.internals) { 53 if (!window.eventSender || !window.internals) {
47 finishJSTest(); 54 finishJSTest();
48 return; 55 return;
49 } 56 }
50 57
58 // TODO(bokan): This doesn't really enable overlays since it flips the
59 // RuntimeEnabledFeature after the ScrollbarTheme is initialized. It
60 // makes the non overlay scrollbars think they're overlay so it works
61 // for this test but it should probably be in a unit test.
51 internals.settings.setOverlayScrollbarsEnabled(true); 62 internals.settings.setOverlayScrollbarsEnabled(true);
52 63
53 var d = document.getElementById('container'); 64 var d = document.getElementById('container');
54 var plugin = document.createElement('object'); 65 var plugin = document.createElement('object');
55 plugin.type = 'application/x-blink-test-plugin'; 66 plugin.type = 'application/x-blink-test-plugin';
56 plugin.width = window.innerWidth * 2; 67 plugin.width = window.innerWidth * 2;
57 plugin.height = window.innerHeight * 2; 68 plugin.height = window.innerHeight * 2;
58 plugin.addEventListener('mousedown', function(e) { 69 plugin.addEventListener('mousedown', function(e) {
59 startLogging = true; 70 startLogging = true;
60 eventHistory.push('plugin.mousedown'); 71 eventHistory.push('plugin.mousedown');
61 }); 72 });
62 plugin.addEventListener('mouseup', function(e) { 73 plugin.addEventListener('mouseup', function(e) {
63 if (startLogging) 74 if (startLogging)
64 eventHistory.push('plugin.mouseup'); 75 eventHistory.push('plugin.mouseup');
65 }); 76 });
66 plugin.addEventListener('mousemove', function(e) { 77 plugin.addEventListener('mousemove', function(e) {
67 if (startLogging) 78 if (startLogging)
68 eventHistory.push('plugin.mousemove'); 79 eventHistory.push('plugin.mousemove');
69 }); 80 });
70 d.appendChild(plugin); 81 d.appendChild(plugin);
71 82
72 runTest(); 83 runTest();
73 } 84 }
74 </script> 85 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698