Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 11f71f89d0d3a53764a2e414e52ddea4c4cabebc
https://github.com/WebKit/WebKit/commit/11f71f89d0d3a53764a2e414e52ddea4c4cabebc
Author: Wenson Hsieh <[email protected]>
Date: 2026-06-17 (Wed, 17 Jun 2026)
Changed paths:
M LayoutTests/fast/text-extraction/debug-text-extraction-basic-expected.txt
M LayoutTests/fast/text-extraction/debug-text-extraction-basic.html
M Source/WebKit/Shared/TextExtractionToStringConversion.cpp
Log Message:
-----------
[Text Extraction] Rearrange any single text child to be next to its enclosing
button or link when retrieving as text tree
https://bugs.webkit.org/show_bug.cgi?id=317273
rdar://179883896
Reviewed by Abrar Rahman Protyasha.
For buttons and links with a single text child (but with other children), such
as:
```
button uid=101
image uid=102 src=pluscircle.svg alt=expand
'Password'
link uid=103 url=/2fa
image uid=104 src=pluscircle.svg alt=expand
'2-factor authentication (2FA)'
```
When extracting as text tree, automatically reorder the child elements so that
the single text
child is on the same line as the button/link:
```
button uid=101 'Password'
image uid=102 src=pluscircle.svg alt=expand
link uid=103 url=/2fa '2-factor authentication (2FA)'
image uid=104 src=pluscircle.svg alt=expand
```
In practice, this helps prevent the agent from (for instance) misreading the
structure of the page,
and confuse `uid=103` as a button that expands a password update section (as
opposed to 2FA).
* LayoutTests/fast/text-extraction/debug-text-extraction-basic-expected.txt:
* LayoutTests/fast/text-extraction/debug-text-extraction-basic.html:
* Source/WebKit/Shared/TextExtractionToStringConversion.cpp:
(WebKit::addTextRepresentationRecursive):
Canonical link: https://commits.webkit.org/315371@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications