Repository navigation
perf(input): Skip re-hit-testing a source that is still valid - #25404
MartinZikmund wants to merge 4 commits into
Conversation
When a pointer leave or enter handler removed or collapsed an element, the pointer manager ran a second full hit test. Rounded GridView items (ListViewItemPresenter chrome) remove their hover border on exit, so every pointer move between items hit-tested twice. The source is now kept unless it, or an ancestor, is no longer live and hit-test visible. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Vi68uWCYVXxhcX9m6JEwSC
Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Vi68uWCYVXxhcX9m6JEwSC
HitTestIfStale, used on the press and cancel paths, now follows the same rule as RaiseLeaveEnter, and VisualTreeAltered documents what it covers. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Vi68uWCYVXxhcX9m6JEwSC
Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Vi68uWCYVXxhcX9m6JEwSC
|
Claude finished @MartinZikmund's task in 18s —— View job Review of #25404Verdict: ship. I found no blocking issues, so I posted no inline comments (0 high, 0 medium, 2 low notes). I reviewed the diff by inspection. I did not build or run anything.
Low notes (non-blocking):
Code style is fine: tabs, braces, and a short comment that explains why. |
|
🤖 Your WebAssembly Skia Sample App stage site is ready! Visit it here: https://unowasmprstaging.z20.web.core.windows.net/pr-25404/wasm-skia-net9/index.html |
|
The build 239293 found UI Test snapshots differences: Details
|
|
|
GridView stays on GridViewItemExpanded until its perf PRs (#25403, #25404, #25406, #25409, #25411, #25413) land. Apps opt into WinUI's chrome with DefaultGridViewItemStyle. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01TXMNu2NWgGKJFTAYtNHkvT
The implicit GridViewItem style is BasedOn DefaultGridViewItemStyle again, as in WinUI, so default GridView items render through the ListViewItemPresenter chrome and default to AllowDrop=True. The Fluent GridViewItemExpanded is removed. Merge after #25403, #25404, #25406, #25409, #25411 and #25413. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01TXMNu2NWgGKJFTAYtNHkvT
GridView stays on GridViewItemExpanded until its perf PRs (#25403, #25404, #25406, #25409, #25411, #25413) land. Apps opt into WinUI's chrome with DefaultGridViewItemStyle. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01TXMNu2NWgGKJFTAYtNHkvT
morning4coffe-dev
left a comment
There was a problem hiding this comment.
I compared this with WinUI's PointerInputProcessor::ProcessPointerInput (components/ContentRoot/PointerInputProcessor.cpp). WinUI hit-tests once per input (HitTestWithLightDismissAwareness) and raises enter/leave and then moved/pressed on that same contact element, without re-hit-testing after the handlers. So keeping a source that's still live and hit-test visible brings us closer to WinUI. The VisualTreeAltered cases (remove, collapse, unload, recycle) can only take the source out or hide it, and IsStillHitTarget covers both. One small suggestion inline.
| #region Helpers | ||
|
|
||
| // The tree is flagged as altered when an element is removed, collapsed or recycled. A source that is still live and | ||
| // hit-test visible is kept, as WinUI dispatches all the events of an input from a single hit test. |
There was a problem hiding this comment.
Could you add a pointer to the WinUI source here, so nobody "fixes" it back later? PointerInputProcessor::ProcessPointerInput (components/ContentRoot/PointerInputProcessor.cpp) does a single HitTestWithLightDismissAwareness and then raises ProcessPointerEnterLeave and PointerMoved on the same spDOContact, never re-hit-testing after the handlers. Something like // WinUI hit-tests once per input (PointerInputProcessor::ProcessPointerInput).
|
Tick the box to add this pull request to the merge queue (same as
|
GridView stays on GridViewItemExpanded until its perf PRs (#25403, #25404, #25406, #25409, #25411, #25413) land. Apps opt into WinUI's chrome with DefaultGridViewItemStyle. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01TXMNu2NWgGKJFTAYtNHkvT
GridView stays on GridViewItemExpanded until its perf PRs (#25403, #25404, #25406, #25409, #25411, #25413) land. Apps opt into WinUI's chrome with DefaultGridViewItemStyle. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01TXMNu2NWgGKJFTAYtNHkvT
GridView stays on GridViewItemExpanded until its perf PRs (#25403, #25404, #25406, #25409, #25411, #25413) land. Apps opt into WinUI's chrome with DefaultGridViewItemStyle. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01TXMNu2NWgGKJFTAYtNHkvT
GridView stays on GridViewItemExpanded until its perf PRs (#25403, #25404, #25406, #25409, #25411, #25413) land. Apps opt into WinUI's chrome with DefaultGridViewItemStyle. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01TXMNu2NWgGKJFTAYtNHkvT
GridView stays on GridViewItemExpanded until its perf PRs (#25403, #25404, #25406, #25409, #25411, #25413) land. Apps opt into WinUI's chrome with DefaultGridViewItemStyle. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01TXMNu2NWgGKJFTAYtNHkvT
GridView stays on GridViewItemExpanded until its perf PRs (#25403, #25404, #25406, #25409, #25411, #25413) land. Apps opt into WinUI's chrome with DefaultGridViewItemStyle. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01TXMNu2NWgGKJFTAYtNHkvT
GridView stays on GridViewItemExpanded until its perf PRs (#25403, #25404, #25406, #25409, #25411, #25413) land. Apps opt into WinUI's chrome with DefaultGridViewItemStyle. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01TXMNu2NWgGKJFTAYtNHkvT
GridView stays on GridViewItemExpanded until its perf PRs (#25403, #25404, #25406, #25409, #25411, #25413) land. Apps opt into WinUI's chrome with DefaultGridViewItemStyle. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01TXMNu2NWgGKJFTAYtNHkvT
GridView stays on GridViewItemExpanded until its perf PRs (#25403, #25404, #25406, #25409, #25411, #25413) land. Apps opt into WinUI's chrome with DefaultGridViewItemStyle. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01TXMNu2NWgGKJFTAYtNHkvT
GridView stays on GridViewItemExpanded until its perf PRs (#25403, #25404, #25406, #25409, #25411, #25413) land. Apps opt into WinUI's chrome with DefaultGridViewItemStyle. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01TXMNu2NWgGKJFTAYtNHkvT
GridView stays on GridViewItemExpanded until its perf PRs (#25403, #25404, #25406, #25409, #25411, #25413) land. Apps opt into WinUI's chrome with DefaultGridViewItemStyle. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01TXMNu2NWgGKJFTAYtNHkvT
GridView stays on GridViewItemExpanded until its perf PRs (#25403, #25404, #25406, #25409, #25411, #25413) land. Apps opt into WinUI's chrome with DefaultGridViewItemStyle. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01TXMNu2NWgGKJFTAYtNHkvT
GitHub Issue: closes #25397
PR Type:
✨ Feature (performance)
What changed? 🚀
When a pointer leave or enter handler removes, collapses or recycles an element,
VisualTreeAlteredis set. The pointer manager then ran a second full hit test, even when the removed element was neither the original source nor one of its ancestors. The source is now kept while it is still live and hit-test visible. This applies toRaiseLeaveEnterandHitTestIfStalealike, matching WinUI, which dispatches all the events of one input from a single hit test. TheVisualTreeAltereddoc now states what sets it.Motivating case: #25389. Its rounded GridView chrome (WinUI's
ListViewItemPresenter) removes the hover border on pointer exit, so every pointer move between items hit-tested twice. Hit testing visits the whole tree (#24815), so on a 1,000-tile GridView the synchronous hover cost drops from 24.6 ms to 12.3 ms (3 rounds, Win32 Skia, stacked on #25389).When the source itself, or an ancestor, is removed or collapsed, a new hit test still runs.
When_VisibilityChangesWhileDispatching_Then_RecomputeOriginalSourcecovers that case.Validation, runtime (Skia desktop):
Given_InputManager,Given_UIElementandGiven_ContextRequestedpass (628). The newWhen_LeaveRemovesUnrelatedElement_Then_OriginalSourceNotHitTestedAgainfails without the change (2 hit tests) and passes with it.PR Checklist ✅
Screenshots Compare Test Runresults.🤖 Generated with Claude Code
https://claude.ai/code/session_01Vi68uWCYVXxhcX9m6JEwSC