OLD | NEW |
(Empty) | |
| 1 <head> |
| 2 <script src="../resources/js-test.js"></script> |
| 3 <style> |
| 4 body { |
| 5 /* Hide the horizontal-scrollbar so that clicking right at the |
| 6 bottom of the vertical scrollbar will trigger a scroll */ |
| 7 overflow-x: hidden; |
| 8 } |
| 9 #container { |
| 10 /* The plugin is guaranteed not to be in the margin. */ |
| 11 margin-left: 10px; |
| 12 } |
| 13 </style> |
| 14 </head> |
| 15 <body> |
| 16 <div id="container"></div> |
| 17 <pre id="console"></pre> |
| 18 </body> |
| 19 <script> |
| 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 if (window.testRunner) |
| 22 testRunner.dumpAsText(); |
| 23 if (window.internals) |
| 24 internals.settings.setOverlayScrollbarsEnabled(true); |
| 25 |
| 26 var startLogging = false; |
| 27 var eventHistory = []; |
| 28 |
| 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) { |
| 35 startLogging = true; |
| 36 eventHistory.push('plugin.mousedown'); |
| 37 }); |
| 38 plugin.addEventListener('mouseup', function(e) { |
| 39 if (startLogging) |
| 40 eventHistory.push('plugin.mouseup'); |
| 41 }); |
| 42 plugin.addEventListener('mousemove', function(e) { |
| 43 if (startLogging) |
| 44 eventHistory.push('plugin.mousemove'); |
| 45 }); |
| 46 d.appendChild(plugin); |
| 47 |
| 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(); |
| 60 } |
| 61 |
| 62 shouldBe('eventHistory.length', '2'); |
| 63 shouldBe('eventHistory[0]', '"plugin.mousedown"'); |
| 64 shouldBe('eventHistory[1]', '"plugin.mouseup"'); |
| 65 shouldNotBe('window.scrollY', '0'); |
| 66 </script> |
OLD | NEW |