Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 8c423827078839d00eabdd9f4a0266d1a2112a79
      
https://github.com/WebKit/WebKit/commit/8c423827078839d00eabdd9f4a0266d1a2112a79
  Author: Wenson Hsieh <wenson_hs...@apple.com>
  Date:   2024-10-01 (Tue, 01 Oct 2024)

  Changed paths:
    M Source/WebKit/Shared/EditorState.cpp
    M Source/WebKit/Shared/EditorState.h
    M Source/WebKit/Shared/EditorState.serialization.in
    M Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm
    M Source/WebKit/WebProcess/WebPage/Cocoa/WebPageCocoa.mm
    M Source/WebKit/WebProcess/WebPage/WebPage.h
    M Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm

  Log Message:
  -----------
  [iOS] Selection is unnecessarily clipped in overflow scrolling areas when 
SelectionHonorsOverflowScrolling is enabled
https://bugs.webkit.org/show_bug.cgi?id=280702

Reviewed by Abrar Rahman Protyasha.

Continue to refactor UIKit-based text selection rendering on iOS. This patch 
avoids propagating
`selectionClipRect` to the UI process, in the case where clipping can be 
entirely handled by an
enclosing platform scroll view. Notably, we still need to compute and send a 
`selectionClipRect` in
the case where the selection is inside of a single line text field which is 
scrollable in the inline
direction, but doesn't correspond to a native scroll view.

See below for more details.

* Source/WebKit/Shared/EditorState.cpp:
(WebKit::operator<<):
(WebKit::EditorState::clipOwnedRectExtentsToNumericLimits):
* Source/WebKit/Shared/EditorState.h:
* Source/WebKit/Shared/EditorState.serialization.in:

Add a separate member that represents the bounds of the editable root which 
contains the selection.
Currently, there are a couple of places in `WKContentViewInteraction` that use 
`selectionClipRect`
interchangeably with the bounds of the root editable container. 
`SelectionHonorsOverflowScrolling`
breaks this assumption, because the selection clip rect is now empty in an 
unscrollable text field.

* Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView gestureRecognizerShouldBegin:]):
(-[WKContentView _updateSelectionAssistantSuppressionState]):

See above comment.

* Source/WebKit/WebProcess/WebPage/Cocoa/WebPageCocoa.mm:
(WebKit::WebPage::getPlatformEditorStateCommon const):

Refactor this to compute and pass in `editableRootBounds` separately, when 
computing the selection
clip rect. Also rename `computeSelectionClipRect` to 
`computeSelectionClipRectAndEnclosingScroller`
to reflect its new responsibilities.

* Source/WebKit/WebProcess/WebPage/WebPage.h:
* Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm:
(WebKit::enclosingScroller):
(WebKit::forEachEnclosingScroller):

Refactor this code so that we're able to walk up the render tree by 
`container()`, and visit
scrollable areas until we find one with a corresponding scrolling node, instead 
of stopping at the
first scrollable area (which may not have a scrolling node ID). This allows us 
to detect the case
where the selection's immediate scrollable container does not map to a node in 
the scrolling tree,
but there's another enclosing scroller wherein the selection should be 
parented. In this case, we
want to still install the selection views inside of the enclosing scroll view, 
but we still need to
set a selection clip rect that clamps the selection to the immediate scrollable 
area (for instance,
a text field with enough content to require scrolling).

(WebKit::WebPage::computeSelectionClipRectAndEnclosingScroller const):
(WebKit::WebPage::computeSelectionClipRect const): Deleted.

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



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to