87
edits
Line 48: | Line 48: | ||
= DOM mouse wheel events and Default action = | = DOM mouse wheel events and Default action = | ||
Starting Mozilla 17 (Firefox 17), Gecko supports DOM Level 3 Events "wheel". All web developers should handle only this event. You can see [https://developer.mozilla.org/en-US/docs/DOM/DOM_event_reference/wheel the detail of "wheel" event] and [https://developer.mozilla.org/en-US/docs/DOM/WheelEvent WheelEvent interface] in 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 | 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 always fired after a DOMMouseScroll event, however, it may be fired without DOMMouseScroll event when native mouse wheel event causes less than one line or page. | ||
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. | 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. widget/cocoa dispatches widget::WheelEvent with nsIDOMWheelEvent::DOM_DELTA_PIXEL if the mouse (or touchpad) tells Gecko how much pixels should be scrolled. Otherwise, i.e., it tells Gecko only how much lines should be scrolled, it dispatches the event with nsIDOMWheelEvent::DOM_DELTA_LINE. | ||
On Windows, native events tell Gecko how much lines or pages should be scrolled. | On Windows, native events tell Gecko how much lines or pages should be scrolled. So, widget/windows dispatches widget::WheelEvent with nsIDOMWheelEvent::DOM_DELTA_LINE or nsIDOMWheelEvent::DOM_DELTA_PAGE. And either the deltaX or deltaY values may be non-integer value. | ||
On the other platforms, widget | On the other platforms, widget dispatches widget::WheelEvent with nsIDOMWheelEvent::DOM_DELTA_LINE. | ||
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. | 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. | So, the contents can prevent scrolling. Then, mouse wheel transaction isn't updated. |
edits