[webkit-changes] [WebKit/WebKit] 0fa3ad: [iOS] Prevent navigation transition swipe gestures...

Wenson Hsieh noreply at github.com
Mon Feb 10 20:21:11 PST 2025


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 0fa3ad653470b5fa739117073187ad54d3c974f7
      https://github.com/WebKit/WebKit/commit/0fa3ad653470b5fa739117073187ad54d3c974f7
  Author: Wenson Hsieh <wenson_hsieh at apple.com>
  Date:   2025-02-10 (Mon, 10 Feb 2025)

  Changed paths:
    M Source/WebKit/UIProcess/PageClient.h
    M Source/WebKit/UIProcess/ViewGestureController.cpp
    M Source/WebKit/UIProcess/ViewGestureController.h
    M Source/WebKit/UIProcess/WebPageProxy.cpp
    M Source/WebKit/UIProcess/WebPageProxy.h
    M Source/WebKit/UIProcess/gtk/ViewGestureControllerGtk.cpp
    M Source/WebKit/UIProcess/ios/PageClientImplIOS.h
    M Source/WebKit/UIProcess/ios/PageClientImplIOS.mm
    M Source/WebKit/UIProcess/ios/ViewGestureControllerIOS.mm
    M Source/WebKit/UIProcess/ios/WKContentViewInteraction.h
    M Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm

  Log Message:
  -----------
  [iOS] Prevent navigation transition swipe gestures from taking precedence over scrolling pan gestures
https://bugs.webkit.org/show_bug.cgi?id=287437
rdar://115613321

Reviewed by Abrar Rahman Protyasha and Aditya Keerthi.

Prevent certain types of horizontal navigation swipe gestures from starting in two scenarios:

- A child scroller underneath the user's current touch is being scrolled via a pan gesture.
- The page has `touch-action: none;` under the current touch location.

See below for more details.

* Source/WebKit/UIProcess/PageClient.h:
(WebKit::PageClient::canStartNavigationSwipeAtLastInteractionLocation const):
* Source/WebKit/UIProcess/ViewGestureController.cpp:
(WebKit::ViewGestureController::canSwipeInDirection const):

If the new `DeferToConflictingGestures` flag is set, additionally consult `WebPageProxy` via
`canStartNavigationSwipeAtLastInteractionLocation`, to determine whether the navigation swipe
gesture should commence.

(WebKit::ViewGestureController::PendingSwipeTracker::scrollEventCanBecomeSwipe):
* Source/WebKit/UIProcess/ViewGestureController.h:
* Source/WebKit/UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::canStartNavigationSwipeAtLastInteractionLocation const):
* Source/WebKit/UIProcess/WebPageProxy.h:
* Source/WebKit/UIProcess/gtk/ViewGestureControllerGtk.cpp:
* Source/WebKit/UIProcess/ios/PageClientImplIOS.h:
* Source/WebKit/UIProcess/ios/PageClientImplIOS.mm:
(WebKit::PageClientImpl::canStartNavigationSwipeAtLastInteractionLocation const):

Add page -> page client -> content view plumbing, so that we can ask the content view whether or not
we can start a navigation swipe at the last interaction location without running into conflicts with
either the page (via `touch-action`) or subscrollable areas.

* Source/WebKit/UIProcess/ios/ViewGestureControllerIOS.mm:
(-[WKSwipeTransitionController shouldBeginInteractiveTransition:]):

Defer to conflicting pan gestures only if the edge swipe gesture recognizer is in Failed state. This
ensures that the edge swipe gesture continues to take precedence over other types of pan gestures or
`touch-action: none;` in the case where the user is actually swiping from the edge of the screen.

(interactiveTransitionGestureRecognizerClass):
(-[WKSwipeTransitionController gestureRecognizerForInteractiveTransition:WithTarget:action:]):
(-[WKSwipeTransitionController isNavigationSwipeGestureRecognizer:]):
(WebKit::ViewGestureController::beginSimulatedSwipeInDirectionForTesting):
* Source/WebKit/UIProcess/ios/WKContentViewInteraction.h:
* Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView _canStartNavigationSwipeAtLastInteractionLocation]):

Add a helper method that checks:

-   Whether there are any subscrollable areas that are actively being scrolled via pan gesture,
    under the last interaction location.

-   Whether the CSS `touch-actions` under the last interaction location would allow for built-in
    horizontal pan gestures.

Canonical link: https://commits.webkit.org/290196@main



To unsubscribe from these emails, change your notification settings at https://github.com/WebKit/WebKit/settings/notifications


More information about the webkit-changes mailing list