Skip to content

Text in a scrolling list moves in whole pixels with its box - #1147

Merged
Hona merged 4 commits into
devfrom
text2-scroll-text
Nov 18, 2026
Merged

Hona merged 4 commits into
devfrom
text2-scroll-text

Conversation

@Hona

@Hona Hona commented Nov 17, 2026 •

Copy link
Copy Markdown
Member

While a list follows its end as a reply grows or a prompt arrives, text no longer drifts against its row by fractions of a pixel. This is the last part of the jitter request after #1072 (text under a folding or growing row) and #1067 (growth stepped by each frame's time).

Cause: a box under a scroll draws at round(rigid): the scroll and every translation above it, rounded as one. A text inside lays out from its exact place against Inherit::steady, and steady still held the scroll's offset and the growth stack's window offset. Every frame the end-follow moved the scroll by a fraction, so the text moved by that fraction while its row moved in whole pixels: up to 0.9 px apart.

Change (runtime/paint/pixel_snap.rs, runtime/paint/build.rs, runtime/web/page.rs; head 16854238):

  • These move rigid only, not steady: a scroll's drawn offset, a sticky shift, a web page's band (Inherit::scroll), and a growth offset, a row's or a stack's window's (Inherit::grow). Inherit::shift, which moved both, is gone.
  • A stuck sticky header: while stuck, its shift cancels the scroll's motion, so rigid holds still. Before this fix (the first head, 1a5b8e24), steady took the shift alone, which follows the scroll's fraction, so the header's text drifted up to a pixel every frame of a glide. The independent read found it; the header's runs are below.
  • So a text keeps its offset from its box wherever the list is, at rest and in motion. It lands on the same pixel as before in every frame that doesn't move.
  • At rest, a text in a scroller now draws from the scroll offset as its rows round it. Chromium does the same: it draws a scroller's contents from its pixel-snapped scroll offset. Resting pixels change where a scroll offset or a growth stack's window offset sits on a fraction of a device pixel.
  • steady keeps the paint containments' origins only. An overlay starts it again at zero.

Kit's growth-stack motions (Rune's growth_reorder, headless at 120 fps, the probe's glyph origin against its drawn box per painted frame; frames where a label moves ≥ 0.25 px against its row):

Motion dev 842c28c2 (1x / 1.5x / 1.875x) This change
A sent prompt delivered and growing 47 / 45 / 48 0 / 0 / 0
A prompt in flight 27 / 29 / 24 0 / 1 / 1
Rows trading places 0 / 1 / 1 0 / 1 / 1
  • Rows unchanged: every row's drawn box is identical before and after on every frame of all nine runs (grp_boxes.py).
  • The single frames left:
    • A prompt in flight, frame 57 at 1.5x and 1.875x: "Working." starts its glide there. Its text-to-box offset takes the new resting place's fraction (−0.5 px), but the glyphs land on the same pixel rows. Ink top minus box top is 10.0 px on frames 55, 56 and 57 at 1.875x, and the ink rows are 293–303 on frames 56 and 57 at 1.5x.
    • Rows trading places, frame 190 at 1.5x and 1.875x: flagged before this change too. The two rows overlap there mid-swap, so their ink can't be told apart by row.
  • A tool group folding: 0 frames with text off its card at 1x, 1.25x, 1.5x, 1.875x and 2x, before and after (Text under gliding growth rows moves in whole pixels with its box #1072's count holds).

The app's own timeline (desktop dev on Rune 10a39584, with and without #1147's commits, both with the text probe; fixture session A headless at 120 fps, 240 frames; frames where any text moves ≥ 0.25 px against its own box):

Case Without #1147 (1x / 1.5x / 1.875x) With #1147
A wheel glide (a 260 pt swipe with a fling) 102 / 94 / 89 0 / 0 / 2
The end following a streaming reply 36 / 42 / 42 0 / 0 / 0
  • Before, the texts that moved were the tool rows' trigger words and the reply's list items and paragraphs.
  • The 2 left at 1.875x are single frames of exactly 0.5 px: a list item's text at frame 74 and a tool row's trigger at frame 84. Both are ties in the count only. The probe's own values for the stepped texts give the same drawn baseline against the box on both frames, rounded as the renderer rounds them (at[1].round()). The list item goes from baseline 205.9375 (drawn at 206) over box 176, to 228.4375 (drawn at 228) over box 198: 30 px both times. The trigger goes from 212.4375 (212) over 188, to 228.9375 (229) over 205: 24 px both times. The 0.5 px is the text's fraction against its box crossing a half pixel, not the scroll tie. A run that keeps the frames lost them to a script fault, so the ink is not compared.
  • A web page's band: its top is snapped to the device grid where it is set (page.rs snap_band: (y * s).round() / s), so it can't sit on a fractional device pixel. The page's band now moves rigid only, like a scroller's offset; on a whole-pixel value that changes no text's place. No web capture was run.
  • The stuck header, the sticky-left column and the 2x glide on macOS: one detached turn on air under the Mac lock, queued; its counts go here when it runs.

At rest, against official (the layout-cards sweep: 22 timeline screens × light and dark; pixels more than two levels from every official pixel within one device pixel):

Scale Screens that change Against official
1x 6 of 44 (session-markdown, session-md-blocks, session-menu) every one equal or closer: 9,092 → 9,070, 8,780 → 8,766, 55,706 → 55,706 (×2), 9,507 → 9,489, 9,254 → 9,247
1.875x 8 of 44 (also session-edit-expanded) 4 closer (session-markdown, session-menu: −7 to −29 px), 4 farther (session-edit-expanded +38 and +10 of 29,211 and 27,176; session-md-blocks +14 and +14 of 202,716 and 183,932)

Four 1.875x screens move away from official because text now takes the rows' half-pixel tie. They sit on a half-pixel scroll offset. Rune rounds the combined translation with (v + 0.5).floor(), so −687.5 px becomes −687, where Chromium rounds the positive offset half up (+688). Text now rounds with its rows, so it takes Rune's tie too. That tie is its own follow-up PR: round the scroll offset half up in device pixels before it is negated, checked at every scroller's end at 1x to 2x against official. This PR doesn't change how rows round.

Mac at 16854238a502b4d70dc7a74bd06c1cb3013ddfa1: 3,088 passed, 1 failed, the known order-dependent runtime::tests::scroll_children::scroll_xy_with_direct_children_scrolls_both_axes_and_warns_on_trailing_growth_sibling, as on dev. Windows: PROOF-FARM's lane has this head. No test added.

Copilot AI balanced review requested due to automatic review settings November 17, 2026 22:53

Copilot AI left a comment

Copy link
Copy Markdown

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 insufficient remaining quota.

An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.

…and a page's band) is a scroll's kind of translation; Inherit::shift goes
@Hona
Hona merged commit 1516db3 into dev Nov 18, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants