[webkit-changes] [WebKit/WebKit] 105e0f: REGRESSION (266610 at main): Download alert doesn’t r...

Wenson Hsieh noreply at github.com
Thu Oct 5 22:21:29 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 105e0f1e80b0e8ff0be61f05cf8dd6e3f3926cb5
      https://github.com/WebKit/WebKit/commit/105e0f1e80b0e8ff0be61f05cf8dd6e3f3926cb5
  Author: Wenson Hsieh <wenson_hsieh at apple.com>
  Date:   2023-10-05 (Thu, 05 Oct 2023)

  Changed paths:
    M Source/WebKit/UIProcess/ios/WKMouseInteraction.mm
    M Tools/TestWebKitAPI/Tests/WebKitCocoa/iOSMouseSupport.mm

  Log Message:
  -----------
  REGRESSION (266610 at main): Download alert doesn’t respond to trackpad clicks until after pointer hides
https://bugs.webkit.org/show_bug.cgi?id=262752
rdar://116206313

Reviewed by Megan Gardner.

After the refactoring in 266610 at main, `WKMouseGestureRecognizer` was split into three total
gestures: two to passively observe mouse and pencil hover, and `WKMouseTouchGestureRecognizer`,
which observes mouse events while the mouse is down. Currently, this mouse touch gesture remains in
`Possible` state while receiving pointer events (i.e. `-touches*:withEvent:`). This means that if
any other pointer-only gesture has failure requirements to this gesture, it could be blocked
indefinitely while waiting for the subgraph to reset.

When clicking on a download link, Safari overlays native alert UI which obscures the entire web
view. Prior to the above refactoring, we would receive a call to the SPI method `-_hoverExited:`
when the user moves their mouse over the dialog, causing us to immediately transition the gesture to
Ended state. This no longer happens, since we stopped relying on that SPI hook. As a result, other
pointer gestures that have failure requirements to `WKMouseTouchGestureRecognizer` get stuck waiting
for a reset that never happens.

Fix this by transitioning the `WKMouseTouchGestureRecognizer` through the normal gesture recognizer
states under the touch event subclassing hooks: `Began` upon beginning touches, `Changed` when
dragging, and `Cancelled` or `Ended` upon releasing the mouse (or otherwise cancelling the pointer
interaction).

Note that we can end `WKMouseTouchGestureRecognizer` upon mouseup (as opposed to how the former
`WKMouseGestureRecognizer` only transitioned to Ended after exiting the view), since the new class
only needs to recognize while the pointer is down.

* Source/WebKit/UIProcess/ios/WKMouseInteraction.mm:
(-[WKMouseTouchGestureRecognizer touchesBegan:withEvent:]):
(-[WKMouseTouchGestureRecognizer touchesMoved:withEvent:]):
(-[WKMouseTouchGestureRecognizer touchesEnded:withEvent:]):
(-[WKMouseTouchGestureRecognizer touchesCancelled:withEvent:]):

Add state transitions; see above for more information.

(-[WKMouseInteraction initWithDelegate:]):

Drive-by fix: also give these gestures more descriptive names, to make descriptions more informative
when logging (and also so that the API test harness below can find `WKMouseTouchGestureRecognizer`).

* Tools/TestWebKitAPI/Tests/WebKitCocoa/iOSMouseSupport.mm:
(TestWebKitAPI::MouseEventTestHarness::MouseEventTestHarness):
(TestWebKitAPI::MouseEventTestHarness::mouseMove):
(TestWebKitAPI::MouseEventTestHarness::mouseDown):
(TestWebKitAPI::MouseEventTestHarness::mouseUp):
(TestWebKitAPI::MouseEventTestHarness::mouseCancel):

Refactor the test harness so that it calls into `UIGestureRecognizer` delegate methods when
simulating `mouseDown` or `mouseUp`, and additionally assert gesture recognizer states after doing
so.

(TestWebKitAPI::MouseEventTestHarness::activeTouches const):

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




More information about the webkit-changes mailing list