Repository navigation
feat(composition): Snap frame times to the display interval - #24966
MartinZikmund wants to merge 12 commits into
Conversation
|
Claude finished @MartinZikmund's task in 2m 32s —— View job Review in progress
|
9efc4a9 to
f7277e1
Compare
549b543 to
43adc32
Compare
|
Claude finished @MartinZikmund's task in 5m 25s —— View job Review complete ✅
Verdict: fix-first2 findings posted inline, both test-coverage/quality issues — no bugs found in
Cross-cutting notes
|
|
|
||
| /// <summary>A notch arriving mid-motion restarts the curve over what is left plus the notch, so a spin only speeds up.</summary> | ||
| [TestMethod] | ||
| public async Task When_Wheel_Spins_Then_Velocity_Never_Drops_At_A_Notch() |
There was a problem hiding this comment.
Per the PR description this test is known flaky (failed 2/5 locally without the grid, 1/11 with it), with the suspected root cause (inertia handler's first tick returning early while HasEntered is false) still "to be investigated" and not fixed in this PR.
Landing a self-reported-flaky test active (not [Ignore]d) risks intermittent CI failures/red herrings for unrelated PRs. The repo already has a convention for this — see Given_ScrollViewerTests/Given_ScrollViewer_ScrollChaining.cs:103:
[Ignore("Flaky on all targets, not one platform - https://github.com/unoplatform/uno/issues/24489")]Consider either quarantining this test the same way with a tracking issue link until the root cause above is fixed, or filing that tracking issue now and referencing it in a comment so the flakiness isn't silently reintroduced/forgotten.
f7277e1 to
fe26434
Compare
43adc32 to
a36ed5a
Compare
|
Claude finished @MartinZikmund's task in 1m 12s —— View job Review complete ✅
Verdict: fix-first (unchanged)HEAD is still
No new issues found. Branch · |
fe26434 to
3e0d7b5
Compare
a36ed5a to
345e8ae
Compare
aea1971 to
1df904d
Compare
345e8ae to
7c2035a
Compare
fc611c9 to
d623ecb
Compare
7c2035a to
2b46ec1
Compare
d623ecb to
d31bb38
Compare
2b46ec1 to
4fa750c
Compare
d31bb38 to
bc553b9
Compare
bc553b9 to
dbc5d68
Compare
b2fc212 to
b92f588
Compare
dbc5d68 to
43f22d7
Compare
Arrow, Page, Home and End keys teleported the offset. WinUI animates them (through DManip), so glide instead, on the same curve as the wheel: each press retargets the glide in flight, so a held key's auto-repeat keeps one motion, and the next press is measured from where the glide will rest. The glide lands exactly on the requested offset. Snap points and the offset intent are applied as for ChangeView, and the handled/focus logic is unchanged. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_016WqaiNE2QBeUszQFongehx
The existing keyboard tests now wait for the glide to settle before reading the offset. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_016WqaiNE2QBeUszQFongehx
Page Up/Down, Home and End now animate like an animated ChangeView, with ScrollPresenter's easing and distance-scaled duration, instead of on the wheel's decay. Arrows keep the decay glide. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_016WqaiNE2QBeUszQFongehx
Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_016WqaiNE2QBeUszQFongehx
Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01G7PsEU6gSpLZXrYuK8WWpt
Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01G7PsEU6gSpLZXrYuK8WWpt
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Frames present one per vsync, but the UI thread reaches each frame with milliseconds of jitter, and motion evaluated against that raw instant turns it into v·Δt of position error. Phase-lock the frame times onto the median frame interval: advance by whole frames, correct a sixteenth of the phase error per frame, cap the lead at half a period, and never step back. Idle gaps re-anchor on the real clock. This compensates for sampling the time on the UI thread after the dispatcher hop; native vsync timestamps (#24963) would make it a fallback for hosts that have none. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_014tR98SJixdXBRVuRo69Pek
Restores the grid tests split out of #24735: even steps under jitter, no drift, a dropped frame stepping twice, re-anchoring after idle, never stepping back, and no freeze after a hitch or a slower motion. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_014tR98SJixdXBRVuRo69Pek
Moved here from the WinUI wheel curve PR: it asserts frame-to-frame smoothness, which only holds once frame times sit on the display interval. On raw frame times two frames can land almost together, and the step between them collapses. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_014tR98SJixdXBRVuRo69Pek
Co-Authored-By: Claude Opus 5.5 <[email protected]>
b92f588 to
c823977
Compare
07d4ce5 to
a659c1e
Compare

GitHub Issue: Part of #23985, related to #24963
PR Type:
✨ Feature
What changed? 🚀
Before
#24735 gives every frame one timestamp, but that timestamp is the raw clock, read on the UI thread after the native frame callback has been marshalled through the dispatcher. It carries a few ms of random queuing delay, and motion evaluated against it (a scroll at speed v) turns that into v·Δt of uneven stepping.
After
FrameClock.NextTimestampphase-locks the frame times to the display interval it estimates from the median of the last 32 frame intervals:This was part of #24735 and was split out so the stack can land without it, and so it can be reworked into a timestamp-driven solution.
Known limitations (why this is a stepping stone)
The other frameworks don't need this, because they take the frame time from the vsync signal itself (WinUI's compositor scheduler thread, Flutter's
handleBeginFrame, Android'sChoreographer, browserrequestAnimationFrame). Here the grid has to be rebuilt from samples, which misbehaves when the refresh rate changes. A simulation of this exact algorithm with ±1.5 ms of jitter, where raw sampling gives about 1.2 ms RMS step error:So on ProMotion and variable-refresh displays it is worse than the raw clock for up to 0.8 s after each rate change. It is also meaningless on hosts that aren't paced to vsync (the Linux framebuffer measures sub-ms intervals).
Plan: rework this PR along #24963. Hosts that have a vsync timestamp pass it into
OnNativePlatformFrameRequestedand bypass the grid: iOSCADisplayLink, WASMrequestAnimationFrameand Linux DRM page-flip already receive one and drop it. Snapping stays only as the fallback for hosts that have none, and gets a fast reset when the intervals change.PR Checklist ✅
Screenshots Compare Test Runresults.Tests:
Given_Compositorframe-clock tests: even steps under jitter, no drift, a dropped frame stepping twice, re-anchoring after idle, never stepping back, no freeze after a hitch or after a slower motion.Given_ScrollView.When_Wheel_Spins_Then_Velocity_Never_Drops_At_A_Notch, moved here from fix(scrollview): Scroll by wheel like WinUI's ScrollView #24738 because it asserts frame-to-frame smoothness. Known flaky: it failed 2/5 locally without the grid and 1/11 with it, always as a near-zero step at a notch ("slowed from 1.58 to 0.01 DIP/frame"). The suspected cause is in the stack, not the grid: the new inertia handler's first tick returns early whileInteractionTracker.State.HasEnteredis false, so one frame doesn't move. To be investigated.Local runs (Skia Win32):
Given_Compositor+Given_CompositionTarget+Given_ScrollView35/36, with the one failure being the flake above.🤖 Generated with Claude Code
https://claude.ai/code/session_014tR98SJixdXBRVuRo69Pek