Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 0a2be6f329bedd4f14756472e6515ff5b929025c
      
https://github.com/WebKit/WebKit/commit/0a2be6f329bedd4f14756472e6515ff5b929025c
  Author: Wenson Hsieh <wenson_hs...@apple.com>
  Date:   2025-08-04 (Mon, 04 Aug 2025)

  Changed paths:
    M Source/WebKit/Modules/Internal/WebKitInternal.h
    M Source/WebKit/SaferCPPExpectations/NoUnretainedMemberCheckerExpectations
    M Source/WebKit/Shared/API/Cocoa/WebKitPrivate.h
    M Source/WebKit/SourcesCocoa.txt
    M Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm
    M Source/WebKit/UIProcess/API/Cocoa/WKWebViewInternal.h
    M Source/WebKit/UIProcess/API/Cocoa/WKWebViewPrivate.h
    A Source/WebKit/UIProcess/API/Cocoa/_WKTextExtraction.h
    A Source/WebKit/UIProcess/API/Cocoa/_WKTextExtraction.mm
    A Source/WebKit/UIProcess/API/Cocoa/_WKTextExtraction.swift
    A Source/WebKit/UIProcess/API/Cocoa/_WKTextExtractionInternal.h
    R Source/WebKit/UIProcess/Cocoa/TextExtraction/WKTextExtractionItem.h
    R Source/WebKit/UIProcess/Cocoa/TextExtraction/WKTextExtractionItem.swift
    M Source/WebKit/UIProcess/Cocoa/TextExtraction/WKTextExtractionUtilities.mm
    M 
Source/WebKit/UIProcess/Cocoa/TextExtraction/WKWebView+TextExtraction.swift
    M Source/WebKit/WebKit.xcodeproj/project.pbxproj
    M Tools/WebKitTestRunner/Configurations/Base.xcconfig
    M Tools/WebKitTestRunner/cocoa/UIScriptControllerCocoa.mm
    M Tools/WebKitTestRunner/cocoa/WKTextExtractionTestingHelpers.h
    M Tools/WebKitTestRunner/cocoa/WKTextExtractionTestingHelpers.mm

  Log Message:
  -----------
  [AutoFill Debugging] Part 1: Refactor `-_requestTextExtraction:` so that it 
takes a configuration object
https://bugs.webkit.org/show_bug.cgi?id=296864

Reviewed by Ryosuke Niwa and Abrar Rahman Protyasha.

This is the first part of a series of patches to provide clients with 
additional means to debug and
address AutoFill compatibility or performance. This will build off of 
`WKTextExtractionItem` and
related classes (currently only used for `UIIntelligenceSupport` framework 
integration), to provide
a lightweight snapshot of webpage content.

For now, we simply maintain existing behavior, but expose a new 
`_WKTextExtractionConfiguration`
object — as SPI for now, but hopefully eventually API — that clients can use to 
configure how text
extraction should behave (i.e., only by specifying a `targetRect` for now).

In the process, we also shuffle around some of the sources in 
`UIProcess/Cocoa/TextExtraction`, in
preparation for further changes to these files. In particular, we add 
`_WKTextExtraction.h` to
`API/` and move `WKTextExtractionItem.h` there as 
`_WKTextExtractionInternal.h`, as the internal
header counterpart to the private header. The corresponding Swift file is also 
moved, to keep the
relevant code in the same directory.

Instead of returning a `WKTextExtractionItem` in the completion handler, 
`-_requestTextExtraction:`
also now returns a `WKTextExtractionResult` object, which wraps the root item. 
While that's all it
currently does, we'll extend it in a subsequent patch to contain additional 
information, such as
native popup menu items.

* Source/WebKit/Modules/Internal/WebKitInternal.h:
* Source/WebKit/Shared/API/Cocoa/WebKitPrivate.h:
* Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm:
(-[WKWebView _requestTextExtraction:completionHandler:]):
* Source/WebKit/UIProcess/API/Cocoa/WKWebViewInternal.h:
* Source/WebKit/UIProcess/API/Cocoa/WKWebViewPrivate.h:
* Source/WebKit/UIProcess/API/Cocoa/_WKTextExtraction.h: Copied from 
Tools/WebKitTestRunner/cocoa/WKTextExtractionTestingHelpers.h.
* Source/WebKit/UIProcess/API/Cocoa/_WKTextExtraction.mm:

Add a new source file to contain the ObjC implementation of several exported 
`_WKTextExtraction*`
classes (for now, just the configuration). This is in a separate file rather 
than in Swift because
Swift sources are disabled for non-internal tvOS and watchOS builds, which 
would result in an error
that `_WKTextExtractionConfiguration` is declared but not defined when building 
for pure-OpenSource
tvOS or watchOS.

* Source/WebKit/UIProcess/API/Cocoa/_WKTextExtraction.swift: Renamed from 
Source/WebKit/UIProcess/Cocoa/TextExtraction/WKTextExtractionItem.swift.
(_WKTextExtractionConfiguration.targetRect):
(_WKTextExtractionConfiguration.mergeParagraphs):
(_WKTextExtractionConfiguration.ignoreTransparency):

Implement `_WKTextExtractionConfiguration`. These two flags are not used yet, 
but will be once we
introduce support for `WebCore::TextExtraction::Request` in a subsequent change.

(WKTextExtractionEditable.isSecure):
(WKTextExtractionEditable.isFocused):
(WKTextExtractionLink.url):
* Source/WebKit/UIProcess/API/Cocoa/_WKTextExtractionInternal.h: Renamed from 
Source/WebKit/UIProcess/Cocoa/TextExtraction/WKTextExtractionItem.h.
* Source/WebKit/UIProcess/Cocoa/TextExtraction/WKTextExtractionUtilities.mm:
* Source/WebKit/UIProcess/Cocoa/TextExtraction/WKWebView+TextExtraction.swift:
* Source/WebKit/WebKit.xcodeproj/project.pbxproj:
* Tools/WebKitTestRunner/Configurations/Base.xcconfig:

Add `API/Cocoa` to the header search path so that we can import 
_WKTextExtractionInternal.h directly
in WebKitTestRunner (rather than re-declare all of the internal interfaces).

* Tools/WebKitTestRunner/cocoa/UIScriptControllerCocoa.mm:
(WTR::UIScriptControllerCocoa::requestTextExtraction):
* Tools/WebKitTestRunner/cocoa/WKTextExtractionTestingHelpers.h:
* Tools/WebKitTestRunner/cocoa/WKTextExtractionTestingHelpers.mm:
(WTR::description):

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



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to