Skip to content

fix(scrollview): Tick InteractionTracker inertia per frame - #24736

Merged
MartinZikmund merged 12 commits into
masterfrom
dev/mazi/scroll-tracker-per-frame
Oct 8, 2026
Merged

MartinZikmund merged 12 commits into
masterfrom
dev/mazi/scroll-tracker-per-frame

Conversation

@MartinZikmund

@MartinZikmund MartinZikmund commented Sep 25, 2026 •

Copy link
Copy Markdown
Member

GitHub Issue: closes #24730

Part of the scroll-smoothness series. Builds on the per-frame clock (CompositionTarget.FrameStarting) from #24735, now merged.

PR Type:

🐞 Bugfix

What changed? 🚀

The problem

ScrollView scrolls through an InteractionTracker. On Uno, the tracker's touch inertia (fling) and mouse-wheel motion were advanced by a 17 ms System.Threading.Timer on the thread pool, which wrote the tracker's position and state from that thread. Consequences:

  • Content moved at most ~59 times per second, beating against the display. On 120 Hz screens, half the presented frames repeated the previous position.
  • The tracker raced the UI thread (cross-thread writes to tracker state).
  • The rendered frame lagged the tracker by one dispatcher hop, because the position change was raised from a queued continuation.
  • Touchpad wheel deltas smaller than one detent (MouseWheelDelta < 120) were integer-divided to 0, so slow two-finger touchpad scrolling did nothing.
  • A finger pressed on a coasting ScrollView did not stop it until the finger moved past the drag threshold.

What this PR does

# Change Where
1 Inertia runs per frame on the UI thread. Both inertia handlers (touch fling and wheel) now subscribe to their composition target's FrameStarting and compute the position from the frame timestamp. The thread-pool timers are gone. A new shared base class, InteractionTrackerFrameInertiaHandler, holds the subscribe/unsubscribe and timing logic, so each handler only implements Advance(elapsed). InteractionTrackerFrameInertiaHandler, *InertiaHandler, ICompositionTarget.FrameStarting
2 The recorded frame shows the tracker's current position. SetPosition now raises the Position property change synchronously, so the Translation expression bound to it is updated before the frame is recorded. IInteractionTrackerOwner.ValuesChanged stays queued, as before. InteractionTracker.SetPosition
3 Wheel deltas are fractional. ReceivePointerWheel takes a double number of detents, so a 30-unit touchpad delta scrolls a quarter of a detent instead of nothing. InputManager.Pointers.Managed, tracker states
4 A pressed finger stops a coasting ScrollView. The tracker switches from Inertia to Interacting as soon as the finger touches down, not once it has moved. When the tracker takes over inertia, the gesture recognizer's own inertia ends, since nothing applies its updates. InputManager.Pointers.ManagedDirectManip, InteractionTrackerInertiaState / InteractingState

WinUI parity

  • Frame cadence (1, 2): in WinUI the tracker runs in the compositor (DComp) and advances once per composition frame. The expressions that read tracker.Position are evaluated in that same frame. Per-frame ticking with a synchronous position change matches that. The "60 FPS" in the old code comment comes from an outdated docs line, not from how the compositor actually behaves.
  • Fractional wheel (3): WinUI's wheel math scales the raw delta proportionally: delta * max(48, 15% of viewport) / 120 (GetVerticalScrollWheelDelta, TextBoxView.cpp), with no integer division. Precision touchpads go to the tracker directly (VisualInteractionSourceRedirectionMode.CapableTouchpadAndPointerWheel in ScrollPresenter::SetupVisualInteractionSourceRedirectionMode).
  • Press stops inertia (4): WinUI's ScrollPresenter::OnPointerPressed calls VisualInteractionSource.TryRedirectForManipulation on touch down, which hands the contact to the tracker straight away. ScrollPresenter::InteractingStateEntered already handles the Inertia → Interacting transition. Uno's OnStarting hook runs on the press for the same reason.

Known limitation

A free-standing InteractionTracker with no VisualInteractionSource has no visual to name its window, so it is driven by the first window's composition target (Compositor.FrameDriverTargetResolver, marked TODO Uno). This does not affect ScrollView/ScrollPresenter, which always attach a source.

Evidence

Measured on Win32 at 119 Hz with the scroll-smoothness probe from #24711 (sample=Scrolling/ScrollSmoothnessTester&scrollprobe=...). "newFps" counts the presented frames per second that show a newly recorded frame.

Input Before After
Touch fling 68 119
Mouse wheel 55 120
Touchpad 0 (no scroll) 120

Galaxy Z Fold7 (120 Hz) and iPhone 13 Pro (120 Hz) show the same pattern: ~55–70 → 117–120.

New runtime tests in Given_ScrollView cover one change each: a sub-detent wheel delta scrolls, every recorded frame shows the tracker's position, and a finger held on coasting content stops it. Full runtime suite (Skia Win32, 150% scale): no new failures versus master. The remaining failures are pre-existing (ListViewBase ×6, ScrollPresenterTests ×3 at fractional scale).

