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

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

Issue 2478463003: Revert of Implement overlay scrollbar fade out for non-composited scrollers. (Closed)
Patch Set: 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 ' 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.');
21 + 'overlay scrollbar is over a plugin. Clicking on the overlay scrollbar '
22 + 'should cause it to activate and capture input.');
23 21
24 window.jsTestIsAsync = true; 22 window.jsTestIsAsync = true;
25 var startLogging = false; 23 var startLogging = false;
26 var eventHistory = []; 24 var eventHistory = [];
27 25
28 function runTest() { 26 function runTest() {
29 // Mouse down on the scrollbar thumb which is over the plugin. 27 // Mouse down on the scrollbar which is over the plugin.
30 eventSender.mouseMoveTo(window.innerWidth - 1, 28 eventSender.mouseMoveTo(window.innerWidth - 1,
31 15); 29 window.innerHeight - 1);
32 eventSender.mouseDown(); 30 eventSender.mouseDown();
33 // Drag the thumb down but move off the thumb, the plugin shouldn't 31 // Move outside the plugin, it shouldn't receive any events
34 // receive any events because there shouldn't be any mouse capture. 32 // because there shouldn't be any mouse capture.
35 eventSender.mouseMoveTo(window.innerWidth - 20, window.innerHeight - 10) ; 33 eventSender.mouseMoveTo(5, 5);
36 // A mouse up will be received because when dragging off a 34 // A mouse up will be received because when dragging off a
37 // scrollbar and releasing, it dispatches an event to the last 35 // scrollbar and releasing, it dispatches an event to the last
38 // element under the mouse. 36 // element under the mouse.
39 eventSender.mouseUp(); 37 eventSender.mouseUp();
40 38
41 // TODO(bokan): This is wrong, if the scrollbar captures the input the
42 // plugin shouldn't be receiving events. crbug.com/636436.
43 shouldBe('eventHistory.length', '2'); 39 shouldBe('eventHistory.length', '2');
44 shouldBe('eventHistory[0]', '"plugin.mousedown"'); 40 shouldBe('eventHistory[0]', '"plugin.mousedown"');
45 shouldBe('eventHistory[1]', '"plugin.mouseup"'); 41 shouldBe('eventHistory[1]', '"plugin.mouseup"');
46 requestAnimationFrame(function() { 42 shouldBecomeEqual('window.scrollY > 0', 'true', finishJSTest);
47 shouldBeTrue('window.scrollY > 0');
48 finishJSTest();
49 });
50 } 43 }
51 44
52 window.onload = function() { 45 window.onload = function() {
53 if (!window.eventSender || !window.internals) { 46 if (!window.eventSender || !window.internals) {
54 finishJSTest(); 47 finishJSTest();
55 return; 48 return;
56 } 49 }
57 50
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.
62 internals.settings.setOverlayScrollbarsEnabled(true); 51 internals.settings.setOverlayScrollbarsEnabled(true);
63 52
64 var d = document.getElementById('container'); 53 var d = document.getElementById('container');
65 var plugin = document.createElement('object'); 54 var plugin = document.createElement('object');
66 plugin.type = 'application/x-blink-test-plugin'; 55 plugin.type = 'application/x-blink-test-plugin';
67 plugin.width = window.innerWidth * 2; 56 plugin.width = window.innerWidth * 2;
68 plugin.height = window.innerHeight * 2; 57 plugin.height = window.innerHeight * 2;
69 plugin.addEventListener('mousedown', function(e) { 58 plugin.addEventListener('mousedown', function(e) {
70 startLogging = true; 59 startLogging = true;
71 eventHistory.push('plugin.mousedown'); 60 eventHistory.push('plugin.mousedown');
72 }); 61 });
73 plugin.addEventListener('mouseup', function(e) { 62 plugin.addEventListener('mouseup', function(e) {
74 if (startLogging) 63 if (startLogging)
75 eventHistory.push('plugin.mouseup'); 64 eventHistory.push('plugin.mouseup');
76 }); 65 });
77 plugin.addEventListener('mousemove', function(e) { 66 plugin.addEventListener('mousemove', function(e) {
78 if (startLogging) 67 if (startLogging)
79 eventHistory.push('plugin.mousemove'); 68 eventHistory.push('plugin.mousemove');
80 }); 69 });
81 d.appendChild(plugin); 70 d.appendChild(plugin);
82 71
83 runTest(); 72 runTest();
84 } 73 }
85 </script> 74 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698