[webkit-changes] [WebKit/WebKit] 192709: Stop using -[UITextInteractionAssistant inGesture]...

Wenson Hsieh noreply at github.com
Sat Oct 7 11:09:51 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 1927094ca4e021e490dfb3018c7d31a202cb52ff
      https://github.com/WebKit/WebKit/commit/1927094ca4e021e490dfb3018c7d31a202cb52ff
  Author: Wenson Hsieh <wenson_hsieh at apple.com>
  Date:   2023-10-07 (Sat, 07 Oct 2023)

  Changed paths:
    M Source/WebKit/Platform/spi/ios/UIKitSPI.h
    M Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm
    M Tools/TestWebKitAPI/Tests/ios/UIWKInteractionViewProtocol.mm

  Log Message:
  -----------
  Stop using -[UITextInteractionAssistant inGesture] and -[UITextInteraction inGesture]
https://bugs.webkit.org/show_bug.cgi?id=262833

Reviewed by Megan Gardner and Abrar Rahman Protyasha.

Remove uses of `-[UITextInteractionAssistant inGesture]` and `-[UITextInteraction inGesture]`. We
currently use these methods to deduce whether `-updateSelectionWithExtentPoint:completionHandler:`
is being triggered by the floating cursor (i.e., when long pressing on the space bar in the software
keyboard while holding the shift key). From testing on iOS 17, the other ways to exercise this
codepath (outside of holding shift while using floating cursor) are:

• Shift-tapping to extend a selection.
• Shift-clicking with a trackpad to extend a selection.

We can distinguish these two cases from the floating cursor case by consulting gesture recognizer
state instead; that is, if any of the following gestures are in Began, Ended or Changed state while
updating the selection with an extent point:

• Text interaction variable delay loupe gesture.
• Text interaction multi-tap gesture.
• Mouse click gesture (`WKMouseTouchGestureRecognizer`).

...then we can assume that the selection is being changed by one of the above interactions;
otherwise, it's probably due to using the floating cursor.

* Source/WebKit/Platform/spi/ios/UIKitSPI.h:
* Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView updateSelectionWithExtentPoint:completionHandler:]):
(-[UITextInteractionAssistant _wk_hasFloatingCursor]): Deleted.
* Tools/TestWebKitAPI/Tests/ios/UIWKInteractionViewProtocol.mm:
(TestWebKitAPI::TEST):

Adjust a test to simulate mouse clicks before calling `-updateSelectionWithExtentPoint:`.

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




More information about the webkit-changes mailing list