Changes

Jump to: navigation, search

Gecko:Mouse Wheel Scrolling

294 bytes added, 00:32, 13 August 2012
DOM mouse wheel events and Default action
= DOM mouse wheel events and Default action =
The specification of Starting Mozilla 17 (Firefox 17), Gecko supports DOM Level 3 Events defines "wheel" . All web developers should handle only this event. We're working on this in You can see [https://bugzilladeveloper.mozilla.org/show_bugen-US/docs/DOM/DOM_event_reference/wheel the detail of "wheel" event] and [https://developer.mozilla.cgi?id=719320 bug 719320org/en-US/docs/DOM/WheelEvent WheelEvent interface]. All web developers should handle only this event after it's fixedin MDN.
And also, there are two legacy mouse wheel events which are non-standard. One is DOMMouseScroll event. This 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 always fired after a DOMMouseScroll event, however, it may be fired before without DOMMouseScroll event when native mouse wheel event causes less than one line or page on Windows.
On Mac, native events tell Gecko how much lines should be scrolled first. After that, one or more native pixel scroll events may be fired for smooth scroll. Thereforewidget/cocoa dispatches widget::WheelEvent with nsIDOMWheelEvent::DOM_DELTA_PIXEL if the mouse (or touchpad) tells Gecko how much pixels should be scrolled. Otherwise, DOMMouseScroll i.e., it tells Gecko only how much lines should be scrolled, it dispatches the event is fired first on Macwith nsIDOMWheelEvent::DOM_DELTA_LINE.
On Windows, native events tell Gecko how much lines or pages should be scrolled. If the scroll amount is not integerSo, Gecko widget/windows dispatches a MozMousePixelScroll event first and stores widget::WheelEvent with nsIDOMWheelEvent::DOM_DELTA_LINE or nsIDOMWheelEvent::DOM_DELTA_PAGE. And either the amount. When accumulated scroll amount becomes one deltaX or more, it dispatches DOMMouseScrolldeltaY values may be non-integer value.
On the other platforms, widget only dispatches DOMMouseScroll event and nsEventStateManager automatically dispatches MozMousePixelScroll eventwidget::WheelEvent with nsIDOMWheelEvent::DOM_DELTA_LINE.
If neither wheel, 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.
87
edits

Navigation menu