Skip to content

Conversation

@whsieh
Copy link
Member

@whsieh whsieh commented Dec 19, 2025

f17dbea

[AutoFill Debugging] Add form elements and more text form control DOM attributes
https://bugs.webkit.org/show_bug.cgi?id=304508
rdar://166750217

Reviewed by Aditya Keerthi.

Add several new DOM attributes to the text extraction output on text fields:

- `pattern`
- `minlength`
- `maxlength`
- `name`

...and also introduce a new container type, `form`, which represents a `form` element with
attributes:

- `name`
- `autocomplete`

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

Augment an existing test to include a new `form` that contains a few text fields.

* Source/WebCore/page/text-extraction/TextExtraction.cpp:
(WebCore::TextExtraction::extractItemData):
* Source/WebCore/page/text-extraction/TextExtractionTypes.h:
* Source/WebKit/Shared/TextExtractionToStringConversion.cpp:
(WebKit::addPartsForItem):
(WebKit::addTextRepresentationRecursive):

Drive-by fix: address an issue where a single text child node can be incorrectly flagged as
"redundant with the HREF" in the case where the client has opted out of including URLs. I spotted
this while looking through the augmented layout test's HTML text representation above, since the
anchor tags were just getting surfaced as `<a>` with no text or href.

* Source/WebKit/Shared/WebCoreArgumentCoders.serialization.in:
* Source/WebKit/UIProcess/API/Cocoa/_WKTextExtraction.swift:
* Source/WebKit/UIProcess/API/Cocoa/_WKTextExtractionInternal.h:
* Source/WebKit/UIProcess/Cocoa/TextExtraction/WKTextExtractionUtilities.mm:
(WebKit::createItemWithChildren):
* Tools/WebKitTestRunner/cocoa/WKTextExtractionTestingHelpers.mm:
(WTR::buildDescriptionIgnoringChildren):

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

9eac033

Misc iOS, visionOS, tvOS & watchOS macOS Linux Windows Apple Internal
✅ 🧪 style ✅ 🛠 ios ✅ 🛠 mac ✅ 🛠 wpe 🛠 win ✅ 🛠 ios-apple
✅ 🧪 bindings ✅ 🛠 ios-sim ✅ 🛠 mac-AS-debug ✅ 🧪 wpe-wk2 🧪 win-tests ✅ 🛠 mac-apple
✅ 🧪 webkitperl ✅ 🧪 ios-wk2 ✅ 🧪 api-mac loading 🧪 api-wpe loading 🛠 vision-apple
✅ 🧪 ios-wk2-wpt ✅ 🧪 api-mac-debug ✅ 🛠 wpe-cairo-libwebrtc
✅ 🧪 api-ios ✅ 🧪 mac-wk1 ✅ 🛠 gtk
✅ 🛠 vision ✅ 🧪 mac-wk2 ✅ 🧪 gtk-wk2
✅ 🛠 vision-sim ✅ 🧪 mac-AS-debug-wk2 ✅ 🧪 api-gtk
✅ 🛠 🧪 merge ✅ 🧪 vision-wk2 ✅ 🧪 mac-wk2-stress ✅ 🛠 playstation
✅ 🛠 tv ✅ 🧪 mac-intel-wk2
✅ 🛠 tv-sim ✅ 🛠 mac-safer-cpp
✅ 🛠 watch
✅ 🛠 watch-sim

@whsieh whsieh self-assigned this Dec 19, 2025
@whsieh whsieh added the New Bugs Unclassified bugs are placed in this component until the correct component can be determined. label Dec 19, 2025
@whsieh whsieh added the merge-queue Applied to send a pull request to merge-queue label Dec 19, 2025
@whsieh
Copy link
Member Author

whsieh commented Dec 19, 2025

Thanks for the review!

… attributes

https://bugs.webkit.org/show_bug.cgi?id=304508
rdar://166750217

Reviewed by Aditya Keerthi.

Add several new DOM attributes to the text extraction output on text fields:

- `pattern`
- `minlength`
- `maxlength`
- `name`

...and also introduce a new container type, `form`, which represents a `form` element with
attributes:

- `name`
- `autocomplete`

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

Augment an existing test to include a new `form` that contains a few text fields.

* Source/WebCore/page/text-extraction/TextExtraction.cpp:
(WebCore::TextExtraction::extractItemData):
* Source/WebCore/page/text-extraction/TextExtractionTypes.h:
* Source/WebKit/Shared/TextExtractionToStringConversion.cpp:
(WebKit::addPartsForItem):
(WebKit::addTextRepresentationRecursive):

Drive-by fix: address an issue where a single text child node can be incorrectly flagged as
"redundant with the HREF" in the case where the client has opted out of including URLs. I spotted
this while looking through the augmented layout test's HTML text representation above, since the
anchor tags were just getting surfaced as `<a>` with no text or href.

* Source/WebKit/Shared/WebCoreArgumentCoders.serialization.in:
* Source/WebKit/UIProcess/API/Cocoa/_WKTextExtraction.swift:
* Source/WebKit/UIProcess/API/Cocoa/_WKTextExtractionInternal.h:
* Source/WebKit/UIProcess/Cocoa/TextExtraction/WKTextExtractionUtilities.mm:
(WebKit::createItemWithChildren):
* Tools/WebKitTestRunner/cocoa/WKTextExtractionTestingHelpers.mm:
(WTR::buildDescriptionIgnoringChildren):

Canonical link: https://commits.webkit.org/304785@main
@webkit-commit-queue
Copy link
Collaborator

Committed 304785@main (f17dbea): https://commits.webkit.org/304785@main

Reviewed commits have been landed. Closing PR #55716 and removing active labels.

@webkit-commit-queue webkit-commit-queue merged commit f17dbea into WebKit:main Dec 19, 2025
@webkit-commit-queue webkit-commit-queue removed the merge-queue Applied to send a pull request to merge-queue label Dec 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

New Bugs Unclassified bugs are placed in this component until the correct component can be determined.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants