Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: bb1043813cb24812d98028666485be5357f8969a
https://github.com/WebKit/WebKit/commit/bb1043813cb24812d98028666485be5357f8969a
Author: Wenson Hsieh <[email protected]>
Date: 2025-11-20 (Thu, 20 Nov 2025)
Changed paths:
A LayoutTests/fast/text-extraction/debug-text-extraction-markup-expected.txt
A LayoutTests/fast/text-extraction/debug-text-extraction-markup.html
M Source/WebKit/Shared/TextExtractionToStringConversion.cpp
M Source/WebKit/Shared/TextExtractionToStringConversion.h
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] Support HTML as a debug text extraction output format
https://bugs.webkit.org/show_bug.cgi?id=302886
rdar://165151498
Reviewed by Abrar Rahman Protyasha.
Add support for a new text extraction configuration property, `outputFormat`,
which encompasses two
values:
`textTree`: Existing behavior.
`html`: Format output in a way that's *similar* to HTML markup (and
importantly, can be
parsed as markup by clients).
See below for more details.
Test: fast/text-extraction/debug-text-extraction-markup.html
* LayoutTests/fast/text-extraction/debug-text-extraction-markup-expected.txt:
Added.
* LayoutTests/fast/text-extraction/debug-text-extraction-markup.html: Added.
* Source/WebKit/Shared/TextExtractionToStringConversion.cpp:
(WebKit::escapeStringForHTML):
Add another version of `escapeString`, which is suitable for use in text
content in HTML.
(WebKit::TextExtractionAggregator::addResult):
(WebKit::TextExtractionAggregator::useHTMLOutput const):
Add a helper method on `TextExtractionAggregator` indicating whether or not we
should use HTML as
the output format.
(WebKit::TextExtractionAggregator::appendToLine):
(WebKit::TextExtractionAggregator::addLineForVersionNumberIfNeeded):
(WebKit::partsForItem):
(WebKit::addPartsForText):
(WebKit::addPartsForItem):
Avoid including rects and event listeners in the text output for now; we may
want to add them back
later down the road, as attributes like `rect=[…]` or `eventListeners=[…]`.
(WebKit::addTextRepresentationRecursive):
* Source/WebKit/Shared/TextExtractionToStringConversion.h:
(WebKit::TextExtractionOptions::TextExtractionOptions):
* Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm:
(textExtractionOutputFormat):
(-[WKWebView _extractDebugTextWithConfiguration:completionHandler:]):
* Source/WebKit/UIProcess/API/Cocoa/_WKTextExtraction.h:
* Source/WebKit/UIProcess/API/Cocoa/_WKTextExtraction.mm:
(-[_WKTextExtractionConfiguration setOutputFormat:]):
* Tools/TestRunnerShared/UIScriptContext/Bindings/UIScriptController.idl:
* Tools/TestRunnerShared/UIScriptContext/UIScriptController.h:
* Tools/TestRunnerShared/UIScriptContext/UIScriptControllerShared.cpp:
(WTR::toTextExtractionTestOptions):
* Tools/WebKitTestRunner/cocoa/UIScriptControllerCocoa.mm:
(WTR::createTextExtractionConfiguration):
Canonical link: https://commits.webkit.org/303377@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications