Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 574355f8180ee2a8afa3b514627828eac30d251f
      
https://github.com/WebKit/WebKit/commit/574355f8180ee2a8afa3b514627828eac30d251f
  Author: Wenson Hsieh <[email protected]>
  Date:   2026-01-12 (Mon, 12 Jan 2026)

  Changed paths:
    M LayoutTests/resources/ui-helper.js
    M Source/WebCore/page/text-extraction/TextExtraction.cpp
    M Source/WebCore/page/text-extraction/TextExtractionTypes.h
    M Source/WebKit/Shared/TextExtractionToStringConversion.cpp
    M Source/WebKit/Shared/TextExtractionToStringConversion.h
    M Source/WebKit/Shared/WebCoreArgumentCoders.serialization.in
    M Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm
    M Source/WebKit/UIProcess/API/Cocoa/WKWebViewInternal.h
    M Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj
    M Tools/TestWebKitAPI/Tests/WebKitCocoa/TextExtractionTests.mm

  Log Message:
  -----------
  [AutoFill Debugging] Support text extraction interactions for nodes in 
subframes
https://bugs.webkit.org/show_bug.cgi?id=305296
rdar://167950324

Reviewed by Abrar Rahman Protyasha.

Add support for performing and describing `_WKTextExtractionInteraction`s that 
target nodes in
subframes; see below for more details.

Tests: TextExtractionTests.SubframeInteractions

* LayoutTests/resources/ui-helper.js:
(window.UIHelper.prototype.async requestDebugText):

Adjust this `UIHelper` method to handle both `uid=x_y_z` and `uid=z`.

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

Plumb a `FrameIdentifier` through each extracted item.

* Source/WebCore/page/text-extraction/TextExtractionTypes.h:
* Source/WebKit/Shared/TextExtractionToStringConversion.cpp:
(WebKit::parseFrameAndNodeIdentifiers):

Add a helper method to parse a node ID string into a node ID and optional frame 
ID.

(WebKit::TextExtractionAggregator::filter):

Plumb an optional frame ID through text filtering codepaths.

(WebKit::TextExtractionAggregator::stringForIdentifiers const):

Add a helper method to return the string representation for a given node ID and 
(optional) frame ID.

(WebKit::TextExtractionAggregator::filterRecursive):
(WebKit::setCommonJSONProperties):
(WebKit::addJSONTextContent):
(WebKit::populateJSONForItem):
(WebKit::partsForItem):
(WebKit::addPartsForText):
(WebKit::addPartsForItem):
(WebKit::addTextRepresentationRecursive):

Plumb an optional frame ID from each extracted item through text filtering 
codepaths.

* Source/WebKit/Shared/TextExtractionToStringConversion.h:
(WebKit::TextExtractionOptions::TextExtractionOptions):
* Source/WebKit/Shared/WebCoreArgumentCoders.serialization.in:
* Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm:
(-[WKWebView 
_extractDebugTextWithConfigurationWithoutUpdatingFilterRules:assertionScope:completionHandler:]):

Plumb the main frame ID when converting into text conversion codepaths; for 
identified items where
the frame ID is equal to the main frame, we represent it with `uid=x` rather 
than the full `x_y_z`.

(-[WKWebView _convertToWebCoreInteraction:]):
(-[WKWebView _performInteraction:completionHandler:]):
(-[WKWebView _describeInteraction:completionHandler:]):
(-[WKWebView _validateText:inFrame:inNode:completionHandler:]):

Instead of only supporting the main frame, parse the frame ID out of the node 
ID string and send the
IPC to the target frame corresponding to the frame ID.

(-[WKWebView _requestJSHandleForNodeIdentifier:searchText:completionHandler:]):
(toNodeIdentifier): Deleted.
(-[WKWebView _validateText:inNode:completionHandler:]): Deleted.
* Source/WebKit/UIProcess/API/Cocoa/WKWebViewInternal.h:
* Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
* Tools/TestWebKitAPI/Tests/WebKitCocoa/TextExtractionTests.mm:
(TestWebKitAPI::extractNodeIdentifier):
(TestWebKitAPI::addEventListener):
(TestWebKitAPI::(TextExtractionTests, SubframeInteractions)):

Add a test to exercise this change.

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



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

Reply via email to