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

  Changed paths:
    M 
LayoutTests/fast/text-extraction/debug-text-extraction-form-controls-expected.txt
    M LayoutTests/fast/text-extraction/debug-text-extraction-form-controls.html
    M LayoutTests/resources/ui-helper.js
    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 Tools/WebKitTestRunner/cocoa/UIScriptControllerCocoa.mm

  Log Message:
  -----------
  [AutoFill Debugging] Add support for JSON text extraction output format
https://bugs.webkit.org/show_bug.cgi?id=304963
rdar://167571934

Reviewed by Abrar Rahman Protyasha.

Add support for minified JSON as a text extraction output format. See below for 
more details.

* 
LayoutTests/fast/text-extraction/debug-text-extraction-form-controls-expected.txt:

Augment an existing test to exercise this change. We intentionally parse and 
pretty-print the JSON
output here, so that any diffs in the layout test will be easier to understand 
and/or rebaseline.

* LayoutTests/fast/text-extraction/debug-text-extraction-form-controls.html:
* LayoutTests/resources/ui-helper.js:

Adjust `uid` normalization so that `uid`s in test output is consistent when 
dumping as JSON.

(window.UIHelper.prototype.async requestDebugText):
* Source/WebKit/Shared/TextExtractionToStringConversion.cpp:
(WebKit::TextExtractionAggregator::TextExtractionAggregator):
(WebKit::TextExtractionAggregator::~TextExtractionAggregator):
(WebKit::TextExtractionAggregator::takeResults):
(WebKit::TextExtractionAggregator::useJSONOutput const):
(WebKit::TextExtractionAggregator::rootJSONObject):

Add an `m_rootJSONObject` to the aggregator helper class, which represents the 
root JSON object when
using JSON output format. To ensure that we always produce valid JSON, we build 
up a JSON object as
we recurse through the tree, rather than building the output text line by line, 
and after extraction
and filtering are done, stringify the results.

(WebKit::TextExtractionAggregator::addNativeMenuItemsIfNeeded):
(WebKit::TextExtractionAggregator::addVersionNumberIfNeeded):

Rename these to reflect their more general role (since the new JSON output 
format doesn't just
append lines to the end).

(WebKit::containerTypeString):
(WebKit::jsonTypeStringForItem):
(WebKit::eventListenerTypesToJSONArray):
(WebKit::setCommonJSONProperties):
(WebKit::addJSONTextContent):
(WebKit::createJSONForChildItem):
(WebKit::populateJSONForItem):

Add helpers to populate JSON data.

(WebKit::addPartsForItem):
(WebKit::convertToText):
(WebKit::TextExtractionAggregator::addLineForNativeMenuItemsIfNeeded): Deleted.
(WebKit::TextExtractionAggregator::addLineForVersionNumberIfNeeded): Deleted.
* Source/WebKit/Shared/TextExtractionToStringConversion.h:
* Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm:
(textExtractionOutputFormat):
* Source/WebKit/UIProcess/API/Cocoa/_WKTextExtraction.h:
* Tools/WebKitTestRunner/cocoa/UIScriptControllerCocoa.mm:
(WTR::createTextExtractionConfiguration):

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



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

Reply via email to