Repository navigation
Anchor a comment box to an element its words' scroller carries - #1916
Merged
Merged
Conversation
A comment box on words that stand directly in a box that scrolls them, such as a short overflow:auto paragraph, anchored to that box and followed its inner scroll through a ScrollTimeline motion layer. Chrome does not always paint that layer in the frame that paints the scrolled words: on CI's Linux runner the box was missing for one frame after the words scrolled back into view, which failed test_a_wheel_return_attaches_the_comment_box_in_the_first_visible_frame [content-selection] on 7 of 36 runs of a targeted CI job, and locally on macOS it drew a frame early. The code-row case, anchored to a row inside its scroller, stayed in step on every run. The surface now anchors to the nearest element beside the words inside that scroller, which the same scroll carries, so CSS anchor positioning moves it with the words. With the change the content case passed 48 of 48 CI runs, quiet and under load. Motion layers remain only where no anchor reaches the scroll: inside a shadow tree, or words with no element beside them. Tests: the scaled inner-scroll test now samples attachment frames after the wheel settles, around the placement renewal it is about; a requestAnimationFrame read straight after a scroll sees an anchor's scroll adjustment a frame late, which is not what is painted. The no-scroll-timelines test drops its spans so its words still have no element beside them and it keeps covering the window-plane fallback. The earlier Locator.type timeout in the same test was removed by #1887. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
leaf-agent
approved these changes
Oct 6, 2026
max-sixty
added a commit
that referenced
this pull request
Oct 6, 2026
A margin pin whose target scrolls inside a pane followed that scroll through a ScrollTimeline motion layer, which Chrome can paint a frame before or after the scrolled content, as #1916 found for the comment box. On CI's Linux runner under load, 6 of 20 runs of a pane pin drew a frame with the pin a wheel step (40px) off its target, and three tripped the suite's shift watch ("span.lf-margin-marker moved without input by (0, 40)px"). A row whose target scrolls inside a box short of the document now stands in a carrier: a fixed box anchored to an element that box's scroll carries (`carriedAnchor`), so CSS anchor positioning moves it with the target in the frame that scrolls. With the change the same job showed 0 of 20 desynced and no shift-watch reports. Rows share a carrier per anchor, axis set and run, not one per row, which keeps the layout cost #1890 removed: rows still name no anchor of their own. A rail row's carrier follows only the block axis, as the rail does not follow a region's sideways scroll, and a sideways page scroll places those rows again. A carrier takes a row only where every box between its target and the scroller is in flow: a sticky, fixed or absolute box there moves the target other than the scroll does. Motion layers remain where no anchor reaches, as inside a shadow tree, or when the lane itself rides one. Each pass names the carrier's anchor again, since a revision that rewrites the anchor's style takes the name away. A carrier holds one run of consecutive rows and stands in its lane where that run comes, so rows keep document order across carriers. `carriedAnchor` (anchor-names.js) is now the one rule for "an element a scroller's scroll carries"; the comment box's anchor (#1916) uses it. The scroll reading that withholds a row as its target leaves no longer reads the row's box, which a carried row reports a frame late after a scroll, but the offset from its target recorded at placement. Tests: `test_a_pin_in_a_pane_paints_in_the_frame_its_target_scrolls` reads Chrome's compositor frames through a pane scroll. It passes locally on either mechanism; the desync shows on CI's Linux runner under load. The trace helper behind it (`compositor_trace`, with `frame_image` and `marked_tops`) is shared with the wheel-return test and records only the categories it names: Chrome otherwise adds its default ones, and the forced-layout events the suite's own watchers cause made a two-second idle trace 2.9 million events long, so the trace often outlasted its wait under load. > _This was written by Claude Code on behalf of max-sixty_ Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes the recurring PR-only failure of
test_a_wheel_return_attaches_the_comment_box_in_the_first_visible_frame[content-selection].A comment box on words that stand directly in a box that scrolls them (a short
overflow:autoparagraph) anchored to that box and followed its inner scroll through a ScrollTimeline motion layer. Chrome does not always paint that layer in the frame that paints the scrolled words. On CI's Linux runner the box was missing for one frame after the words scrolled back into view, and on macOS it drew a frame early. The code-row case, anchored to a row inside its scroller, stayed in step on every run.The surface now anchors to the nearest element beside the words inside that scroller (
anchorForinfloating.js). The same scroll carries that element, so CSS anchor positioning moves the box with the words. Motion layers remain only where no anchor reaches the scroll: inside a shadow tree, or words with no element beside them.Evidence, from a temporary workflow running only this test on
ubuntu-24.04(since deleted):Every failure on main had the same painted reading: the passage back at its place with no box, then the box a frame later. The earlier
Locator.typetimeout in the same test was removed by #1887; both of the runs the flake was reported from predate it.Test changes:
test_a_quote_surface_follows_scaled_inner_scroll_and_retains_native_editingnow samples attachment frames after the wheel settles, around the placement renewal the test checks. ArequestAnimationFrameread straight after a scroll sees an anchor's scroll adjustment a frame late, which is not what is painted.test_a_comment_box_on_words_in_a_scroller_stands_without_scroll_timelinesdrops its spans, so its words still have no element beside them and the test still covers the window-plane fallback.