Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 036a2b4774cbde592b6bcd8fd9d315f81c29c2e7
https://github.com/WebKit/WebKit/commit/036a2b4774cbde592b6bcd8fd9d315f81c29c2e7
Author: Wenson Hsieh <[email protected]>
Date: 2026-03-09 (Mon, 09 Mar 2026)
Changed paths:
M Source/WebCore/page/text-extraction/TextExtraction.cpp
M Source/WebCore/page/text-extraction/TextExtraction.h
M Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm
M Source/WebKit/UIProcess/API/Cocoa/WKWebViewInternal.h
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 Source/WebKit/WebProcess/WebPage/WebFrame.cpp
M Source/WebKit/WebProcess/WebPage/WebFrame.h
M Source/WebKit/WebProcess/WebPage/WebFrame.messages.in
M Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj
M Tools/TestWebKitAPI/Tests/WebKitCocoa/TextExtractionTests.mm
A Tools/TestWebKitAPI/Tests/WebKitCocoa/debug-text-product.html
Log Message:
-----------
[AutoFill Debugging] Add an alternative to -requestJSHandleForNodeIdentifier
that includes more context
https://bugs.webkit.org/show_bug.cgi?id=309465
rdar://172042072
Reviewed by Abrar Rahman Protyasha.
Add a second method, similar to `-requestJSHandleForNodeIdentifier:`, that
returns a JS handle of a
node that contains the node targeted by the given `nodeIdentifier` /
`searchText`, and whose size
is larger than some minimum threshold.
Test: TextExtractionTests.RequestContainerJSHandleForNodeIdentifier
* Source/WebCore/page/text-extraction/TextExtraction.cpp:
(WebCore::TextExtraction::findContainerNodeForDataDetectorResults):
(WebCore::TextExtraction::extractItem):
Also use a different highlight color in the case where the extraction target is
provided directly
from the client, rather than determined heuristically through data detectors.
(WebCore::TextExtraction::containerElementForExtractedText):
Use existing heuristics to find a "large" container above the given targeted
node.
* Source/WebCore/page/text-extraction/TextExtraction.h:
* Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm:
(-[WKWebView
_requestContainerJSHandleForNodeIdentifier:searchText:completionHandler:]):
* Source/WebKit/UIProcess/API/Cocoa/WKWebViewInternal.h:
* Source/WebKit/UIProcess/API/Cocoa/_WKTextExtraction.h:
* Source/WebKit/UIProcess/API/Cocoa/_WKTextExtraction.mm:
(-[_WKTextExtractionResult
requestContainerJSHandleForNodeIdentifier:searchText:completionHandler:]):
* Source/WebKit/UIProcess/WebFrameProxy.cpp:
(WebKit::WebFrameProxy::requestContainerJSHandleForExtractedText):
* Source/WebKit/UIProcess/WebFrameProxy.h:
* Source/WebKit/WebProcess/WebPage/WebFrame.cpp:
(WebKit::WebFrame::requestContainerJSHandleForExtractedText):
* Source/WebKit/WebProcess/WebPage/WebFrame.h:
* Source/WebKit/WebProcess/WebPage/WebFrame.messages.in:
* Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
Drive-by: sort the project file list.
* Tools/TestWebKitAPI/Tests/WebKitCocoa/TextExtractionTests.mm:
(-[_WKTextExtractionResult containerJSHandleForNodeIdentifier:searchText:]):
(TestWebKitAPI::TEST(TextExtractionTests,
RequestContainerJSHandleForNodeIdentifier)):
* Tools/TestWebKitAPI/Tests/WebKitCocoa/debug-text-product.html: Added.
Add an API test and new test harness to exercise the text extraction API.
Canonical link: https://commits.webkit.org/308939@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications