Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: a558e183c53fc32f9e6f3fff2215eae973f5ae79
https://github.com/WebKit/WebKit/commit/a558e183c53fc32f9e6f3fff2215eae973f5ae79
Author: Wenson Hsieh <[email protected]>
Date: 2026-06-24 (Wed, 24 Jun 2026)
Changed paths:
M Source/WebCore/page/text-extraction/TextExtraction.cpp
M Tools/TestWebKitAPI/Tests/WebKit/WKWebView/TextExtractionTests.mm
Log Message:
-----------
[Text Extraction] `scroll` should search the rest of the document if the
target text isn't contained in the given node
https://bugs.webkit.org/show_bug.cgi?id=317689
rdar://180449831
Reviewed by Abrar Rahman Protyasha.
Be a bit more forgiving, in the case where the agent provides both a search
string (`text`) and a
target container `node` when attempting to scroll; if the target `node` doesn't
contain the target
text, fall back to searching the rest of the document, from the target node. In
practice, if the
text extraction looks like this:
```
button uid=2742 Edit
Shopping Preference
Preference
Not Set
button uid=2743 Edit
Email & Password
Email Preferences
```
...and the agent wants to scroll to 'Email & Password', it occasionally issues
something like
`scroll(node='2743', text='Email & Password')` which fails because the Edit
button doesn't
literally contain the target text. Address this by giving text in the target
node priority, but
automatically fall back to searching from the target node onwards if the search
text is not found.
Test: TextExtractionTests.ScrollToRevealFallsBackToFullDocumentWhenNodeMisses
* Source/WebCore/page/text-extraction/TextExtraction.cpp:
(WebCore::TextExtraction::scrollToReveal):
* Tools/TestWebKitAPI/Tests/WebKit/WKWebView/TextExtractionTests.mm:
(TestWebKitAPI::ScrollToRevealFallsBackToFullDocumentWhenNodeMisses)):
(TestWebKitAPI::ClickInteractionWhileInBackground)): Deleted.
Canonical link: https://commits.webkit.org/315746@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications