OLD | NEW |
---|---|
(Empty) | |
1 <!DOCTYPE html> | |
2 <html> | |
ojan
2014/06/06 02:02:55
ditto
ojan
2014/06/06 02:02:55
ditto
raymes
2014/06/06 04:47:40
Done.
| |
3 <head> | |
4 <script src="../resources/js-test.js"></script> | |
5 <style> | |
6 body { | |
7 /* Hide the horizontal-scrollbar so that clicking right at the | |
8 bottom of the vertical scrollbar will trigger a scroll */ | |
9 overflow-x: hidden; | |
10 } | |
11 #container { | |
12 /* The plugin is guaranteed not to be in the margin. */ | |
13 margin-left: 10px; | |
14 } | |
15 </style> | |
16 </head> | |
17 <body> | |
18 <div id="container"></div> | |
19 <pre id="console"></pre> | |
20 </body> | |
21 <script> | |
22 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.'); | |
23 if (window.testRunner) | |
24 testRunner.dumpAsText(); | |
25 if (window.internals) | |
26 window.internals.settings.setOverlayScrollbarsEnabled(true); | |
27 | |
28 window.startLogging = false; | |
ojan
2014/06/06 02:02:55
Here and elsewhere: We don't usually prefix global
raymes
2014/06/06 04:47:40
These don't even need to be globals actually.
| |
29 window.eventHistory = []; | |
30 | |
31 var d = document.getElementById('container'); | |
32 var plugin = document.createElement('object'); | |
33 plugin.type = 'application/x-webkit-test-netscape'; | |
34 plugin.width = window.innerWidth * 2; | |
35 plugin.height = window.innerHeight * 2; | |
36 plugin.addEventListener('mousedown', function(e) { | |
37 startLogging = true; | |
38 eventHistory.push('plugin.mousedown'); | |
39 }); | |
40 plugin.addEventListener('mouseup', function(e) { | |
41 if (startLogging) | |
42 eventHistory.push('plugin.mouseup'); | |
43 }); | |
44 plugin.addEventListener('mousemove', function(e) { | |
45 if (startLogging) | |
46 eventHistory.push('plugin.mousemove'); | |
47 }); | |
48 d.appendChild(plugin); | |
49 | |
50 if (window.eventSender) { | |
51 // Mouse down on the scrollbar which is over the plugin. | |
52 eventSender.mouseMoveTo(window.innerWidth - 1, | |
53 window.innerHeight - 1); | |
54 eventSender.mouseDown(); | |
55 // Move outside the plugin, it shouldn't receive any events | |
56 // because there shouldn't be any mouse capture. | |
57 eventSender.mouseMoveTo(5, 5); | |
58 // A mouse up will be received because when dragging off a | |
59 // scrollbar and releasing, it dispatches an event to the last | |
60 // element under the mouse. | |
61 eventSender.mouseUp(); | |
62 } | |
63 | |
64 shouldBe('window.eventHistory.length', '2'); | |
65 shouldBe('window.eventHistory[0]', '"plugin.mousedown"'); | |
66 shouldBe('window.eventHistory[1]', '"plugin.mouseup"'); | |
67 shouldNotBe('window.scrollY', '0'); | |
68 </script> | |
69 </html> | |
OLD | NEW |