Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 9549253a0e1f4ce655aedfa7e140264cae70e298
https://github.com/WebKit/WebKit/commit/9549253a0e1f4ce655aedfa7e140264cae70e298
Author: Wenson Hsieh <[email protected]>
Date: 2024-09-30 (Mon, 30 Sep 2024)
Changed paths:
M Source/WTF/Scripts/Preferences/UnifiedWebPreferences.yaml
M Source/WebCore/rendering/RenderLayerScrollableArea.h
M Source/WebKit/Shared/EditorState.h
M Source/WebKit/Shared/EditorState.serialization.in
M Source/WebKit/UIProcess/ios/WKBaseScrollView.h
M Source/WebKit/UIProcess/ios/WKBaseScrollView.mm
M Source/WebKit/UIProcess/ios/WKContentViewInteraction.h
M Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm
M Source/WebKit/UIProcess/ios/WKTextInteractionWrapper.h
M Source/WebKit/UIProcess/ios/WKTextInteractionWrapper.mm
M Source/WebKit/WebProcess/WebPage/WebPage.cpp
M Source/WebKit/WebProcess/WebPage/WebPage.h
M Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm
Log Message:
-----------
[iOS] Add support for rendering native selection UI inside scrolled content
https://bugs.webkit.org/show_bug.cgi?id=280591
Reviewed by Richard Robinson.
Work towards refactoring selection rendering on iOS, such that native selection
UI (e.g. highlight,
caret, etc.) isn't limited to being installed in `WKContentView`.
* Source/WTF/Scripts/Preferences/UnifiedWebPreferences.yaml:
Add a new runtime preference to make it easier to switch between the new and
old selection behavior.
* Source/WebCore/rendering/RenderLayerScrollableArea.h:
* Source/WebKit/Shared/EditorState.h:
* Source/WebKit/Shared/EditorState.serialization.in:
Plumb the `ScrollingNodeID` of the scrollable area containing the selection
through `EditorState`,
into the UI process.
* Source/WebKit/UIProcess/ios/WKBaseScrollView.h:
* Source/WebKit/UIProcess/ios/WKBaseScrollView.mm:
(-[WKBaseScrollView scrolledContentView]):
Add a helper property to grab the scrolled content view for the scroll view
(i.e. a non-empty
`WKCompositingView` or `WKContentView` under a child or main scroll view,
respectively).
* Source/WebKit/UIProcess/ios/WKContentViewInteraction.h:
* Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView selectionHonorsOverflowScrolling]):
(-[WKContentView _updateChangedSelection:]):
Call `-prepareToMoveSelectionContainer:` when the selection changes visually
(see below).
(-[WKContentView _selectionContainerViewAboveText]):
(-[WKContentView selectionContainerView]):
Implement `-_selectionContainerViewAboveText` and `-selectionContainerView`
(both currently SPI) and
return the scrolled contents corresponding to the scroller that currently
contains the selection.
Also, add a FIXME to adopt the public API (when it becomes available) and leave
behind a call to
`RELEASE_ASSERT_ASYNC_TEXT_INTERACTIONS_DISABLED()` after adoption.
(-[WKContentView _selectionContainerViewInternal]):
* Source/WebKit/UIProcess/ios/WKTextInteractionWrapper.h:
* Source/WebKit/UIProcess/ios/WKTextInteractionWrapper.mm:
(-[WKTextInteractionWrapper textSelectionDisplayInteraction]):
(-[WKTextInteractionWrapper prepareToMoveSelectionContainer:]):
(Indirectly) tell the text selection display interaction to remove and reparent
all managed
selection UI views when the selection container view changes. When the new
behavior is disabled
(i.e. on shipping iOS) this is going to always be `WKContentView`; however, it
may change between a
`WKCompositingView` and the content view when the flag is set, depending on
whether the selection is
inside of a scrollable region.
(-[WKTextInteractionWrapper activateSelection]):
(-[WKTextInteractionWrapper deactivateSelection]):
(-[WKTextInteractionWrapper willStartScrollingOverflow]):
(-[WKTextInteractionWrapper didEndScrollingOverflow]):
Don't hide and reveal the selection in the case where the new behavior is
enabled. This is no longer
necessary, since the selection will now simply scroll along with the content,
instead of appearing
in the wrong place.
* Source/WebKit/WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::updatePreferences):
* Source/WebKit/WebProcess/WebPage/WebPage.h:
* Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm:
(WebKit::WebPage::computeSelectionClipRect const):
Make this additionally compute the enclosing scrolling node ID, along with the
selection clip rect.
Once the feature flag is enabled and this behavior becomes the default, this
should be renamed to
something like `computeEnclosingNodeIDForSelection` (and the selection clip
rect computation should
be moved back out to the call site).
Note that we don't set the `selectionClipRect` when selection views honor
overflow scrolling,
because the selection will be clipped by overflow scrolling with or without the
rect.
Canonical link: https://commits.webkit.org/284461@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes