[webkit-changes] [WebKit/WebKit] 347a3c: [iOS] Text selection is lost if right clicking at ...

Richard Robinson noreply at github.com
Sat Apr 29 18:03:44 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 347a3c86979f5d5873d85587fa1d7e78b75106ec
      https://github.com/WebKit/WebKit/commit/347a3c86979f5d5873d85587fa1d7e78b75106ec
  Author: Richard Robinson <richard_robinson2 at apple.com>
  Date:   2023-04-29 (Sat, 29 Apr 2023)

  Changed paths:
    M Source/WebCore/editing/FrameSelection.h
    M Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm
    M Tools/TestWebKitAPI/Tests/WebKitCocoa/iOSMouseSupport.mm

  Log Message:
  -----------
  [iOS] Text selection is lost if right clicking at end of selection
https://bugs.webkit.org/show_bug.cgi?id=256126
rdar://105737822

Reviewed by Wenson Hsieh.

In WebKit, a point is considered to be inside a selection if the boundary point created from the
point is within the boundary points of the selection range, inclusive. For example, with the text
"Hello" and a selection of "Hell", if the point is slightly to the left of the middle of the "o",
the boundary point of the point is considered to be the same as the boundary point of the end of
the selection.

On macOS, when right clicking at the end of a selection, if the clicked point is considered to be
"inside" the selection, a new selection is not created. However, for iOS, there is no such mechanism
to check this, so a new selection is always created, which is unexpected behavior if the click is
still "inside" the existing selection.

This PR fixes this by implementing this check on iOS.

* Source/WebCore/editing/FrameSelection.h:
* Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm:
(WebKit::WebPage::prepareSelectionForContextMenuWithLocationInView):
* Tools/TestWebKitAPI/Tests/WebKitCocoa/iOSMouseSupport.mm:
(simulateEditContextMenuAppearance):
(TEST):

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




More information about the webkit-changes mailing list