Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 1403129e02472b16a4eb6a8a5b61c097983b7c08
      
https://github.com/WebKit/WebKit/commit/1403129e02472b16a4eb6a8a5b61c097983b7c08
  Author: Wenson Hsieh <[email protected]>
  Date:   2025-11-02 (Sun, 02 Nov 2025)

  Changed paths:
    M Source/WebCore/page/text-extraction/TextExtraction.cpp
    M Source/WebCore/page/text-extraction/TextExtractionTypes.h
    M Source/WebKit/Shared/WebCoreArgumentCoders.serialization.in
    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 Tools/TestWebKitAPI/Tests/WebKitCocoa/TextExtractionTests.mm
    M Tools/TestWebKitAPI/Tests/WebKitCocoa/WKWebViewSnapshot.mm
    M Tools/TestWebKitAPI/cocoa/TestWKWebView.h
    M Tools/TestWebKitAPI/cocoa/TestWKWebView.mm

  Log Message:
  -----------
  [AutoFill Debugging] Add a way to scope text extraction to a given node (by 
JS handle)
https://bugs.webkit.org/show_bug.cgi?id=301831
rdar://163902445

Reviewed by Abrar Rahman Protyasha.

Add support for a new property on `_WKTextExtractionConfiguration`, which 
clients can use to scope
text extraction to a given element by specifying a `_WKJSHandle`.

Tests: TextExtractionTests.TargetNode

* Source/WebCore/page/text-extraction/TextExtraction.cpp:
(WebCore::TextExtraction::collectText):

Refactor `collectText(Document&)` to take a `Node&` instead, representing the 
scope of text
extraction in the DOM (it currently defaults to the `body` element in the given 
`Document`).

(WebCore::TextExtraction::extractItem):
* Source/WebCore/page/text-extraction/TextExtractionTypes.h:
* Source/WebKit/Shared/WebCoreArgumentCoders.serialization.in:
* Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm:
(mainFrameJSHandleIdentifier):
(-[WKWebView _requestTextExtractionInternal:completion:]):
* Source/WebKit/UIProcess/API/Cocoa/_WKTextExtraction.h:
* Source/WebKit/UIProcess/API/Cocoa/_WKTextExtraction.mm:
(-[_WKTextExtractionConfiguration targetNode]):
(-[_WKTextExtractionConfiguration setTargetNode:]):
* Tools/TestWebKitAPI/Tests/WebKitCocoa/TextExtractionTests.mm:
(TestWebKitAPI::TEST(TextExtractionTests, TargetNode)):

Add an API test to exercise this new property.

* Tools/TestWebKitAPI/Tests/WebKitCocoa/WKWebViewSnapshot.mm:
(TestWebKitAPI::TEST(WKWebView, SnapshotNodeByJSHandle)):
* Tools/TestWebKitAPI/cocoa/TestWKWebView.h:
* Tools/TestWebKitAPI/cocoa/TestWKWebView.mm:
(-[WKWebView querySelector:frame:world:]):

Add a testing helper to return a `_WKJSHandle` corresponding to the result of 
evaluating
`document.querySelector(…)`.

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



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

Reply via email to