Repository navigation
Conversation
The widget heuristic in parse_tree treats a node at (0,0) as the start of relative coordinates and adds its parent's position to everything below. Inside a WKWebView there is a node that reports (0,0) at the WebView's own size, while the web elements under it use screen coordinates. With the WebView below a navigation bar (an app's in-app browser, y=100) every element came out 100 pt too low, and tapping by text hit the next row. Safari's WebView starts at y=0, so it never showed there. A WebView and everything inside it are now left out of the heuristic. Regression case #145; unit test web_contents_keep_screen_coordinates. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
6 tasks done
This branch has not been deployed
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.
What and why
parse_treetreats a node at (0,0) that has its parent's size, under a parent not at (0,0), as the start of a widget's relative coordinates, and adds the parent's position to everything below it. Inside a WKWebView there is a node exactly like that: it reports (0,0) at the WebView's own size. The web elements under it, though, report screen coordinates. So when the WebView sits below a navigation bar (an app's in-app browser, WebView at y=100), every element inside came out 100 pt too low, andiphone_tap_elementtapped the row underneath. Safari's WebView starts at y=0, which is why it never showed there.A WebView and everything inside it are now left out of the widget heuristic (
Open.in_web). Widgets outside web content are unchanged.Tests
1. Unit tests
cargo test --workspace --all-features --locked,cargo clippy --workspace --all-targets --all-features --locked -- -D warningsandcargo fmt --check(per package) pass (Rust 1.99.1, macOS)elements::tests::web_contents_keep_screen_coordinates(tree shape taken from the real page: NavigationBar, WebView at y=100, inner node at (0,0) with the WebView's size, text at y=375). It fails on main with (59,488) and passes with the fix at (59,388)#[ignore]tests of the changed area run by hand: none apply2. Real-device regression
tests/device/run.pydefault steps pass on this branch (exit code 0): 14 calls, 0 failed, 10.7 siphone_list_elementswith a filter on two headings, theniphone_tap_elementon a heading and on a link; compared each position with the screenshotrun.py output
3. Regression cases (docs/dev/regression-cases.md)
4. Real-device proof of the fix or feature
Steps and results (before / after)
Same in-app browser page, same scroll position. On the screenshot the first heading's text is centred at about (59,388) and the second at about (59,595). Page texts are replaced with placeholders.
Checklist
🤖 Generated with Claude Code