Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 3fc2c409c17ec3bd8743ddcb6df38e3f160ed417
      
https://github.com/WebKit/WebKit/commit/3fc2c409c17ec3bd8743ddcb6df38e3f160ed417
  Author: Wenson Hsieh <[email protected]>
  Date:   2025-11-04 (Tue, 04 Nov 2025)

  Changed paths:
    M LayoutTests/fast/text-extraction/debug-text-extraction-basic.html
    M LayoutTests/fast/text-extraction/debug-text-extraction-highlight-text.html
    A 
LayoutTests/fast/text-extraction/debug-text-extraction-ignore-autofilled-fields-expected.txt
    A 
LayoutTests/fast/text-extraction/debug-text-extraction-ignore-autofilled-fields.html
    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/_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/TestWebKitAPI/Tests/WebKitCocoa/TextExtractionTests.mm
    M Tools/WebKitTestRunner/cocoa/UIScriptControllerCocoa.mm

  Log Message:
  -----------
  [AutoFill Debugging] Add the ability to redact or replace the contents of 
AutoFilled text fields
https://bugs.webkit.org/show_bug.cgi?id=301956
rdar://163650051

Reviewed by Abrar Rahman Protyasha and Aditya Keerthi.

Add support for a couple new properties, which allow clients to:

- Automatically replace all occurrences of any given set of strings with 
another set of strings.
- Avoid extracting text from all text inputs that have been modified via 
AutoFill.

Tests: fast/text-extraction/debug-text-extraction-ignore-autofilled-fields.html
       TextExtractionTests.ReplacementStrings

Tests: fast/text-extraction/debug-text-extraction-ignore-autofilled-fields.html
       Tools/TestWebKitAPI/Tests/WebKitCocoa/TextExtractionTests.mm
* LayoutTests/fast/text-extraction/debug-text-extraction-basic.html:
* LayoutTests/fast/text-extraction/debug-text-extraction-highlight-text.html:
* 
LayoutTests/fast/text-extraction/debug-text-extraction-ignore-autofilled-fields-expected.txt:
 Added.
* 
LayoutTests/fast/text-extraction/debug-text-extraction-ignore-autofilled-fields.html:
 Added.
* Source/WebCore/page/text-extraction/TextExtraction.cpp:
(WebCore::TextExtraction::hasEnclosingAutoFilledInput):
(WebCore::TextExtraction::collectText):
(WebCore::TextExtraction::extractItem):

Add plumbing to avoid extracting text from text nodes inside input elements 
that have been
AutoFilled.

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

Honor the new `replacementStrings` dictionary here, by swapping out all 
replacement text after
filtering. Importantly, this happens after filtering so that the results of 
OCR-based filtering
don't result in false positives due to replacement text being significantly 
different from the DOM
text.

(WebKit::addPartsForText):
* Source/WebKit/Shared/TextExtractionToStringConversion.h:
(WebKit::TextExtractionOptions::TextExtractionOptions):
* Source/WebKit/Shared/WebCoreArgumentCoders.serialization.in:
* Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm:
(extractReplacementStrings):
(-[WKWebView _debugTextWithConfiguration:completionHandler:]):
(-[WKWebView _requestTextExtractionInternal:completion:]):
* Source/WebKit/UIProcess/API/Cocoa/_WKTextExtraction.h:
* Source/WebKit/UIProcess/API/Cocoa/_WKTextExtraction.mm:
(-[_WKTextExtractionConfiguration init]):
(-[_WKTextExtractionConfiguration replacementStrings]):
(-[_WKTextExtractionConfiguration setReplacementStrings:]):

Add the new properties here.

* Tools/TestRunnerShared/UIScriptContext/Bindings/UIScriptController.idl:
* Tools/TestRunnerShared/UIScriptContext/UIScriptController.h:
* Tools/TestRunnerShared/UIScriptContext/UIScriptControllerShared.cpp:
(WTR::toTextExtractionTestOptions):
* Tools/TestWebKitAPI/Tests/WebKitCocoa/TextExtractionTests.mm:
(TestWebKitAPI::TEST(TextExtractionTests, ReplacementStrings)):
* Tools/WebKitTestRunner/cocoa/UIScriptControllerCocoa.mm:
(WTR::createTextExtractionConfiguration):

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



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

Reply via email to