Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 47c187746bfd9d27268db18e105f30c6f0cdfa9e
      
https://github.com/WebKit/WebKit/commit/47c187746bfd9d27268db18e105f30c6f0cdfa9e
  Author: Ryosuke Niwa <[email protected]>
  Date:   2026-08-05 (Wed, 05 Aug 2026)

  Changed paths:
    M Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm
    M Tools/TestWebKitAPI/Helpers/cocoa/TestWKWebView.h
    M Tools/TestWebKitAPI/Helpers/cocoa/TestWKWebView.mm
    M Tools/TestWebKitAPI/Tests/WebKit/WKWebView/SiteIsolation.mm

  Log Message:
  -----------
  [Site Isolation] [iOS] Selection loupe slides in from the iframe edge in a 
cross-origin iframe
https://bugs.webkit.org/show_bug.cgi?id=321044

Reviewed by Wenson Hsieh, Abrar Rahman Protyasha, and Megan Gardner.

When text is selected inside a cross-origin (site-isolated) iframe on iOS, the 
selection loupe
was mispositioned: instead of appearing at the caret it animated in from the 
top or bottom edge
of the iframe (the offset scaling with the subframe's scroll position).

When selectionHonorsOverflowScrolling is enabled, WKContentView presents the 
selection -- and
the loupe -- inside the enclosing overflow-scroll layer, converting the 
selection rects into
that container's coordinate space (see -[WKContentView 
_selectionContainerViewInternal] and
selectionRect:convertQuadToSelectionContainer:). For a cross-origin subframe 
that enclosing
layer is the subframe's remote-hosted, scrolled layer, but WebKit reports the 
selection rects
in main-frame (root-view) coordinates. Presenting main-frame-coordinate rects 
relative to the
subframe's scrolled layer positioned the loupe relative to the iframe's layer 
origin, so it
slid in from the iframe edge.

The overflow-scroll selection container assumes a same-process scroller whose 
layer the rects
are relative to, which does not hold across the site-isolation process 
boundary. Use the
WKContentView as the selection container when the selection's root frame is not 
the main frame.

Test: SiteIsolation.SelectionInCrossOriginIframeIsContainedByContentView

* Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView _selectionContainerViewInternal]): Return self when the 
selection is in
a cross-origin subframe (visualData.rootFrameID is not the main frame).
* Tools/TestWebKitAPI/Tests/WebKit/WKWebView/SiteIsolation.mm:
(TestWebKitAPI::(SiteIsolation, 
SelectionInCrossOriginIframeIsContainedByContentView)):
* Tools/TestWebKitAPI/Helpers/cocoa/TestWKWebView.h:
* Tools/TestWebKitAPI/Helpers/cocoa/TestWKWebView.mm:
(-[TestWKWebView selectionHighlightView]): Added.

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



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications

Reply via email to