PR Checklist ✅

🤖 Generated with Claude Code

https://claude.ai/code/session_01LtnnfqgXbPx1pR2QSUWcGj

@github-actions github-actions Bot added the area/skia ✏️ Categorizes an issue or PR as relevant to Skia label Sep 25, 2026
@github-actions

github-actions Bot commented Sep 25, 2026 •

Copy link
Copy Markdown
Contributor

Claude finished @MartinZikmund's task in 6m 53s —— View job


Review complete

Verdict: ship — the per-frame retick is a solid, well-reasoned replacement for the thread-pool timers, and the state-machine edge cases (interrupt-under-a-held-finger, abort-without-move, reentrant CompleteGesture() during inertia-starting) are all correctly handled.

Findings: 2, both low severity / non-blocking (posted inline)

  1. Duplication (InteractionTrackerActiveInputInertiaHandler.cs / InteractionTrackerPointerWheelInertiaHandler.cs) — the _target/_handler/_startTimestamp fields and the Start()/Stop()/timestamp-bootstrap/Complete() scaffolding are near-identical across both inertia handlers; a shared base would remove ~30 duplicated lines.
  2. Fragile sentinel (InteractionTrackerPointerWheelInertiaHandler.cs:83, same pattern in the touch handler) — _startTimestamp == 0 as a "not started" marker could theoretically collide with a legitimately-computed 0. Practically impossible given Stopwatch.GetTimestamp()-based timestamps, but a long?/bool flag would remove the fragility outright.

What I verified while reviewing (no issue found):

  • FrameStarting is correctly wired before layout/before the record (CoreServices.UpdateLayoutForAllRoots → CompositionTarget.RaiseFrameTick()), and both inertia handlers unsubscribe via InteractionTrackerInertiaState.Dispose() → _handler.Stop() on every state transition away from Inertia — no leaked per-frame subscriptions.
  • SetPosition's OnPropertyChanged is now synchronous (matching the PR's stated goal of showing the tracker's position in the same recorded frame), while Owner.ValuesChanged stays deferred to the dispatcher — this is safe now that all callers run on the UI thread (timers are gone).
  • InterruptInertia()/_isAwaitingManipulationStart correctly suppresses the "unexpected StartUserManipulation" log for the one legitimate case it's meant for, and the abort path (GestureRecognizer.Complete() when status never left Starting) still calls OnCompleted → CompleteUserManipulation, so a press-then-release-without-crossing-threshold on coasting content can't strand the tracker in Interacting forever.
  • The Compositor.FrameDriverTargetResolver "first window" limitation for a driver with no visual of its own is already self-documented with a TODO Uno: comment by the author — not re-flagging it.
  • int → double signature change for ReceivePointerWheel is threaded consistently through InteractionTracker/all four state classes and its single call site; no stale int overloads left.
  • New runtime tests (Given_ScrollView.cs) cover the three behavioral changes (sub-detent wheel scroll, same-frame tracker/visual position, finger-stops-coasting) with proper try/finally pointer cleanup; the wheel math (mouseWheelTicks * 48, 250 ms constant-velocity model) checks out against the asserted 12px for a quarter-detent scroll.

Runtime tests were reviewed by inspection only (no /runtime-tests execution here); the PR description's own evidence (full runtime suite, no new failures) is the runtime validation on record for this change.

Base for this review: origin/dev/mazi/scroll-frame-clock...HEAD.

@github-actions

github-actions Bot commented Sep 25, 2026 •

Copy link
Copy Markdown
Contributor

Claude finished @MartinZikmund's task in 1m 33s —— View job


Review complete

Verdict: ship — re-checked this trigger and confirmed the diff against origin/dev/mazi/scroll-frame-clock is byte-identical to the state already reviewed in the prior run (same 6 commits, same SHAs for every changed file). No new commits landed between that review and this one.

Findings: 0 new. I independently re-walked the full diff (all 17 files) against the AGENTS.md checklist — SOLID/duplication, async/cancellation discipline, cross-platform file-suffix usage, DependencyProperty/event conventions, root-cause vs. guard classification, allocations, and test coverage — and didn't find anything beyond the two low-severity, non-blocking points already posted inline on the prior pass:

  1. Duplication between InteractionTrackerActiveInputInertiaHandler and InteractionTrackerPointerWheelInertiaHandler's per-frame scaffolding.
  2. _startTimestamp == 0 as a "not started" sentinel in both handlers (practically safe given Stopwatch-derived ticks, but a long?/bool flag would remove the theoretical fragility).

Both remain open/unaddressed in this snapshot; not re-posting duplicate inline comments for them.

Cross-cutting notes (no issue):

  • The int → double change to ReceivePointerWheel is consistently threaded through all state classes and the single call site (InputManager.Pointers.Managed.cs:350) — no stale overloads.
  • Given_ScrollView.cs's reflection-based access to ScrollPresenter.m_interactionTracker matches an established pattern already used elsewhere in Uno.UI.RuntimeTests (Given_ItemsRepeater, Given_ToggleSwitch, etc.) — not flagging as new risk.
  • No event Action/Action<T> introduced; the new FrameStarting event is EventHandler<long>, consistent with the events rule.
    · branch dev/mazi/scroll-tracker-per-frame

Copilot AI balanced review requested due to automatic review settings October 2, 2026 05:47
@github-actions

github-actions Bot commented Oct 2, 2026 •

Copy link
Copy Markdown
Contributor

Claude finished @MartinZikmund's task in 1m 57s —— View job


Review complete

Verdict: ship.

This trigger re-reviews the PR after a new commit (2ef4a73d refactor(scrollview): Share per-frame inertia driver) was pushed on top of the 6 commits covered by the two prior review passes. That commit directly addresses both low-severity, non-blocking findings posted inline on the earlier passes:

  1. Duplication — InteractionTrackerActiveInputInertiaHandler and InteractionTrackerPointerWheelInertiaHandler now both derive from a new shared InteractionTrackerFrameInertiaHandler base class (InteractionTrackerFrameInertiaHandler.cs), which owns the FrameStarting subscribe/unsubscribe, the HasEntered/back-dated-timestamp bootstrap, and Complete(). Each subclass is left with only its own position-from-elapsed-time formula via an abstract Advance(long elapsedTicks) override. ~90 duplicated lines removed.
  2. Fragile sentinel — the _startTimestamp == 0 "not started" marker is now long? _startTimestamp with is not { } start pattern matching, removing the (theoretical) zero-collision fragility outright.

