Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 4dce17fe3a12a5d312dc280ef1ff35f9b48bfcd7
      
https://github.com/WebKit/WebKit/commit/4dce17fe3a12a5d312dc280ef1ff35f9b48bfcd7
  Author: Wenson Hsieh <wenson_hs...@apple.com>
  Date:   2025-08-15 (Fri, 15 Aug 2025)

  Changed paths:
    A LayoutTests/fast/text-extraction/debug-text-extraction-basic-expected.txt
    A LayoutTests/fast/text-extraction/debug-text-extraction-basic.html
    M LayoutTests/resources/ui-helper.js
    M Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm
    M Source/WebKit/UIProcess/API/Cocoa/WKWebViewPrivate.h
    M Source/WebKit/UIProcess/API/Cocoa/_WKTextExtraction.mm
    M Source/WebKit/UIProcess/API/Cocoa/_WKTextExtraction.swift
    M Source/WebKit/UIProcess/API/Cocoa/_WKTextExtractionInternal.h
    M 
Source/WebKit/UIProcess/Cocoa/TextExtraction/WKWebView+TextExtraction.swift
    M Tools/TestRunnerShared/UIScriptContext/Bindings/UIScriptController.idl
    M Tools/TestRunnerShared/UIScriptContext/UIScriptController.h
    M Tools/WebKitTestRunner/cocoa/UIScriptControllerCocoa.h
    M Tools/WebKitTestRunner/cocoa/UIScriptControllerCocoa.mm

  Log Message:
  -----------
  [AutoFill Debugging] Part 4: Add support for `-[WKWebView 
_debugTextWithConfiguration:completionHandler:]`
https://bugs.webkit.org/show_bug.cgi?id=297474
rdar://158431432

Reviewed by Richard Robinson and Patrick Angle.

Add support for a new SPI method on `WKWebView` that uses text extraction to 
provide a textual
representation of the current page, for debugging purposes. See below for more 
details.

* LayoutTests/fast/text-extraction/debug-text-extraction-basic-expected.txt: 
Added.
* LayoutTests/fast/text-extraction/debug-text-extraction-basic.html: Added.

Add a basic layout test that exercises most aspects of the debug text 
extraction workflow, including
event listeners, DOM/ARIA attributes, and special element types.

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

Add a testing hook to request `debugText`.

(async UIHelper.EventStreamBuilder.prototype._reset): Deleted.
(async UIHelper.EventStreamBuilder.prototype.begin): Deleted.
(async UIHelper.EventStreamBuilder.prototype.wait): Deleted.
(async UIHelper.EventStreamBuilder.prototype.move): Deleted.
(async UIHelper.EventStreamBuilder.prototype.end): Deleted.
(async UIHelper.EventStreamBuilder.prototype.takeResult): Deleted.
* Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm:
(-[WKWebView _debugTextWithConfiguration:completionHandler:]):
* Source/WebKit/UIProcess/API/Cocoa/WKWebViewPrivate.h:
* Source/WebKit/UIProcess/API/Cocoa/_WKTextExtraction.mm:
(-[_WKTextExtractionConfiguration init]):
* Source/WebKit/UIProcess/API/Cocoa/_WKTextExtraction.swift:
(String.escaped):
(WKTextExtractionItem.textRepresentationRecursive(_:)):
(WKTextExtractionItem.textRepresentationParts):
(WKTextExtractionContainerItem.textRepresentationParts):
(WKTextExtractionContentEditableItem.textRepresentationParts):
(WKTextExtractionTextFormControlItem.textRepresentationParts):
(WKTextExtractionLinkItem.textRepresentationParts):
(WKTextExtractionTextItem.textRepresentationParts):
(WKTextExtractionScrollableItem.textRepresentationParts):
(WKTextExtractionSelectItem.textRepresentationParts):
(WKTextExtractionImageItem.textRepresentationParts):

Add support for a `fileprivate` method to return an array of text 
representation parts (e.g.
`url=…`, `aria-label='…'`, etc.) that's used to assemble the one-line text 
representation. Each
subclass adds additional, item-specific information on top of the default 
information added by
`WKTextExtractionItem`.

(WKTextExtractionPopupMenu.textRepresentation):
(WKTextExtractionResult.textRepresentation):

Add support for `-[WKTextExtractionResult textRepresentation]`. This returns a 
textual
representation of the extraction result, with 1 element per line.

* Source/WebKit/UIProcess/API/Cocoa/_WKTextExtractionInternal.h:
* Source/WebKit/UIProcess/Cocoa/TextExtraction/WKWebView+TextExtraction.swift:
* Tools/TestRunnerShared/UIScriptContext/Bindings/UIScriptController.idl:
* Tools/TestRunnerShared/UIScriptContext/UIScriptController.h:
(WTR::UIScriptController::requestDebugText):
* Tools/WebKitTestRunner/cocoa/UIScriptControllerCocoa.h:
* Tools/WebKitTestRunner/cocoa/UIScriptControllerCocoa.mm:
(WTR::UIScriptControllerCocoa::requestDebugText):

Canonical link: https://commits.webkit.org/298782@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