Changes

Jump to: navigation, search

Gecko:Mouse Wheel Scrolling

1,023 bytes added, 01:00, 3 July 2012
no edit summary
= Overview =
Gecko can have multiple scrollable frames in its content. This page documents the detail of mouse wheel scrolling rules in Gecko.
This first version is written for Gecko 1.9.2. But this document isn't stable, so, when this document will be updated for new behavior, the writer must write the version clearly.
By above rules, users can scroll one scrollable frame smoothly. However, when two or more scrollable frames are nested, we need additional rules.
For example, there is a page body which is scrollable and has a scrollable sub-frame (e.g., listbox of select element with multiple attribute, div element with overflow property, iframe element). When an a user is scrolling down the sub-frame, it will be reached to the end of its content. However, some mouse wheel events which were fired after that will scroll the body unexpectedly.
And there is another example, when the user is scrolling the page body, the sub-frame may come under the mouse cursor. Then, the sub-frame intercepts the mouse wheel events unexpectedly.
* When a target frame is destroyed.
Note that the transaction is updated only when a mouse wheel event scrolls the target frame actually. I.e., when an a user keeps to turn mouse wheel to unscrollable direction, the transaction will be timed out. This is important for touchpad users, see [https://bugzilla.mozilla.org/show_bug.cgi?id=442774 bug 442774].
= DOMMouseScroll event vs. DOM mouse wheel events and Scrolling and other default action =
A native mouse The specification of DOM Level 3 Events defines "wheel " event causes DOMMouseScroll events. The widget code dispatches an nsMouseScroll We're working on this in [https://bugzilla.mozilla.org/show_bug.cgi?id=719320 bug 719320]. All web developers should handle only this event when after it handles a native mouse wheel event. Then, nsPresShell dispatches DOMMouseScroll events first. If preventDefault() wasn't called, nsEventStateManager tries to scroll a frame by the above ruless fixed.
SoAnd also, the contents can prevent scrollingthere are two legacy mouse wheel events which are non-standard. One is DOMMouseScroll event. At that timeThis is typically fired when mouse wheel is turned one or more lines or pages. The other is MozMousePixelScroll. This event tells web applications how much pixels should be scrolled. It's typically fired after a DOMMouseScroll event, however, it may be fired before DOMMouseScroll event when native mouse wheel transaction isn't updatedevent causes less than one line or page on Windows.
Note On Mac, native events tell Gecko how much lines should be scrolled first. After that DOMMouseScroll , one or more native pixel scroll events are may be fired by the actual cursor positionfor smooth scroll. So, by the mouse wheel transaction systemTherefore, the scroll target and the target of the DOMMouseScroll event may be different even if the target of DOMMouseScroll is scrollablefired first on Mac.
On Windows, native events tell Gecko how much lines or pages should be scrolled. If the scroll amount is not integer, Gecko dispatches a MozMousePixelScroll event first and stores the amount. When accumulated scroll amount becomes one or more, it dispatches DOMMouseScroll. On the other platforms, widget only dispatches DOMMouseScroll event and nsEventStateManager automatically dispatches MozMousePixelScroll event. If neither DOMMouseScroll nor MozMousePixelScroll is consumed by peventDefault(), nsEventStateManager performs a default action. There are four default actions: scroll, going back or forward history, zoom in or out, and doing nothing. So, the contents can prevent scrolling. Then, mouse wheel transaction isn't updated. Windows version of Gecko 1.9.2 and earlier doesn't fire DOMMouseScroll DOM mouse wheel events when the mouse cursor is on a windowed plug-in and it consumes native mouse wheel events. This is going to be improved in [https://bugzilla.mozilla.org/show_bug.cgi?id=483136 bug 483136].
= Override system of system scroll speed =
* We don't send mouse wheel events to windowless plug-ins ([https://bugzilla.mozilla.org/show_bug.cgi?id=359403 bug 359403]).
* When an a user is turning the mouse wheel but moving the mouse cursor, the transaction will not be finished even if the cursor is moved far.* When an a user finished scrolling a sub-frame but the sub-frame is clipped by its ancestor frame, the user doesn't still watch the all contents of the sub-frame ([https://bugzilla.mozilla.org/show_bug.cgi?id=428350 bug 428350]).
87
edits

Navigation menu