[AutoFill Debugging] Add a way for clients to extract only plain text while maintaining DOM structure#59605
Merged
webkit-commit-queue merged 1 commit intoWebKit:mainfrom Feb 28, 2026
Merged
Conversation
Collaborator
|
EWS run on previous version of this PR (hash 2fd9684) Details |
aprotyas
approved these changes
Feb 27, 2026
Member
Author
|
Thanks for the review! Looks like I also progressed an existing layout test (which needs to be rebaselined) |
Collaborator
|
EWS run on current version of this PR (hash e9988d2) Details |
… while maintaining DOM structure https://bugs.webkit.org/show_bug.cgi?id=308832 rdar://171240021 Reviewed by Abrar Rahman Protyasha. Make some adjustments to the `_WKTextExtraction` SPI surface; see below for more details. Test: TextExtractionTests.MinimalHTMLOutput * Source/WebKit/Shared/TextExtractionToStringConversion.cpp: (WebKit::TextExtractionAggregator::addResult): (WebKit::TextExtractionAggregator::includeRects const): (WebKit::TextExtractionAggregator::includeURLs const): (WebKit::TextExtractionAggregator::usePlainTextOutput const): (WebKit::TextExtractionAggregator::addNativeMenuItemsIfNeeded): Rename several helper methods, in light of the new plain text output type. (WebKit::addPartsForItem): (WebKit::addTextRepresentationRecursive): (WebKit::TextExtractionAggregator::onlyIncludeText const): Deleted. * Source/WebKit/Shared/TextExtractionToStringConversion.h: * Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm: (textExtractionOutputFormat): (-[WKWebView _extractDebugTextWithConfigurationWithoutUpdatingFilterRules:assertionScope:completionHandler:]): * Source/WebKit/UIProcess/API/Cocoa/_WKTextExtraction.h: Deprecate `+configurationForVisibleTextOnly`, and replace it with a new enum value which represents only plain text: `_WKTextExtractionOutputFormatPlainText`. Previously, making a new configuration with `configurationForVisibleTextOnly` would yield a configuration that only supported _some_ of the relevant configuration options. However, this is inconsistent with how the rest of the extraction formatting options work, such as markdown — configuration flags that don't make sense for the output format are simply ignored. * Source/WebKit/UIProcess/API/Cocoa/_WKTextExtraction.mm: (-[_WKTextExtractionConfiguration init]): (+[_WKTextExtractionConfiguration configurationForVisibleTextOnly]): (-[_WKTextExtractionConfiguration configureForMinimalOutput]): Add a convenience method to reset all extraction configuration parameters back to values that ensure minimal output text. For clients that need to ensure minimal output, but still might want to preserve specific types of data, they can use `-configureForMinimalOutput` and then enable only what they need. In the future, we should consider making the default initialized `_WKTextExtractionConfiguration` start at this minimal output, rather than defaulting to text tree (with various bits of information included, such as bounding rects and URLs). (-[_WKTextExtractionConfiguration setIncludeEventListeners:]): (-[_WKTextExtractionConfiguration _initForOnlyVisibleText:]): Deleted. (-[_WKTextExtractionConfiguration setIncludeURLs:]): Deleted. (-[_WKTextExtractionConfiguration setIncludeRects:]): Deleted. (-[_WKTextExtractionConfiguration setNodeIdentifierInclusion:]): Deleted. (-[_WKTextExtractionConfiguration setEventListenerCategories:]): Deleted. (-[_WKTextExtractionConfiguration setIncludeAccessibilityAttributes:]): Deleted. (-[_WKTextExtractionConfiguration setIncludeTextInAutoFilledControls:]): Deleted. (-[_WKTextExtractionConfiguration setOutputFormat:]): Deleted. (-[_WKTextExtractionConfiguration setShortenURLs:]): Deleted. * Source/WebKit/UIProcess/API/Cocoa/_WKTextExtractionInternal.h: * Tools/TestWebKitAPI/Tests/WebKitCocoa/TextExtractionTests.mm: (TestWebKitAPI::TEST(TextExtractionTests, VisibleTextOnly)): (TestWebKitAPI::TEST(TextExtractionTests, MinimalHTMLOutput)): Canonical link: https://commits.webkit.org/308380@main
e9988d2 to
d9fb211
Compare
Collaborator
|
Committed 308380@main (d9fb211): https://commits.webkit.org/308380@main Reviewed commits have been landed. Closing PR #59605 and removing active labels. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🛠 mac-apple
d9fb211
e9988d2