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

  Changed paths:
    A 
LayoutTests/fast/text-extraction/debug-text-extraction-data-detectors-expected.txt
    A LayoutTests/fast/text-extraction/debug-text-extraction-data-detectors.html
    M Source/WTF/wtf/cocoa/SoftLinking.h
    M Source/WebCore/Configurations/AllowedSPI.toml
    M Source/WebCore/PAL/pal/cocoa/DataDetectorsCoreSoftLink.h
    M Source/WebCore/PAL/pal/cocoa/DataDetectorsCoreSoftLink.mm
    M Source/WebCore/PAL/pal/spi/cocoa/DataDetectorsCoreSPI.h
    M Source/WebCore/editing/cocoa/DataDetection.h
    M Source/WebCore/editing/cocoa/DataDetection.mm
    M Source/WebCore/editing/cocoa/DataDetectorType.h
    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/TestRunnerShared/UIScriptContext/Bindings/UIScriptController.idl
    M Tools/TestRunnerShared/UIScriptContext/UIScriptController.h
    M Tools/TestRunnerShared/UIScriptContext/UIScriptControllerShared.cpp
    M Tools/WebKitTestRunner/cocoa/UIScriptControllerCocoa.mm

  Log Message:
  -----------
  [AutoFill Debugging] Add a way for clients to target text near data-detected 
results
https://bugs.webkit.org/show_bug.cgi?id=305739
rdar://168418668

Reviewed by Abrar Rahman Protyasha.

Add a heuristic to run data detectors over the text extraction scope, and limit 
extracted text to
a container node that includes the largest DOM range with a matching data 
detector result. See
below for more details.

Test: fast/text-extraction/debug-text-extraction-data-detectors.html

* 
LayoutTests/fast/text-extraction/debug-text-extraction-data-detectors-expected.txt:
 Added.
* LayoutTests/fast/text-extraction/debug-text-extraction-data-detectors.html: 
Added.
* Source/WTF/wtf/cocoa/SoftLinking.h:

Add `SUPPRESS_UNRETAINED_ARG` to soft linked symbol macros.

* Source/WebCore/Configurations/AllowedSPI.toml:
* Source/WebCore/PAL/pal/cocoa/DataDetectorsCoreSoftLink.h:
* Source/WebCore/PAL/pal/cocoa/DataDetectorsCoreSoftLink.mm:

Pull some soft linking helpers into cross-platform code.

* Source/WebCore/editing/cocoa/DataDetection.h:
* Source/WebCore/editing/cocoa/DataDetection.mm:
(WebCore::resultIsURL):
(WebCore::constructURLStringForResult):
(WebCore::typeForResult):
(WebCore::DataDetection::detectRanges):

Add support for a new helper method to return a list of data-detected DOM 
ranges within the given
`SimpleRange`, which contain data detector results that match the given types.

* Source/WebCore/editing/cocoa/DataDetectorType.h:
* Source/WebCore/page/text-extraction/TextExtraction.cpp:
(WebCore::TextExtraction::findContainerNodeForDataDetectorResults):

In the case where `dataDetectorTypes` are specified, use the new 
`DataDetection` helper method above
to narrow the scope of `extractionRootNode` to a container node that is both 
wider and taller than
an arbitrary size threshold, and contains the (visually) largest range in the 
DOM that has data
detector results.

(WebCore::TextExtraction::extractItem):
* Source/WebCore/page/text-extraction/TextExtractionTypes.h:
* Source/WebKit/Shared/WebCoreArgumentCoders.serialization.in:
* Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm:
(coreDataDetectorTypes):
(-[WKWebView _requestTextExtractionInternal:completion:]):
* Source/WebKit/UIProcess/API/Cocoa/_WKTextExtraction.h:
* Source/WebKit/UIProcess/API/Cocoa/_WKTextExtraction.mm:
(-[_WKTextExtractionConfiguration _initForOnlyVisibleText:]):

Plumb the new data detector enum down to the `TextExtraction::Request`.

* Tools/TestRunnerShared/UIScriptContext/Bindings/UIScriptController.idl:
* Tools/TestRunnerShared/UIScriptContext/UIScriptController.h:
* Tools/TestRunnerShared/UIScriptContext/UIScriptControllerShared.cpp:
(WTR::toTextExtractionTestOptions):
* Tools/WebKitTestRunner/cocoa/UIScriptControllerCocoa.mm:
(WTR::dataDetectorTypes):

Add testing support for `dataDetectorTypes: […]`.

(WTR::createTextExtractionConfiguration):
(WTR::UIScriptControllerCocoa::requestTextExtraction):
(WTR::UIScriptControllerCocoa::requestDebugText):

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



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

Reply via email to