Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 24695173a4730b85e71afe36c9b6420b352aa130
      
https://github.com/WebKit/WebKit/commit/24695173a4730b85e71afe36c9b6420b352aa130
  Author: Cole Carley <[email protected]>
  Date:   2026-09-23 (Wed, 23 Sep 2026)

  Changed paths:
    M Source/WebCore/editing/cocoa/DictionaryLookup.mm
    M Source/WebCore/page/TextIndicator.cpp
    M Source/WebCore/page/TextIndicator.h
    M Source/WebKit/Shared/WebCoreArgumentCoders.serialization.in
    M Source/WebKit/UIProcess/API/Cocoa/WKWebViewPrivateForTesting.h
    M Source/WebKit/UIProcess/API/Cocoa/WKWebViewTesting.mm
    M Source/WebKit/UIProcess/Cocoa/WebPageProxyCocoa.mm
    M Source/WebKit/UIProcess/WebPageProxy.cpp
    M Source/WebKit/UIProcess/WebPageProxy.h
    M Source/WebKit/WebProcess/Plugins/PDF/PDFPlugin.mm
    M Source/WebKit/WebProcess/Plugins/PDF/UnifiedPDF/UnifiedPDFPlugin.mm
    M Source/WebKit/WebProcess/WebPage/FindController.cpp
    M Source/WebKit/WebProcess/WebPage/FindIndicator.cpp
    M Source/WebKit/WebProcess/WebPage/WebPage.cpp
    M Source/WebKit/WebProcess/WebPage/WebPage.messages.in
    M Source/WebKit/WebProcess/WebPage/ios/FindIndicatorIOS.cpp
    M Source/WebKitLegacy/mac/WebView/WebView.mm
    M Tools/TestWebKitAPI/Tests/WebKit/WKWebView/SiteIsolation.mm

  Log Message:
  -----------
  [Site Isolation] TextIndicator is positioned incorrectly for matches in 
cross-origin iframes
https://bugs.webkit.org/show_bug.cgi?id=324913
rdar://188138407

Reviewed by Ryosuke Niwa.

In a site-isolated cross-origin iframe, TextIndicator rects were computed with
contentsToRootView(), which is relative to the iframe's local root rather than 
the
main frame. The UI process then tried to fix this up with 
convertRectToMainFrameCoordinates(),
which didn't account for everything (e.g. obscured content insets), so the 
indicator
was drawn in the wrong place.

This patch computes the rects with contentsToMainFrameView() in the web process 
instead,
and removes the UI-process conversion in setTextIndicatorFromFrame() and
updateTextIndicatorFromFrame(). For that conversion to be correct, every web 
content
process now receives the obscured content insets, not just the main frame's 
process.
FindController's staleness check in drawRect() uses the same coordinate space 
so it
stays consistent with the indicator's selection rect.

Test: Tools/TestWebKitAPI/Tests/WebKit/WKWebView/SiteIsolation.mm

* Source/WebCore/page/TextIndicator.cpp:
(WebCore::initializeIndicator):
* Source/WebKit/UIProcess/API/Cocoa/WKWebViewPrivateForTesting.h:
* Source/WebKit/UIProcess/API/Cocoa/WKWebViewTesting.mm:
(-[WKWebView _textIndicatorBoundingRectForTesting]):
* Source/WebKit/UIProcess/Cocoa/WebPageProxyCocoa.mm:
(WebKit::WebPageProxy::setTextIndicatorFromFrame):
(WebKit::WebPageProxy::updateTextIndicatorFromFrame):
* Source/WebKit/UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::setObscuredContentInsets):
* Source/WebKit/UIProcess/WebPageProxy.h:
* Source/WebKit/WebProcess/WebPage/FindController.cpp:
(WebKit::FindController::drawRect):
* Source/WebKit/WebProcess/WebPage/WebPage.messages.in:
* Tools/TestWebKitAPI/Tests/WebKit/WKWebView/SiteIsolation.mm:
(TestWebKitAPI::findIndicatorRectInIsolatedIframe):
(TestWebKitAPI::TEST(SiteIsolation, 
FindStringIndicatorPositionInIsolatedIframe)):
(TestWebKitAPI::TEST(SiteIsolation, 
FindStringIndicatorPositionWithScrolledMainFrame)):
(TestWebKitAPI::TEST(SiteIsolation, 
FindStringIndicatorPositionWithObscuredContentInsets)):
(TestWebKitAPI::TEST(SiteIsolation, 
FindStringIndicatorPositionWithObscuredContentInsetsChangedAfterLoad)):

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



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

Reply via email to