Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 27e3e70bdb667dcd220ea1f2f45cbfc2b70e78be
      
https://github.com/WebKit/WebKit/commit/27e3e70bdb667dcd220ea1f2f45cbfc2b70e78be
  Author: Wenson Hsieh <[email protected]>
  Date:   2025-04-17 (Thu, 17 Apr 2025)

  Changed paths:
    A 
LayoutTests/editing/selection/ios/selection-covers-composited-layers-expected.txt
    A LayoutTests/editing/selection/ios/selection-covers-composited-layers.html
    M Source/WebCore/rendering/RenderLayerBacking.h
    M Source/WebKit/UIProcess/ios/UIKitUtilities.h
    M Source/WebKit/UIProcess/ios/UIKitUtilities.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/ios/WebPageIOS.mm

  Log Message:
  -----------
  [iOS] [SelectionHonorsOverflowScrolling] bing.com: Text selection UI appears 
behind link cards in search results
https://bugs.webkit.org/show_bug.cgi?id=291705
rdar://149242162

Reviewed by Abrar Rahman Protyasha.

When making a text selection that spans across (and contains) multiple 
composited layers, we
currently host the selection views inside the composited layer that's the 
common ancestor of the
selection start and end points, at a subview index that's right after the tile 
grid container view.
While this means that the selection will be correctly occluded by any 
positioned layers that should
cover the selection, it also means that the selection might be incorrectly 
occluded by content
contained in the selection itself.

To fix this, build off of the work in https://webkit.org/b/291663 by using the 
platform layer IDs of
layers that (may) contain the selection, to insert UIKit's managed selection 
views *after* all such
views in the compositing view hierarchy.

* 
LayoutTests/editing/selection/ios/selection-covers-composited-layers-expected.txt:
 Added.
* LayoutTests/editing/selection/ios/selection-covers-composited-layers.html: 
Added.

Add a layout test to exercise the change, by verifying that the selection shows 
up on top of the
composited layer.

* Source/WebCore/rendering/RenderLayerBacking.h:
* Source/WebKit/UIProcess/ios/UIKitUtilities.h:
* Source/WebKit/UIProcess/ios/UIKitUtilities.mm:
(-[UIView _wk_previousSibling]):

Add a helper method to grab the sibling view immediately before this `UIView` 
(or `nil`) if this
view is either unparented or the first subview in its parent.

* Source/WebKit/UIProcess/ios/WKContentViewInteraction.h:
* Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView cleanUpInteraction]):
(-[WKContentView _updateChangedSelection:]):
(-[WKContentView _siblingBeforeSelectionHighlight]):

Add logic to keep track of the last previous sibling before the selection 
highlight view; we use
this information to detect when a new composited layer is inserted before the 
selection views, and
reinsert the managed selection views in the view hierarchy if needed. Without 
this adjustment, fixed
position containers that are added to the DOM after a selection is already 
created (e.g. when
scrolling down the page on bing.com) will be incorrectly occluded by the 
selection, until the user
adjusts the selection range.

* Source/WebKit/UIProcess/ios/WKTextInteractionWrapper.h:
* Source/WebKit/UIProcess/ios/WKTextInteractionWrapper.mm:
(-[WKTextInteractionWrapper selectionHighlightView]):
(-[WKTextInteractionWrapper prepareToMoveSelectionContainer:]):

See above for more details.

* Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm:
(WebKit::WebPage::computeEnclosingLayerID const):

Use the `Page TiledBacking containment` view to host selection views; this 
allows us to slot the
hosted selection views *after* all composited views that may contain part of 
the selection.

Canonical link: https://commits.webkit.org/293843@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

Reply via email to