Bug 130441

Summary: WebKit2 View Gestures: Swipe gesture can track vertical movement instead of horizontal movement
Product: WebKit Reporter: Tim Horton <thorton>
Component: WebKit2Assignee: Tim Horton <thorton>
Status: RESOLVED FIXED    
Severity: Normal CC: andersca, sam, simon.fraser
Priority: P2 Keywords: InRadar
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
patch
none
patch that builds simon.fraser: review+

Description Tim Horton 2014-03-18 19:25:36 PDT
ViewGestureController::handleScrollWheelEvent properly bails in a wide variety of cases, but wheelEventWasNotHandledByWebCore does not, so we can pick up a wheel event that was rejected by the web process (and would have been rejected by the checks in handleScrollWheelEvent) and use it to start tracking a swipe.

One of the cases we check in handleScrollWheelEvent is that the horizontal delta is bigger; since we don't check this in wheelEventWasNotHandledByWebCore, we can start tracking a swipe from an event with a predominantly vertical delta, which results in the swipe tracking vertical movement instead of horizontal movement.

We should factor out all of the cases and check in both places.

<rdar://problem/16337279>
Comment 1 Tim Horton 2014-03-18 19:35:37 PDT
Created attachment 227147 [details]
patch
Comment 2 Tim Horton 2014-03-18 20:46:58 PDT
Created attachment 227152 [details]
patch that builds
Comment 3 Simon Fraser (smfr) 2014-03-19 10:45:15 PDT
Comment on attachment 227152 [details]
patch that builds

View in context: https://bugs.webkit.org/attachment.cgi?id=227152&action=review

> Source/WebKit2/UIProcess/mac/ViewGestureControllerMac.mm:267
>      if (!event.hasPreciseScrollingDeltas)
>          return false;
>  
>      if (![NSEvent isSwipeTrackingFromScrollEventsEnabled])
>          return false;

Would be cheaper to do these early returns sooner.

> Source/WebKit2/UIProcess/mac/ViewGestureControllerMac.mm:279
> +    m_hasPendingSwipe = false;

Does this need to be cleared before the previous return?
Comment 4 Tim Horton 2014-03-19 10:57:45 PDT
http://trac.webkit.org/changeset/165903