Touchpad scroll distance depends on zoom level but probably shouldn't

NEW
Unassigned

Status

()

Core
Event Handling
5 years ago
5 years ago

People

(Reporter: avih, Unassigned)

Tracking

Trunk
x86_64
Windows 7
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

(Reporter)

Description

5 years ago
In contrast to mouse wheel - which usually conveys number of lines to scroll (and hence depends on text zoom level) - touchpad events should convey their information as scroll distance in pixels.

However, on my system (Asus laptop, Elantech touchpad), scroll distance using the touchpad (either two fingers scroll or "side scroll") depends on the zoom level, such that during a scroll from top to bottom of the touchpad at approximately the same speed, always the same percentage of the page is scrolled (-> many pixels distance when zoomed in, much fewer pixels distance when zoomed out).

This is possibly related to bug 844631 (touchpad scroll uses the same smooth-scroll duration preference as mouse wheel).
Are you getting pixel level info from the touchpad and the os? I think on Windows still the majority of hardware still does not send pixel level info.

I tried on my mac (which does have pixel level info) and I am able to scroll by exactly one device pixel even with absurd zoom ratios (6000% and 1%).
Usual touch pad devices use WM_MOUSEWHEEL for vertical scroll. Are you sure that your devices use WM_GESTURE? You can check it with WheelEvent.deltaMode value in:
https://bug719320.bugzilla.mozilla.org/attachment.cgi?id=650444
Component: General → Event Handling
OS: Windows 7 → All
Hardware: x86_64 → All
OS: All → Windows 7
Hardware: All → x86_64
(Reporter)

Comment 3

5 years ago
(In reply to Timothy Nikkel (:tn) from comment #1)
> Are you getting pixel level info from the touchpad and the os? I think on
> Windows still the majority of hardware still does not send pixel level info.
> 
> I tried on my mac (which does have pixel level info) and I am able to scroll
> by exactly one device pixel even with absurd zoom ratios (6000% and 1%).

Yes. I can scroll in pixel accuracy, and I'm not letting smooth scrolling affect my judgment on this.

(In reply to Masayuki Nakano (:masayuki) (Mozilla Japan) from comment #2)
> Usual touch pad devices use WM_MOUSEWHEEL for vertical scroll. Are you sure
> that your devices use WM_GESTURE? You can check it with WheelEvent.deltaMode
> value in:
> https://bug719320.bugzilla.mozilla.org/attachment.cgi?id=650444

I'm not sure that my devices uses WM_GESTURE, and WheelEvent.deltaMode is indeed DOM_DELTA_LINE, however, deltaY value of the event conveys fractional values (such as 0.1 etc). Here are sample lines from your testcase:

MozMousePixelScroll (Vertical), detail: 2
wheel, deltaMode: DOM_DELTA_LINE, deltaX: 0, deltaY: 0.1, deltaZ: 0
MozMousePixelScroll (Vertical), detail: 2
DOMMouseScroll (Vertical), detail: 1
wheel, deltaMode: DOM_DELTA_LINE, deltaX: 0, deltaY: 0.1, deltaZ: 0
MozMousePixelScroll (Vertical), detail: 1
wheel, deltaMode: DOM_DELTA_LINE, deltaX: 0, deltaY: 0.05, deltaZ: 0
MozMousePixelScroll (Vertical), detail: 5
wheel, deltaMode: DOM_DELTA_LINE, deltaX: 0, deltaY: 0.25, deltaZ: 0

Also, I've added another testcase at bug 829952 comment #21 which also summarizes the distance the page has scrolled, and works on all browsers. I've added theme my measurements using that new testcase.
(In reply to Avi Halachmi (:avih) from comment #3)
> (In reply to Masayuki Nakano (:masayuki) (Mozilla Japan) from comment #2)
> > Usual touch pad devices use WM_MOUSEWHEEL for vertical scroll. Are you sure
> > that your devices use WM_GESTURE? You can check it with WheelEvent.deltaMode
> > value in:
> > https://bug719320.bugzilla.mozilla.org/attachment.cgi?id=650444
> 
> I'm not sure that my devices uses WM_GESTURE, and WheelEvent.deltaMode is
> indeed DOM_DELTA_LINE, however, deltaY value of the event conveys fractional
> values (such as 0.1 etc). Here are sample lines from your testcase:
> 
> MozMousePixelScroll (Vertical), detail: 2
> wheel, deltaMode: DOM_DELTA_LINE, deltaX: 0, deltaY: 0.1, deltaZ: 0
> MozMousePixelScroll (Vertical), detail: 2
> DOMMouseScroll (Vertical), detail: 1
> wheel, deltaMode: DOM_DELTA_LINE, deltaX: 0, deltaY: 0.1, deltaZ: 0
> MozMousePixelScroll (Vertical), detail: 1
> wheel, deltaMode: DOM_DELTA_LINE, deltaX: 0, deltaY: 0.05, deltaZ: 0
> MozMousePixelScroll (Vertical), detail: 5
> wheel, deltaMode: DOM_DELTA_LINE, deltaX: 0, deltaY: 0.25, deltaZ: 0
> 
> Also, I've added another testcase at bug 829952 comment #21 which also
> summarizes the distance the page has scrolled, and works on all browsers.
> I've added theme my measurements using that new testcase.

The log indicates your device uses WM_MOUSEWHEEL instead of WM_GESTURE. So, the scroll amount is computed from line height with delta* value. I.e., your device does NOT specify the scroll amount by pixels. So, the behavior is by design.
(Reporter)

Comment 5

5 years ago
(In reply to Masayuki Nakano (:masayuki) (Mozilla Japan) from comment #4)
> The log indicates your device uses WM_MOUSEWHEEL instead of WM_GESTURE. So,
> the scroll amount is computed from line height with delta* value. I.e., your
> device does NOT specify the scroll amount by pixels. So, the behavior is by
> design.

I see, and the WM_MOUSEWHEEL documentation reinforces your position:

http://msdn.microsoft.com/en-us/library/windows/desktop/ms645617%28v=vs.85%29.aspx
> The delta [WHEEL_DELTA] was set to 120 to allow Microsoft or other vendors to
> build finer-resolution wheels (a freely-rotating wheel with no notches) to
> send more messages per rotation, but with a smaller value in each message.
> To use this feature, you can either add the incoming delta values until
> WHEEL_DELTA is reached (so for a delta-rotation you get the same response),
> or scroll partial lines in response to the more frequent messages. You can
> also choose your scroll granularity and accumulate deltas until it is
> reached.

I'm now wondering how common is the case of a touchpad which sends fractional line events, and if it's common, if we can deploy some heuristics for such cases and behave accordingly (to a touchpad).
I don't think that we need to separate the behavior between mouse wheel and touchpad.

We're using device pixels for computing scroll amount of line/page scroll:
http://mxr.mozilla.org/mozilla-central/source/content/events/src/nsEventStateManager.cpp#2843

If we use CSS pixel, we can fix this for all devices. But the point is, whether the change makes every happy or not.
You need to log in before you can comment on or make changes to this bug.