Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: df2042dcc84871042dcc9587c926bdf215726abc
https://github.com/WebKit/WebKit/commit/df2042dcc84871042dcc9587c926bdf215726abc
Author: Wenson Hsieh <[email protected]>
Date: 2026-01-13 (Tue, 13 Jan 2026)
Changed paths:
M Source/WebCore/Sources.txt
M Source/WebCore/WebCore.xcodeproj/project.pbxproj
A Source/WebCore/page/text-extraction/TextExtractionTypes.cpp
M Source/WebCore/page/text-extraction/TextExtractionTypes.h
M Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm
M Source/WebKit/UIProcess/API/Cocoa/_WKTextExtraction.h
M Source/WebKit/UIProcess/API/Cocoa/_WKTextExtraction.mm
M Source/WebKit/UIProcess/WebFrameProxy.cpp
M Source/WebKit/UIProcess/WebFrameProxy.h
M Tools/TestWebKitAPI/Tests/WebKitCocoa/TextExtractionTests.mm
Log Message:
-----------
[AutoFill Debugging] Add support for text extraction from client-requested
cross-origin frames
https://bugs.webkit.org/show_bug.cgi?id=305339
rdar://165929292
Reviewed by Abrar Rahman Protyasha.
Complete support for extracting text from subframes — this adds support for an
`additionalFrames`
property on the extraction configuration, which allows the WebKit client to
specify a list of
additional `WKFrameInfo`s, from which WebKit will extract text (in addition to
the main frame and
all same-origin subframes under the main frame).
See below for more details.
Test: Tools/TestWebKitAPI/Tests/WebKitCocoa/TextExtractionTests.mm
* Source/WebCore/Sources.txt:
* Source/WebCore/WebCore.xcodeproj/project.pbxproj:
* Source/WebCore/page/text-extraction/TextExtractionTypes.cpp: Added.
(WebCore::TextExtraction::collateItemsRecursive):
(WebCore::TextExtraction::collatePageItems):
Add a helper method that takes `PageItems` (the main frame's `Item` along with
a dictionary mapping
subframe IDs to their root `Item`s) and recursively collates all item data into
a single `Item`
rooted in the main frame.
* Source/WebCore/page/text-extraction/TextExtractionTypes.h:
* Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm:
(jsHandleIdentifierInFrame):
(extractHandleIdentifiersOfNodesToSkip):
(extractClientNodeAttributes):
Augment these helper methods to take a target frame, so that identifiers can be
filtered out unless
they identify a node within the target frame.
(-[WKWebView _requestTextExtractionInternal:completion:]):
Currently, this method only requests text extraction from the main frame; we
now extend it to
extract items from the combination of frames specified via `-additionalFrames`
and the main frame.
(mainFrameJSHandleIdentifier): Deleted.
* Source/WebKit/UIProcess/API/Cocoa/_WKTextExtraction.h:
* Source/WebKit/UIProcess/API/Cocoa/_WKTextExtraction.mm:
(-[_WKTextExtractionConfiguration setNodesToSkip:]):
(-[_WKTextExtractionConfiguration additionalFrames]):
(-[_WKTextExtractionConfiguration setAdditionalFrames:]):
Add the new property.
* Source/WebKit/UIProcess/WebFrameProxy.cpp:
(WebKit::WebFrameProxy::calculateFrameTreeSyncData const):
(WebKit::WebFrameProxy::securityOrigin const):
(WebKit::WebFrameProxy::isSameOriginAs const):
* Source/WebKit/UIProcess/WebFrameProxy.h:
* Tools/TestWebKitAPI/Tests/WebKitCocoa/TextExtractionTests.mm:
(TestWebKitAPI::mainFrameMarkup):
(TestWebKitAPI::subFrameMarkup):
Adjust this API test to include both same-origin and cross-origin subframes.
(TestWebKitAPI::TEST(TextExtractionTests, SubframeInteractions)):
(): Deleted.
(TestWebKitAPI::addEventListener): Deleted.
(TestWebKitAPI::(TextExtractionTests, SubframeInteractions)): Deleted.
Canonical link: https://commits.webkit.org/305512@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications