Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 8c52c9461526901f003fb6f8482c42d7f8cabca9
https://github.com/WebKit/WebKit/commit/8c52c9461526901f003fb6f8482c42d7f8cabca9
Author: Cole Carley <[email protected]>
Date: 2025-12-03 (Wed, 03 Dec 2025)
Changed paths:
M Source/WebCore/page/Frame.cpp
M Source/WebCore/page/Frame.h
M Source/WebCore/page/Page.cpp
M Source/WebCore/page/Page.h
M Source/WebKit/Shared/WebFoundTextRange.cpp
M Source/WebKit/Shared/WebFoundTextRange.h
M Source/WebKit/Shared/WebFoundTextRange.serialization.in
M Source/WebKit/UIProcess/WebFrameProxy.cpp
M Source/WebKit/UIProcess/WebFrameProxy.h
M Source/WebKit/UIProcess/WebPageProxy.cpp
M Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm
M Source/WebKit/WebProcess/WebPage/WebFoundTextRangeController.cpp
M Tools/TestRunnerShared/spi/UIKitSPIForTesting.h
M Tools/TestWebKitAPI/Tests/WebKitCocoa/FindInPage.mm
M Tools/TestWebKitAPI/Tests/WebKitCocoa/FindInPageUtilities.h
M Tools/TestWebKitAPI/Tests/WebKitCocoa/FindInPageUtilities.mm
M Tools/TestWebKitAPI/Tests/WebKitCocoa/SiteIsolation.mm
Log Message:
-----------
Fix UITextSearching protocol functions in site isolation
https://bugs.webkit.org/show_bug.cgi?id=302986
rdar://165243794
Reviewed by Sihui Liu and Alex Christensen.
This patch fixes issues with the `UITextSearching` protocol
in site isolation.
It fixes `replaceFoundTextInRange`, `decorateFoundTextRange`,
`scrollRangeToVisible`, `clearAllDecoratedFoundText`, and
`requestRectForFoundTextRange` in site isolation.
The main problem is that a client can search for string in
one WebView and then highlight or replace or scroll in another
that is hosting the same content. We address this issue by storing
the path from the mainFrame to the frame in which the match was
found on each WebFoundTextRange.
This way, we can traverse the frame tree for each
WebFoundTextRange and find, positionally, which frame the range
was found in. This means we do not have to store the frameIdentifier,
which will be different between WebViews.
* Source/WebCore/page/Frame.cpp:
(WebCore::Frame::indexInFrameTreeSiblings const):
(WebCore::Frame::pathToFrame const):
* Source/WebCore/page/Frame.h:
* Source/WebCore/page/Page.cpp:
(WebCore::Page::findFrameByPath const):
* Source/WebCore/page/Page.h:
* Source/WebKit/Shared/WebFoundTextRange.cpp:
(WebKit::WebFoundTextRange::operator== const):
(WebKit::operator<<):
* Source/WebKit/Shared/WebFoundTextRange.h:
(WTF::HashTraits<WebKit::WebFoundTextRange>::constructDeletedValue):
(WTF::HashTraits<WebKit::WebFoundTextRange>::isDeletedValue):
* Source/WebKit/Shared/WebFoundTextRange.serialization.in:
* Source/WebKit/UIProcess/WebFrameProxy.cpp:
(WebKit::WebFrameProxy::childFrame const):
* Source/WebKit/UIProcess/WebFrameProxy.h:
* Source/WebKit/UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::replaceFoundTextRangeWithString):
(WebKit::WebPageProxy::scrollTextRangeToVisible):
(WebKit::WebPageProxy::clearAllDecoratedFoundText):
(WebKit::WebPageProxy::didBeginTextSearchOperation):
(WebKit::WebPageProxy::requestRectForFoundTextRange):
* Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm:
(+[WKFoundTextRange foundTextRangeWithWebFoundTextRange:]):
(-[WKFoundTextRange dealloc]):
(-[WKFoundDOMTextRange webFoundTextRange]):
(-[WKFoundPDFTextRange webFoundTextRange]):
* Source/WebKit/WebProcess/WebPage/WebFoundTextRangeController.cpp:
(WebKit::WebFoundTextRangeController::findTextRangesForStringMatches):
(WebKit::WebFoundTextRangeController::rectsForTextMatchesInRect):
(WebKit::WebFoundTextRangeController::frameForFoundTextRange const):
* Tools/TestRunnerShared/spi/UIKitSPIForTesting.h:
* Tools/TestWebKitAPI/Tests/WebKitCocoa/FindInPage.mm:
(TEST(WebKit, FindAndReplace)):
(swizzledIsEmbeddedScreen): Deleted.
(-[TestScrollViewDelegate init]): Deleted.
(-[TestScrollViewDelegate scrollViewDidEndScrollingAnimation:]): Deleted.
(-[TestFindDelegate setDidAddLayerForFindOverlayHandler:]): Deleted.
(-[TestFindDelegate didAddLayerForFindOverlayHandler]): Deleted.
(-[TestFindDelegate setDidRemoveLayerForFindOverlayHandler:]): Deleted.
(-[TestFindDelegate didRemoveLayerForFindOverlayHandler]): Deleted.
(-[TestFindDelegate _webView:didAddLayerForFindOverlay:]): Deleted.
(-[TestFindDelegate _webViewDidRemoveLayerForFindOverlay:]): Deleted.
* Tools/TestWebKitAPI/Tests/WebKitCocoa/FindInPageUtilities.h:
* Tools/TestWebKitAPI/Tests/WebKitCocoa/FindInPageUtilities.mm:
(swizzledIsEmbeddedScreen):
(-[TestScrollViewDelegate init]):
(-[TestScrollViewDelegate scrollViewDidEndScrollingAnimation:]):
(-[TestFindDelegate setDidAddLayerForFindOverlayHandler:]):
(-[TestFindDelegate didAddLayerForFindOverlayHandler]):
(-[TestFindDelegate setDidRemoveLayerForFindOverlayHandler:]):
(-[TestFindDelegate didRemoveLayerForFindOverlayHandler]):
(-[TestFindDelegate _webView:didAddLayerForFindOverlay:]):
(-[TestFindDelegate _webViewDidRemoveLayerForFindOverlay:]):
* Tools/TestWebKitAPI/Tests/WebKitCocoa/SiteIsolation.mm:
(TestWebKitAPI::(SiteIsolation, FindStringInFrameAndReplaceIOS)):
(TestWebKitAPI::(SiteIsolation, DecorateFoundTextRangeIOS)):
(TestWebKitAPI::(SiteIsolation, ScrollTextRangeToVisibleIOS)):
(TestWebKitAPI::(SiteIsolation, ClearAllDecoratedFoundTextIOS)):
(TestWebKitAPI::(SiteIsolation, RequestRectForFoundTextRangeIOS)):
Canonical link: https://commits.webkit.org/303851@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications