87
edits
Changes
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 =
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]).