Skip to content

Pointer leave/enter re-hit-tests after unrelated tree changes #25397

Open

Description

@MartinZikmund

What would you like to be added? 💡

Skip the second hit test that PointerManager.RaiseLeaveEnter runs after a leave or enter handler flags the tree as altered, when the original source is still live and hit-test visible.

Why is this needed? 🤔

A handler that removes, collapses or recycles an element anywhere sets VisualTreeAltered. The pointer manager then runs a full hit test again, even when the removed element was not the original source or one of its ancestors. In that case the result cannot change, because layout has not run since the first hit test.

Rounded GridView items (the WinUI ListViewItemPresenter chrome adopted in #25389) remove their hover border on pointer exit. So every pointer move between items hit-tests twice. Hit testing already visits the whole tree (#24815), so this doubles the cost of a hover: on a 1,000-tile GridView, synchronous hover time drops from 25 ms to 12 ms without the second pass.

For which platforms 📱💻🖥️

Skia (all heads), WebAssembly

Anything else we need to know? 💬

Related: #24815 (no subtree bounds pruning in hit testing).

Activity

  1. added
    kind/enhancement
    project/pointers 🖱️
    on Oct 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

area/performancekind/enhancementproject/pointers 🖱️

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions