OLD | NEW |
(Empty) | |
| 1 <head> |
| 2 <script src="../../resources/js-test.js"></script> |
| 3 <style> |
| 4 body { |
| 5 height: 200vh; |
| 6 width: 200vw; |
| 7 margin: 0; |
| 8 } |
| 9 #subframe { |
| 10 width: 100px; |
| 11 height: 100px; |
| 12 background-color: black; |
| 13 overflow: scroll; |
| 14 } |
| 15 #subframe-content { |
| 16 width: 200px; |
| 17 height: 200px; |
| 18 background-color: black; |
| 19 } |
| 20 </style> |
| 21 </head> |
| 22 <body> |
| 23 <div id="subframe"> |
| 24 <div id="subframe-content"></div> |
| 25 </div> |
| 26 <pre id="console"></pre> |
| 27 </body> |
| 28 <script> |
| 29 description('This tests that scrollbars always receive events even when ther
e 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 al
so happen with elements underneath of overlay scrollbars.'); |
| 30 if (window.testRunner) |
| 31 testRunner.dumpAsText(); |
| 32 if (window.internals) |
| 33 internals.settings.setMockScrollbarsEnabled(true) |
| 34 |
| 35 var receivedMousedownEvent = false; |
| 36 |
| 37 document.addEventListener('mousedown', function(e) { |
| 38 e.preventDefault(); |
| 39 receivedMousedownEvent = true; |
| 40 }); |
| 41 |
| 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(); |
| 48 } |
| 49 |
| 50 shouldBe('window.scrollY', '0'); |
| 51 shouldBe('receivedMousedownEvent', 'true'); |
| 52 |
| 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(); |
| 61 } |
| 62 |
| 63 shouldBe('subframe.scrollTop', '0'); |
| 64 shouldBe('receivedMousedownEvent', 'true'); |
| 65 </script> |
OLD | NEW |