2 <script src=
"../resources/js-test.js"></script>
5 /* Hide the horizontal-scrollbar so that clicking right at the
6 bottom of the vertical scrollbar will trigger a scroll */
10 /* The plugin is guaranteed not to be in the margin. */
16 <div id=
"container"></div>
17 <pre id=
"console"></pre>
20 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.');
21 if (window
.testRunner
)
22 testRunner
.dumpAsText();
24 internals
.settings
.setOverlayScrollbarsEnabled(true);
26 var startLogging
= false;
27 var eventHistory
= [];
29 var d
= document
.getElementById('container');
30 var plugin
= document
.createElement('object');
31 plugin
.type
= 'application/x-webkit-test-netscape';
32 plugin
.width
= window
.innerWidth
* 2;
33 plugin
.height
= window
.innerHeight
* 2;
34 plugin
.addEventListener('mousedown', function(e
) {
36 eventHistory
.push('plugin.mousedown');
38 plugin
.addEventListener('mouseup', function(e
) {
40 eventHistory
.push('plugin.mouseup');
42 plugin
.addEventListener('mousemove', function(e
) {
44 eventHistory
.push('plugin.mousemove');
46 d
.appendChild(plugin
);
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 // Move outside the plugin, it shouldn't receive any events
54 // because there shouldn't be any mouse capture.
55 eventSender
.mouseMoveTo(5, 5);
56 // A mouse up will be received because when dragging off a
57 // scrollbar and releasing, it dispatches an event to the last
58 // element under the mouse.
59 eventSender
.mouseUp();
62 shouldBe('eventHistory.length', '2');
63 shouldBe('eventHistory[0]', '"plugin.mousedown"');
64 shouldBe('eventHistory[1]', '"plugin.mouseup"');
65 shouldNotBe('window.scrollY', '0');