SIGN IN SIGN UP

perf(android): Hit-test gestures without getLocationOnScreen (#5595)

* perf(android): Hit-test gestures without getLocationOnScreen (JAVA-534)

ViewUtils.findTarget called View.getLocationOnScreen for every visited
view, and that walks from the view up to the root each time, making the
traversal O(N*depth) per tap and scroll start.

Instead, map the touch point down into each child's local coordinate
space as we descend the tree — the same way ViewGroup dispatches touch
events — so each view costs O(1) and the whole traversal is O(N). The
locators still receive the original decor-view-relative coordinates,
since the Compose locator hit-tests against window coordinates.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* changelog

* Update changelog

* test(android): Cover scroll and child matrix in findTarget hit-testing (JAVA-534)

The existing test only exercised the left/top offset path of mapToChild.
Add cases for a scrolled parent and a non-identity child matrix so the
other two coordinate-mapping branches are covered, and switch the class
to Robolectric so the real Matrix math runs.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* Move changelog entry to Unreleased as a performance improvement

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
N
Nelson Osacky committed
d8b6ce11cabd05be9a3f03a1d20fe247956d091d
Parent: c453856
Committed by GitHub <noreply@github.com> on 6/26/2026, 8:52:36 AM