[webkit-changes] [WebKit/WebKit] 0f118a: REGRESSION (262853 at main): Text selection sometimes...

Wenson Hsieh noreply at github.com
Tue May 9 15:32:12 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 0f118a09c40eacfb6d7ca0e8370486b10b3c6cce
      https://github.com/WebKit/WebKit/commit/0f118a09c40eacfb6d7ca0e8370486b10b3c6cce
  Author: Wenson Hsieh <wenson_hsieh at apple.com>
  Date:   2023-05-09 (Tue, 09 May 2023)

  Changed paths:
    A LayoutTests/editing/selection/ios/no-click-event-when-adjusting-selection-handles-expected.txt
    A LayoutTests/editing/selection/ios/no-click-event-when-adjusting-selection-handles.html
    M Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm

  Log Message:
  -----------
  REGRESSION (262853 at main): Text selection sometimes disappears after interacting with selection handles
https://bugs.webkit.org/show_bug.cgi?id=256542
rdar://108200433

Reviewed by Aditya Keerthi.

This is more fallout from the changes in 262853 at main, which made pan gestures recognize alongside
the synthetic tap gesture; after that commit, the pan gesture for adjusting selection handles —
`UITextRangeAdjustmentGestureRecognizer` — no longer prevents the synthetic tap gesture from firing
when adjusting selection handles by panning over very short distances (i.e., under the 45pt maximum
allowable movement threshold for recognizing tap gestures).

When performing a pan gesture in this manner on a selection handle over any element with a click
event listener, this causes the selection to collapse as the synthetic click is sent to the page and
sets the selection to a caret at the tap location.

The original intent behind the changes in 262853 at main was to allow tap gestures to recognize
alongside scroll view pan gestures only, so this is merely a result of that logic being overly
aggressive. Instead of allowing simultaneous recognition with all pan gestures, we fix this by
limiting it to system scroll view pan gestures only.

Test: editing/selection/ios/no-click-event-when-adjusting-selection-handles.html

* LayoutTests/editing/selection/ios/no-click-event-when-adjusting-selection-handles-expected.txt: Added.
* LayoutTests/editing/selection/ios/no-click-event-when-adjusting-selection-handles.html: Added.
* Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm:
(isBuiltInScrollViewPanGestureRecognizer):
(isBuiltInScrollViewGestureRecognizer):

Pull functionality to check whether or not a given gesture recognizer is a built-in scroll view pan
gesture out into a separate helper method; also, optimize this code slightly by caching the result
of the dynamic `NSString` -> `Class` lookup in static variables.

(-[WKContentView gestureRecognizer:shouldRecognizeSimultaneouslyWithGestureRecognizer:]):

Replace the "is pan gesture" check with a more targeted "is built-in scroll view pan gesture" check.
See above for more details.

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




More information about the webkit-changes mailing list