2 <script src=
"../../resources/js-test.js"></script>
12 background-color: black;
18 background-color: black;
24 <div id=
"subframe-content"></div>
26 <pre id=
"console"></pre>
29 description('This tests that scrollbars always receive events even when there is an element underneath the scrollbar which swallows the event. In this case an event handler is added to the window which swallows the event but this may also happen with elements underneath of overlay scrollbars.');
30 if (window
.testRunner
)
31 testRunner
.dumpAsText();
33 internals
.settings
.setMockScrollbarsEnabled(true)
35 var receivedMousedownEvent
= false;
37 document
.addEventListener('mousedown', function(e
) {
39 receivedMousedownEvent
= true;
42 // Test the frame scrollbar.
43 window
.scrollTo(0, 10);
44 if (window
.eventSender
) {
45 eventSender
.mouseMoveTo(window
.innerWidth
- 5, 1);
46 eventSender
.mouseDown();
47 eventSender
.mouseUp();
50 shouldBe('window.scrollY', '0');
51 shouldBe('receivedMousedownEvent', 'true');
53 // Test a div scrollbar.
54 receivedMousedownEvent
= false;
55 var subframe
= document
.getElementById('subframe');
56 subframe
.scrollTop
= 10;
57 if (window
.eventSender
) {
58 eventSender
.mouseMoveTo(100 - 5, 1);
59 eventSender
.mouseDown();
60 eventSender
.mouseUp();
63 shouldBe('subframe.scrollTop', '0');
64 shouldBe('receivedMousedownEvent', 'true');