Findings: 0. I re-read the new commit's full diff against all three affected files line by line:

  • The abstract base correctly implements IInteractionTrackerInertiaHandler (Start/Stop/InitialVelocity/FinalPosition/FinalModifiedPosition/FinalScale), with FinalScale now defined once in the base from InteractionTracker.Scale instead of duplicated in each subclass.
  • InteractionTrackerPointerWheelInertiaHandler.Advance's "reached final position" branch now calls Complete() instead of inlining Stop()+ChangeState() — Complete()'s own SetPosition(FinalModifiedPosition, ...) is redundant but idempotent there, since SetPosition(clampedNewPosition, ...) was already called one line above with the same value; no behavior change.
  • InteractionTrackerActiveInputInertiaHandler's AxisHelper (untouched by this commit) still references Handler._interactionTracker correctly — the subclass kept its own _interactionTracker field (used throughout the file) alongside the new inherited InteractionTracker base property; both point to the same instance, so this is at most a trivial redundancy, not a correctness issue.
  • No new warnings-shaped code, no platform-suffix or DependencyProperty concerns in this commit (pure C# logic move, no XAML/platform branching).

No new inline comments posted — nothing new to flag beyond what's already resolved. The two previously-open findings are now closed by this commit.

Runtime tests were reviewed by inspection only (no /runtime-tests execution in this pass); this is a mechanical, behavior-preserving extraction with no logic changes to the per-frame math, so the existing Given_ScrollView.cs coverage from the prior commits still applies.

Base for this review: HEAD~7..HEAD (7 commits, 18 files, +402/-108 — matches the PR's reported stats; the literal origin/dev/mazi/scroll-frame-clock ref in this sandbox's checkout is stale/ahead of what the PR actually branched from).
· branch dev/mazi/scroll-tracker-per-frame

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟡 Changes recommended

Source-less trackers can stall in multi-window applications because their inertia is tied to the first window’s frame target.

Review effort: Balanced
Findings: 1 High severity

Open (1)
What changed in this PR

Moves ScrollView inertia and wheel motion from timers to UI-thread frame ticks for smoother high-refresh-rate scrolling.

Changes:

  • Adds frame-driven inertia handling and synchronous position propagation.
  • Supports fractional wheel deltas and touch interruption.
  • Adds Skia runtime coverage for scrolling behavior.

Review verdict: Fix-first — 1 blocking bug identified.

File Description
CompositionTarget.Rendering.cs Registers the fallback frame-target resolver.
CompositionTarget.FrameClock.cs Exposes frame ticks and resolves fallback targets.
InputManager.Pointers.ManagedDirectManip.cs Interrupts inertia on press and completes gestures.
InputManager.Pointers.Managed.cs Preserves fractional wheel deltas.
CoreServices.cs Exposes XamlRoot lookup internally.
Given_ScrollView.cs Tests wheel precision, frame synchronization, and touch interruption.
InteractionTrackerState.cs Adds activation, interruption, and entry tracking.
InteractionTrackerPointerWheelInertiaHandler.cs Converts wheel inertia to frame-driven motion.
InteractionTrackerInteractingState.cs Handles inertia-interrupting presses.
InteractionTrackerInertiaState.cs Starts and interrupts frame inertia.
InteractionTrackerIdleState.cs Accepts fractional wheel deltas.
InteractionTrackerFrameInertiaHandler.cs Implements shared frame-based inertia scheduling.
InteractionTrackerCustomAnimationState.cs Updates wheel-delta type.
InteractionTrackerActiveInputInertiaHandler.cs Converts touch inertia to frame-driven motion.
InteractionTrackerActiveInputInertiaHandler.AxisHelper.cs Uses frame elapsed time for damping.
InteractionTracker.cs Resolves frame targets and synchronizes position updates.
ICompositionTarget.cs Adds frame-starting and interval contracts.
Compositor.skia.cs Tracks and resolves frame drivers.

💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.

Copilot AI balanced review requested due to automatic review settings October 3, 2026 09:43
@MartinZikmund
MartinZikmund force-pushed the dev/mazi/scroll-tracker-per-frame branch from 2ef4a73 to 34f903c Compare October 3, 2026 09:43

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Warning

Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.

Copilot review overview

Review effort: Lite
Findings: 1 High severity · 4 Medium severity · 1 Low severity

Open (6)

@github-actions

github-actions Bot commented Oct 3, 2026 •

Copy link
Copy Markdown
Contributor

Claude finished @MartinZikmund's task in 2m 52s —— View job


Review complete

  • Gather context (PR description, prior review rounds, diff vs origin/dev/mazi/scroll-frame-clock)
  • Review InteractionTrackerFrameInertiaHandler + the two subclasses (new shared base class)
  • Review InteractionTracker.cs frame-target resolution + synchronous SetPosition
  • Review CompositionTarget.FrameClock.cs / Compositor.skia.cs (fallback frame driver target, multi-window concern flagged by Copilot)
  • Review InputManager.Pointers.Managed*.cs (wheel delta precision, press-stops-fling)
  • Review InteractionTracker*State.cs changes
  • Review new runtime tests Given_ScrollView.cs
  • Post inline findings (none — see below)
  • Post summary

Verdict: ship.

Findings: 0 new, 0 inline comments posted. I re-walked the full diff against origin/dev/mazi/scroll-frame-clock (18 files, +402/-108, matching the PR's reported stats) against the AGENTS.md checklist: SOLID/duplication, async/cancellation discipline, platform-targeting conventions, DependencyProperty/event conventions (no event Action/Action<T> introduced — the new FrameStarting is EventHandler<long>), root-cause-vs-guard classification, allocation hotspots, and test coverage.

Both previously-flagged, low-severity findings from earlier review passes are now resolved:

  • Duplication between the two inertia handlers — InteractionTrackerFrameInertiaHandler now owns Start()/Stop()/the HasEntered/back-dated-timestamp bootstrap/Complete(); each subclass only implements Advance(elapsedTicks).
  • Fragile _startTimestamp == 0 sentinel — now long? _startTimestamp with is not { } start pattern matching, so a legitimate zero can no longer be mistaken for "not started".

Cross-cutting notes (no new issue):

  • Traced the reentrant-CompleteGesture()-during-OnInertiaStarting path end-to-end: GestureRecognizer.Manipulation's own ManipulationStatus.Inertia guard (checked again after the event) already anticipates a handler completing the gesture synchronously, and InteractionTrackerInertiaState.CompleteUserManipulation is a no-op, so the resulting re-entrant ManipulationCompleted can't double-apply a velocity or corrupt tracker state.
  • The multi-window FrameDriverTargetResolver limitation Copilot flagged (a free-standing InteractionTracker with no VisualInteractionSource ties its inertia to the first window's target) is unchanged from the prior review pass — still self-documented with the TODO Uno: comment on Compositor.skia.cs, and does not affect ScrollView/ScrollPresenter, which always attach a VisualInteractionSource. Not re-flagging as blocking.
  • ReceivePointerWheel's int → double change is threaded consistently through InteractionTracker and all four state classes; verified the math behind Given_ScrollView.When_Wheel_Delta_Below_A_Detent_Then_Scrolls's asserted 12px (−30 raw delta ÷ 120 detent × 48px = −12, constant-velocity-for-250ms model reproduces it exactly).
  • Given_ScrollView.cs is correctly scoped to #if __SKIA__ (the whole class depends on Skia-only CompositionTarget/InteractionTracker internals — this is a compile-time exclusion, not a [TestMethod]-level #if that would break discovery), uses [RunsOnUIThread], and cleans up injected pointers in try/finally.

Runtime tests were reviewed by inspection only (no /runtime-tests execution in this pass); the PR description's own evidence (full runtime suite, no new failures vs. master) is the runtime validation on record for this change.
· branch dev/mazi/scroll-tracker-per-frame

Copilot AI balanced review requested due to automatic review settings October 3, 2026 16:01
@MartinZikmund
MartinZikmund force-pushed the dev/mazi/scroll-tracker-per-frame branch from 34f903c to c8129a4 Compare October 3, 2026 16:01
@github-actions

github-actions Bot commented Oct 3, 2026 •

Copy link
Copy Markdown
Contributor

Claude finished @MartinZikmund's task in 1m 47s —— View job


Review complete

  • Gather context (PR description, prior review rounds, diff vs origin/dev/mazi/scroll-frame-clock)
  • Review new/changed commits since last review pass
  • Check prior open findings (duplication, fragile sentinel, Copilot's multi-window stall, Copilot's medium findings) for resolution status
  • Review remaining files (InteractionTrackerState.cs, InteractionTrackerInteractingState.cs, InteractionTrackerInertiaState.cs, InputManager.Pointers.ManagedDirectManip.cs)
  • Post inline findings (none — nothing new)
  • Post summary

Verdict: ship.

No new commits landed since the last review pass. git diff origin/dev/mazi/scroll-frame-clock...HEAD is 18 files / +402/-108, matching the PR's reported stats and the state already reviewed, and the tip commit message (refactor(scrollview): Share per-frame inertia driver) is unchanged. This trigger re-walked the full diff against the AGENTS.md checklist (SOLID/duplication, async/cancellation discipline, platform-targeting conventions, DependencyProperty/event conventions, root-cause-vs-guard classification, allocations, test coverage) and found 0 new issues.

Status of previously-raised findings (all already posted inline by me or Copilot — not re-posted):

  • ✅ Resolved: the two low-severity findings from my first two review passes (duplicated per-frame scaffolding, fragile _startTimestamp == 0 sentinel) — fixed by the shared InteractionTrackerFrameInertiaHandler base class.
  • 🟡 Still open, non-blocking: Copilot's note that InteractionTrackerActiveInputInertiaHandler/InteractionTrackerPointerWheelInertiaHandler each keep a redundant _interactionTracker field duplicating the inherited InteractionTracker base property.
  • 🟡 Still open, non-blocking: Copilot's medium findings on Given_ScrollView.cs (hardcoded 48px-per-detent assertion, reflection access to m_interactionTracker) and on ICompositionTarget.FrameStarting's silent-no-op default accessor.
  • 🟡 Still open, acknowledged by design: Copilot's "high" finding that a free-standing InteractionTracker (no VisualInteractionSource) ties its inertia to the first window's frame target in multi-window apps. Self-documented with a TODO Uno: comment on Compositor.skia.cs; doesn't affect ScrollView/ScrollPresenter, which always attach a VisualInteractionSource.

No cross-cutting concerns beyond what's already on the thread.
· branch dev/mazi/scroll-tracker-per-frame

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Copilot AI balanced review requested due to automatic review settings October 4, 2026 05:19
@unodevops

Copy link
Copy Markdown
Contributor

@nventive-devops

Copy link
Copy Markdown
Contributor

The build 237827 found UI Test snapshots differences: skia-linux-screenshots: 118, skia-windows-screenshots: 1173

Details
  • skia-linux-screenshots: 118 changed over 2458

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • Buttons.png-dark
    • Buttons.png
    • CalendarView_Theming.png-dark
    • CalendarView_Theming.png
    • ClipboardTests.png-dark
    • ButtonClippingTestsControl.png-dark
    • ButtonClippingTestsControl.png
    • CompositionEffectBrush.png-dark
    • CompositionEffectBrush.png
    • CompositionNineGridBrush_Source_Changes.png-dark
    • CompositionNineGridBrush_Source_Changes.png
    • DisplayInformation.png-dark
    • DoubleImageBrushInList.png-dark
    • DoubleImageBrushInList.png
    • DropDownButtonPage.png-dark
    • ElementLevelTheme.png-dark
    • ElementLevelTheme.png
    • Examples.png
    • ImageBrushAlignmentXY.png-dark
    • ImageBrushAlignmentXY.png
  • skia-windows-screenshots: 1173 changed over 2458

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • Accessibility_ScreenReader.png
    • AutoSizedPathCentered.png-dark
    • AutoSizedPathCentered.png
    • BorderBottomwithmargins.png-dark
    • BorderBottomwithmargins.png
    • BorderTopwithmargins.png-dark
    • BorderTopwithmargins.png
    • Border_AntiAlias.png-dark
    • Border_AntiAlias.png
    • Border_CornerRadius_Gradient.png-dark
    • Border_CornerRadius_Gradient.png
    • Brushes_ImplicitConvert.png-dark
    • Brushes_ImplicitConvert.png
    • ButtonClippingTestsControl.png-dark
    • ButtonClippingTestsControl.png
    • Button_IsEnabled_Automated.png-dark
    • Button_IsEnabled_Automated.png
    • CheckBox_IsEnabled_Automated.png-dark
    • CheckBox_IsEnabled_Automated.png
    • AppWindowFeatures.png-dark

MartinZikmund and others added 3 commits October 7, 2026 11:15
A composition target that silently never raised FrameStarting would
leave inertia stuck, so implementers must now provide it.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LtnnfqgXbPx1pR2QSUWcGj
Clear the window content after each test, link the tests to #24730,
derive the wheel expectation from the tracker's detent size and read
the tracker through an internal accessor instead of reflection.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LtnnfqgXbPx1pR2QSUWcGj
Copilot AI balanced review requested due to automatic review settings October 7, 2026 09:17

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@github-actions github-actions Bot added the area/automation Categorizes an issue or PR as relevant to project automation label Oct 7, 2026
@github-actions

github-actions Bot commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

Claude finished @MartinZikmund's task in 24s —— View job


Review complete

Verdict: ship.

Findings: 0 new, so no inline comments. This pass covered the three commits added since the last review: 10c39e08, 350f5f3c and ea1e2d92. I read their diffs, and I checked the implementers of ICompositionTarget and that GitHubWorkItem exists. I did not re-read the rest of the PR, which the earlier passes covered. I did not build or run anything.

Open Copilot items these commits address:

  • Silent no-op FrameStarting default: ICompositionTarget.FrameStarting and FrameIntervalInTicks are now required members. They no longer have a default body. The in-repo implementers are CompositionTarget, the test stubs and the Compositor.skia.cs stub, and they all provide both.
  • Backdated first frame using the interface's 60 Hz default: removing that default means a target must now report its own interval. A target that still returns an estimate keeps the backdating caveat.
  • Duplicate _interactionTracker / _requestId fields: the two handlers now use the base InteractionTracker and RequestId. I saw no behavior change.
  • Reflection on m_interactionTracker: replaced by ScrollPresenter.InteractionTracker, an internal accessor.
  • Hard-coded 48px per detent: the test now uses InteractionTracker.PixelsPerWheelDetent.
  • Missing WindowContent cleanup: Given_ScrollView.cs now has a [TestCleanup] that clears WindowContent.
  • Missing issue traceability: each test now carries [GitHubWorkItem(".../issues/24730")].

Still open, non-blocking:

  • A free-standing InteractionTracker with no VisualInteractionSource takes its frame ticks from the first window's target. In a multi-window app it can stall if that window stops presenting. A TODO Uno: comment on Compositor.skia.cs already marks it, and ScrollView and ScrollPresenter are not affected.
  • Test nit: PixelsPerWheelDetent / 4 still assumes the 48px constant is what ScrollView uses. That holds because the tracker defines the constant. If the value ever becomes configurable, the test should read the configured value.

Validation: I did not run the runtime tests. The only runtime evidence on record is the full-suite run in the PR description, which predates these three commits. The commits are small and mechanical, but the interface change and the test edits have not been compiled or run since.
· branch dev/mazi/scroll-tracker-per-frame

@nventive-devops

Copy link
Copy Markdown
Contributor

The build 237842 found UI Test snapshots differences: skia-linux-screenshots: 118, skia-windows-screenshots: 1153

Details
  • skia-linux-screenshots: 118 changed over 2458

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • ButtonClippingTestsControl.png-dark
    • ButtonClippingTestsControl.png
    • Buttons.png-dark
    • Buttons.png
    • CalendarView_Theming.png-dark
    • CalendarView_Theming.png
    • ClipboardTests.png-dark
    • CompositionEffectBrush.png-dark
    • CompositionEffectBrush.png
    • CompositionNineGridBrush_Source_Changes.png-dark
    • CompositionNineGridBrush_Source_Changes.png
    • DropDownButtonPage.png-dark
    • DisplayInformation.png-dark
    • Focus_FocusVisual_Properties.png-dark
    • Focus_FocusVisual_Properties.png
    • DynamicFont.png-dark
    • DynamicFont.png
    • DoubleImageBrushInList.png-dark
    • DoubleImageBrushInList.png
    • ElementLevelTheme.png-dark
  • skia-windows-screenshots: 1153 changed over 2458

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • Accessibility_ScreenReader.png
    • Attributed_text_Simple.png-dark
    • AutoSuggestBox_Keyboard.png-dark
    • AutoSuggestBox_Keyboard.png
    • Border_AntiAlias.png-dark
    • Border_AntiAlias.png
    • Border_CornerRadius_Alignments.png-dark
    • Border_CornerRadius_Alignments.png
    • Border_Simple.png-dark
    • Border_Simple.png
    • CalendarDatePicker_Description.png-dark
    • CalendarDatePicker_Description.png
    • CalendarView_Theming.png-dark
    • CalendarView_Theming.png
    • ColorPickerSample.png-dark
    • ColorPickerSample.png
    • ComboBox_MaxDropdownHeight.png-dark
    • ComboBox_MaxDropdownHeight.png
    • ComboBox_Stretch.png-dark
    • ComboBox_Stretch.png

@unodevops

Copy link
Copy Markdown
Contributor

⚠️⚠️ The build 237842 has failed on Uno.UI - CI.

The wheel inertia lasts a fixed time, so a slow macOS agent recorded only
3-4 frames and failed the frames >= 5 precondition before the mismatch
check ever ran. Assert the mismatches first and only require two frames.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_011jrRt9mLQkJpfv6uqds4Xx
Copilot AI balanced review requested due to automatic review settings October 7, 2026 12:32

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@github-actions

github-actions Bot commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

Claude finished @MartinZikmund's task in 15s —— View job


Review complete

Verdict: ship.

Findings: 0 new, so no inline comments. This pass covers the one commit added since the last review, e9a8c730 ("test(scrollview): Don't tie the inertia frame check to frame rate"). It changes only Given_ScrollView.cs. I read that diff. I did not re-read the rest of the PR, and I did not build or run anything.

  • What changed: the mismatch assertion now runs first, and the frame-count precondition drops from >= 5 to >= 2. The wheel inertia lasts a fixed time, so a slow agent records only a few frames and the old precondition failed before the mismatch check ran.
  • Why it is fine: the test still checks the property that matters, that every recorded frame shows the tracker's position. Requiring at least two frames still fails if the handler never ticks. The new comment is short and says why.
  • Mild trade-off: with a floor of 2, a very slow agent gives the mismatch check less to compare. That is acceptable for a flakiness fix.

Still open, non-blocking: a free-standing InteractionTracker with no VisualInteractionSource takes its frame ticks from the first window's target. In a multi-window app it can stall if that window stops presenting. It is marked with a TODO Uno: comment and listed under Known limitation in the PR description. ScrollView and ScrollPresenter always attach a source, so they are not affected.

Validation: Code review only, by inspection. I did not run the runtime tests. The runtime evidence on record is the full-suite run in the PR description, which predates the last four commits. The latest CI build (237842) is reported as failed on Uno.UI - CI, and I did not investigate that failure.
· branch dev/mazi/scroll-tracker-per-frame

@nventive-devops

Copy link
Copy Markdown
Contributor

The build 237876 found UI Test snapshots differences: skia-linux-screenshots: 118, skia-windows-screenshots: 1152

Details
  • skia-linux-screenshots: 118 changed over 2458

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • CalendarView_Theming.png-dark
    • CalendarView_Theming.png
    • ButtonClippingTestsControl.png-dark
    • ButtonClippingTestsControl.png
    • Buttons.png-dark
    • Buttons.png
    • ClipboardTests.png-dark
    • CompositionEffectBrush.png-dark
    • CompositionEffectBrush.png
    • CompositionNineGridBrush_Source_Changes.png-dark
    • CompositionNineGridBrush_Source_Changes.png
    • DropDownButtonPage.png-dark
    • DoubleImageBrushInList.png-dark
    • DoubleImageBrushInList.png
    • DisplayInformation.png-dark
    • ElementLevelTheme.png-dark
    • ElementLevelTheme.png
    • ImageBrushAlignmentXY.png-dark
    • ImageBrushAlignmentXY.png
    • Gamepad_CurrentReading.png-dark
  • skia-windows-screenshots: 1152 changed over 2458

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • AppBarButtonWithIconTest.png-dark
    • AppWindowFeatures.png-dark
    • AutomationProperties_AutomationId.png-dark
    • AutomationProperties_AutomationId.png
    • AutoSuggestBox_Keyboard.png-dark
    • AutoSuggestBox_Keyboard.png
    • Basics.png-dark
    • Basics.png
    • BitmapIcon_Sizing.png-dark
    • BitmapIcon_Sizing.png
    • ButtonClippingTestsControl.png-dark
    • ButtonClippingTestsControl.png
    • Buttons.png-dark
    • Buttons.png
    • Button_Opacity_Automated.png-dark
    • Button_Opacity_Automated.png
    • CenteredGridinGridwithtwofixedsizechildren.png-dark
    • CenteredGridinGridwithtwofixedsizechildren.png
    • ChatBox.png-dark
    • ChatBox.png

@mergify

mergify Bot commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

This pull request does not currently match the merge queue conditions, so it cannot be queued from here. The box comes back if it matches again.

A tracker with no VisualInteractionSource has no window to name, so it
was ticked on the first window's frames through a static resolver. It
now subscribes to a compositor-wide tick that runs on every window's
frames, at the latest of their timestamps, as WinUI's compositor ticks
trackers. CompositionTargets register with the compositor as hosts, so
the static resolver and the CoreServices.GetXamlRoot exposure go away.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_011jrRt9mLQkJpfv6uqds4Xx
Copilot AI balanced review requested due to automatic review settings October 7, 2026 16:14

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@github-actions

github-actions Bot commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

Claude finished @MartinZikmund's task in 28s —— View job


Review complete

Verdict: ship. The new commit 9a49b325 ("Tick sourceless trackers from the compositor") resolves the multi-window limitation Copilot flagged. A tracker with no VisualInteractionSource now subscribes to a compositor-wide CompositorFrameTickSource, which ticks on every window's frames. This replaces the "first window" static resolver.

Findings: 1 low-severity inline comment, non-blocking.

  • No test covers the new tick source or its multi-window behavior.
  • The snapshot invocation list can call a just-unsubscribed handler once. A _handler is null guard in the inertia handler would avoid the resulting logged NRE.

What I checked, no issue found:

  • ICompositionTarget : IFrameTickSource is a clean split. The in-repo implementers (CompositionTarget, the test stubs) already provide both members.
  • AddFrameDriver/RemoveFrameDriver stay balanced across add, remove and RemoveHost, so IsAnimating is not left stuck.
  • The tick source uses Math.Max on the timestamp, so a driver never sees time go backwards. It runs once per RaiseFrameTick, so a driver is not ticked once per window.
  • Hosts are held in a ConditionalWeakTable, and OnHostGone calls RemoveHost. Closed windows are not leaked.
  • RequestNewFrame is now also issued for compositor-only drivers (HasDrivers).
  • The TODO Uno limitation noted in the PR description is gone. The PR's Known limitation section is now stale and should be updated.

Validation: code review by inspection only. I did not build or run the runtime tests. CI build 237842 was reported as failed, and I did not investigate it.
· branch dev/mazi/scroll-tracker-per-frame

@nventive-devops

Copy link
Copy Markdown
Contributor

The build 237950 found UI Test snapshots differences: skia-linux-screenshots: 118, skia-windows-screenshots: 1133

Details
  • skia-linux-screenshots: 118 changed over 2458

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • CalendarView_Theming.png-dark
    • CalendarView_Theming.png
    • ClipboardTests.png-dark
    • CompositionEffectBrush.png-dark
    • CompositionEffectBrush.png
    • CompositionNineGridBrush_Source_Changes.png-dark
    • CompositionNineGridBrush_Source_Changes.png
    • ButtonClippingTestsControl.png-dark
    • ButtonClippingTestsControl.png
    • Buttons.png-dark
    • Buttons.png
    • ElementLevelTheme.png-dark
    • ElementLevelTheme.png
    • Focus_FocusVisual_Properties.png-dark
    • Focus_FocusVisual_Properties.png
    • DisplayInformation.png-dark
    • DynamicFont.png-dark
    • DynamicFont.png
    • Gamepad_CurrentReading.png-dark
    • Gamepad_Enumeration.png-dark
  • skia-windows-screenshots: 1133 changed over 2474

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • AnimatedIconPage.png-dark
    • AppBarButtonWithIconTest.png
    • Attributed_text_Simple.png-dark
    • AutomationProperties_AutomationId.png-dark
    • AutoSuggestBox_BitmapIcon.png
    • BackGesture.png-dark
    • BackGesture.png
    • BindableDrawerLayout_ChangePane.png-dark
    • BindableDrawerLayout_ChangePane.png
    • BorderBottomwithmargins.png-dark
    • BorderBottomwithmargins.png
    • BorderLeftwithmargins.png-dark
    • BorderLeftwithmargins.png
    • Border_LinearGradientBrush.png-dark
    • Border_LinearGradientBrush.png
    • Border_Simple.png-dark
    • Border_Simple.png
    • Button_Opacity_Automated.png-dark
    • Button_Opacity_Automated.png
    • CenteredGridinGridwiththreefixedsizechildren.png-dark

@MartinZikmund
MartinZikmund merged commit 1a02627 into master Oct 8, 2026
56 checks passed
@MartinZikmund
MartinZikmund deleted the dev/mazi/scroll-tracker-per-frame branch October 8, 2026 09:46
MartinZikmund added a commit that referenced this pull request Oct 9, 2026
Since #24736 the tracker advances once per frame instead of on a 17ms
timer. WaitTrackerLogs returned once the logs were unchanged for 100ms,
so on software-rendered lanes (WebGPU on SwiftShader), where a frame
takes longer than that, it sampled the logs mid-motion and saw 0-1
ValuesChanged. Wait for IdleStateEntered instead.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01L4YBGyfjv1uKVn6FUFxSEF
MartinZikmund added a commit that referenced this pull request Oct 10, 2026
Since #24736 the tracker advances once per frame instead of on a 17ms
timer. WaitTrackerLogs returned once the logs were unchanged for 100ms,
so on software-rendered lanes (WebGPU on SwiftShader), where a frame
takes longer than that, it sampled the logs mid-motion and saw 0-1
ValuesChanged. Wait for IdleStateEntered instead.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01L4YBGyfjv1uKVn6FUFxSEF
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/automation Categorizes an issue or PR as relevant to project automation area/skia ✏️ Categorizes an issue or PR as relevant to Skia

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ScrollView inertia and wheel motion tick on a 17 ms thread-pool timer

5 participants