New issue
Advanced search Search tips

Issue 862661 link

Starred by 1 user

Issue metadata

Status: Fixed
Owner:
Closed: Aug 7
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Mac
Pri: 2
Type: Bug



Sign in to add a comment

Shift + Scroll Behavior Seems incorrect on OSX

Project Member Reported by ekaramad@chromium.org, Jul 11

Issue description

Chrome Version: 67.0.3396.99 (Official Build) (64-bit)
OS: Mac

On Mac Shift + Scroll (using a mouse with an scrollbar which only moves vertically) should perhaps only scroll vertically. The current behavior for Chrome is that it will not scroll at all. On Safari, shift is ignored when mouse has two-dimensional scroller (so only scrolling vertically).

The reason seems to be that the code in MouseWheelEventQueue unconditionally swaps delta X & Y for wheel events with a shift key modifier. Later on, the delta X and Y will be set to zero if the |rails_mode| property is vertical or horizontal, respectively.

Perhaps the code should only swap if |rails_mode| is not set to vertical or horizontal (i.e., respect the decision made by MouseWheelRailsFilterMac).
 
To be clear I am observing this when using a mac wired mouse with a multi directional scroll wheel.
Cc: kenrb@chromium.org
So further digging into the MouseWheelEvent::ProcessMouseAck I noticed:

1- If the source of the input is the trackpad/touchpad on my laptop, there is a RailsMode indication which is set through MouseWheelRailsFilter. When using the trackpad both delta_x and delta_y are always nonzero which jumps the condition of delta_x and hence organically, we never swap X & Y when shift is pressed.

2- If the source of the input is an hp mouse then the OS event seems to have already taken care of the direction, i.e., shift + scroll leads to nonzero delta along X and zero delta along Y.

3- If the source of the input is the apple mouse with omnidirectional wheel ball, then the OS event is the same as case (1), i.e., track pad except that only one of delta_x or delta_y is zero.

So we get case 2) for free since it never gets into the swapping code; but case 3) is buggy (the scenario is bug description happens).
Description: Show this description
Project Member

Comment 4 by bugdroid1@chromium.org, Jul 23

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/7fb58bbd8fa63eb7a9d7cb68761e367e5faf4f34

commit 7fb58bbd8fa63eb7a9d7cb68761e367e5faf4f34
Author: Ehsan Karamad <ekaramad@chromium.org>
Date: Mon Jul 23 22:20:40 2018

Do not swap X & Y for for shift-scrolling on Mac

MacOSX scrollWheel event already provides the correct behavior. If the
event (physical) source has precise deltas and comes from a trackpad
or apple mouse then it has bidirectional deltas already and pressing
shift key should not swap the axis. If the source of the event is an
ordinary single-axis mouse, then the NSEvent already packs |delta_x|
instead of |delta_y| (for shift-scroll).

Also, it turns out that rails mode should only be used for trackpad. The
logic in MosueWheelRailsFilter uses an auto-regressive filter to smooth
out rails latching. This state is reset for a kPhaseScrollBegan. However,
apple mice would always have a phase of kPhaseNone. Since it never resets
it might lead to a large value in one axis (i.e., in y-axis after a
vertical scroll phase) and when scrolling in the other direction occurs,
the rails mode is set incorrectly. The side effects of this are zero
scroll deltas which also fires a DCHECK in mouse_wheel_event_queue.cc:
DCHECK(needs_update). To repro use an apple mouse and scroll vertically
and then horizontally using the bidirectional wheel.

Bug:  862661 

Change-Id: I4e5210454fe7352ab0230b312f44e1a374f22f0c
Reviewed-on: https://chromium-review.googlesource.com/1134434
Reviewed-by: ccameron <ccameron@chromium.org>
Reviewed-by: Ken Buchanan <kenrb@chromium.org>
Reviewed-by: Ehsan Karamad <ekaramad@chromium.org>
Commit-Queue: Ehsan Karamad <ekaramad@chromium.org>
Cr-Commit-Position: refs/heads/master@{#577296}
[modify] https://crrev.com/7fb58bbd8fa63eb7a9d7cb68761e367e5faf4f34/content/browser/renderer_host/input/mouse_wheel_event_queue.cc
[modify] https://crrev.com/7fb58bbd8fa63eb7a9d7cb68761e367e5faf4f34/content/browser/renderer_host/input/mouse_wheel_event_queue_unittest.cc
[modify] https://crrev.com/7fb58bbd8fa63eb7a9d7cb68761e367e5faf4f34/content/browser/renderer_host/input/mouse_wheel_rails_filter_mac.cc

Status: Assigned (was: Available)
Status: Fixed (was: Assigned)
Marking as fixed following comment #4.

Sign in to add a comment