Bug 24502 - REGRESSION: Horizontal scrolling reversed for tilt/ball wheels
Summary: REGRESSION: Horizontal scrolling reversed for tilt/ball wheels
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKit Misc. (show other bugs)
Version: 528+ (Nightly build)
Hardware: PC Windows Vista
: P1 Normal
Assignee: Peter Kasting
Depends on:
Reported: 2009-03-10 16:20 PDT by Peter Kasting
Modified: 2009-03-12 12:42 PDT (History)
2 users (show)

See Also:

patch v1 (5.23 KB, patch)
2009-03-11 11:36 PDT, Peter Kasting
fishd: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Peter Kasting 2009-03-10 16:20:00 PDT
r25803 made horizontal scrolling direction be correct for shift + vertical wheel and wrong for horizontal wheel (previously, it was the opposite).  This regressed rdar://4965715 .

This has to do with the various coordinate systems for different kinds of horizontal scrolling:

WM_MOUSEWHEEL is positive up, negative down.  Thus shift + wheel is positive left, negative right.
WM_MOUSEHWHEEL is positive right, negative left.
WM_HSCROLL gives you a positive wheel delta along with SB_{LINE,PAGE}{RIGHT,LEFT}.
WebKit expects positive left, negative right.

So, WM_MOUSEHWHEEL needs its delta inverted, whereas shift + WM_MOUSEWHEEL does not, and WM_HSCROLL (if Safari handled it, which it doesn't) simply needs to be set correctly.

I can patch this.  It will involve a few modifications to the WebKit/win code.
Comment 1 Peter Kasting 2009-03-11 11:36:42 PDT
Created attachment 28485 [details]
patch v1
Comment 2 Darin Fisher (:fishd, Google) 2009-03-12 12:30:39 PDT
Comment on attachment 28485 [details]
patch v1

>Index: WebCore/platform/win/WheelEventWin.cpp
>+    if (isMouseHWheel)
>+      delta = -delta;  // Windows is <-- -/+ -->, WebKit wants <-- +/- -->

nit: indentation is wrong

otherwise LGTM.
Comment 3 Peter Kasting 2009-03-12 12:42:16 PDT
Fixed in r41642.