Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 09c4983c5bd980390426e4b15d18f32457a0aabc
https://github.com/WebKit/WebKit/commit/09c4983c5bd980390426e4b15d18f32457a0aabc
Author: Ryosuke Niwa <[email protected]>
Date: 2023-03-14 (Tue, 14 Mar 2023)
Changed paths:
M Source/WebCore/editing/TextManipulationController.cpp
M Source/WebCore/editing/TextManipulationControllerManipulationFailure.h
M Source/WebCore/editing/TextManipulationItem.h
M Source/WebKit/Shared/WebCoreArgumentCoders.serialization.in
M Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm
M Source/WebKit/UIProcess/API/Cocoa/_WKTextManipulationConfiguration.h
M Source/WebKit/UIProcess/API/Cocoa/_WKTextManipulationItem.h
M Source/WebKit/UIProcess/API/Cocoa/_WKTextManipulationItem.mm
M Source/WebKit/UIProcess/WebPageProxy.cpp
M Source/WebKit/UIProcess/WebPageProxy.h
M Source/WebKit/WebProcess/WebPage/WebPage.cpp
M Source/WebKit/WebProcess/WebPage/WebPage.h
M Source/WebKit/WebProcess/WebPage/WebPage.messages.in
M Tools/TestWebKitAPI/Tests/WebKitCocoa/TextManipulation.mm
Log Message:
-----------
Safari doesn't translate iframe content
https://bugs.webkit.org/show_bug.cgi?id=253353
<rdar://59693219>
Reviewed by Darin Adler, Sihui Liu and Wenson Hsieh.
Optionally translate contents within each frame when includeSubframes is set in
_WKTextManipulationConfiguration. To do this, each TextManipulationItem and
TextManipulationControllerManipulationFailure are augmented with a frame
identifier.
These IDs are serialized with "-" as delimiter for _WKTextManipulationItem.
_WKTextManipulationItem now exposes two new booleans: isSubframe and
isCrossSiteSubframe.
These two booleans are ignored when completing items.
WebPage::startTextManipulations now invokes startTextManipulationForFrame on
each frame.
We also detect when a new frame is inserted in WebPage::didCommitLoad.
Finally, in WebPage::completeTextManipulation, we aggregate and complete items
per frame.
* Source/WebCore/editing/TextManipulationController.cpp:
(WebCore::TextManipulationController::addItem): Add the frame identifier.
(WebCore::TextManipulationController::completeManipulation): Check the frame
identifier.
* Source/WebCore/editing/TextManipulationControllerManipulationFailure.h:
* Source/WebCore/editing/TextManipulationItem.h:
* Source/WebKit/Shared/WebCoreArgumentCoders.serialization.in:
* Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm:
(-[WKWebView _startTextManipulationsWithConfiguration:completion:]):
(coreTextManipulationItemIdentifierFromString):
(-[WKWebView _completeTextManipulation:completion:]):
(wkTextManipulationErrors):
(-[WKWebView _completeTextManipulationForItems:completion:]):
* Source/WebKit/UIProcess/API/Cocoa/_WKTextManipulationConfiguration.h:
* Source/WebKit/UIProcess/API/Cocoa/_WKTextManipulationItem.h:
* Source/WebKit/UIProcess/API/Cocoa/_WKTextManipulationItem.mm:
(-[_WKTextManipulationItem
initWithIdentifier:tokens:isSubframe:isCrossSiteSubframe:]): Added.
* Source/WebKit/WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::didCommitLoad):
(WebKit::WebPage::startTextManipulations):
(WebKit::WebPage::startTextManipulationForFrame): Extracted out of
startTextManipulations.
(WebKit::WebPage::completeTextManipulation): Complete per frame and aggregate
the results.
* Source/WebKit/WebProcess/WebPage/WebPage.h:
* Tools/TestWebKitAPI/Tests/WebKitCocoa/TextManipulation.mm:
(TextManipulation.StartTextManipulationDoesNotFindContentInIframeIfIncludeSubframeIsNotSet):
Added.
(TextManipulation.StartTextManipulationFindsContentInIframeIfIncludeSubframeIsSet):
Added.
(TextManipulation.StartTextManipulationFindsContentInIframeInsertedLater):
Added.
(TextManipulation.CompleteTextManipulationReplaceContentInIframe): Added.
(TextManipulation.CompleteTextManipulationFailWhenContentIsChangedInIframe):
Added.
Canonical link: https://commits.webkit.org/261671@main
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes