Bug 24502

Summary: REGRESSION: Horizontal scrolling reversed for tilt/ball wheels
Product: WebKit Reporter: Peter Kasting <pkasting>
Component: WebKit Misc.Assignee: Peter Kasting <pkasting>
Severity: Normal CC: aroben, fishd
Priority: P1    
Version: 528+ (Nightly build)   
Hardware: PC   
OS: Windows Vista   
Description Flags
patch v1 fishd: review+

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.