Skip to content

Read ring pixels from a whole-window capture, so stills' next shot is whole - #7456

Merged
max-sixty merged 2 commits into
mainfrom
stills-summary-card-capture
Nov 27, 2026
Merged

max-sixty merged 2 commits into
mainfrom
stills-summary-card-capture

Conversation

@max-sixty

Copy link
Copy Markdown
Owner

leaf-dev stills sometimes reported a change on summary-card with identical arms: one arm's still showed the margin card's lower half unpainted, all but the caret. The ring reading stills runs just before each still confirmed covers against a screenshot clipped to its samples, and in Chromium a clipped capture can leave part of the page unpainted in the tab's next capture. The ring reading now reads its samples out of a whole-window capture (browser.screenshot), whose docstring states the rule.

On one tab at the state, 40 captures each against a settled reference: a clipped shot before each capture left the card's lower tile row blank or re-rastered in 24–29 of 40; with the fix, 0 of 40. uv run leaf-dev stills --base HEAD --state summary-card reports it unchanged in 5 of 5 runs. Every state captures through this path, so the fix covers each one that draws a focus ring.

Dispatched by Max from the fold-label work (#7443). Tests: the ring cover-confirmation journey test, a thread ring test and dev/tests/model/test_stills.py pass.

This was written by Claude Code on behalf of max-sixty

… whole

`leaf-dev stills` reported a false change on `summary-card` in some runs
with identical arms: one arm's still showed the margin card's lower half
unpainted, everything in it but the caret. The ring reading that stills
takes just before each still (`geometry.read` -> `rings_drawn`) confirms
covers against a screenshot clipped to the rings' samples. In Chromium,
that clipped capture leaves the tab's next capture able to show a tile
row of the card layer unpainted.

Measured on one tab at the state, 40 captures each, compared with a
settled reference shot: with a clipped shot before each capture, 24-29
of 40 captures showed the card's lower tile row blank or re-rastered; with
no clipped shot, 0 of 40. The ring reading now takes the whole window
through `browser.screenshot` and reads its samples there: 0 of 40, and
`leaf-dev stills --base HEAD --state summary-card` reports it unchanged
in 5 of 5 runs (2 of 7 showed a change before). Every state captures
through the same path, so the fix covers each one whose page draws a
focus ring. `browser.screenshot` now says a capture takes the whole
window and why.
@max-sixty
max-sixty merged commit 15a30d7 into main Nov 27, 2026
6 checks passed
@max-sixty
max-sixty deleted the stills-summary-card-capture branch November 27, 2026 23:18
max-sixty added a commit that referenced this pull request Nov 27, 2026
#7464)

`leaf-dev stills` still reported style changes on identical arms in 3 of
63 card and thread states (detached-thread, threads-returning,
thread-picture): one arm read an auto margin as 0px and the other as
217px or 336px. `getComputedStyle` reports a margin's used length, which
Chromium sometimes misreports as 0px while the box stays put; on one tab
it flipped across a style walk or a ring reading. The style walk now
reads computed values through `computedStyleMap`, the cascade's own
value the stills header already asks for, so the margin reads `auto`.
Firefox has no `computedStyleMap` and keeps `getComputedStyle`.

The walk costs the same (about 0.3 s on the feature gallery). The three
states and summary-card read unchanged in 3 of 3 identical-arm runs, and
a `margin-left: 3%` added to the card is still reported, as `0px -> 3%`.
A follow-up to #7456, which Max asked to have fixed before this session
closed. `dev/tests/model/test_stills.py` passes.

> _This was written by Claude Code on behalf of max-sixty_
leaf-agent added a commit that referenced this pull request Nov 28, 2026
The frame-edge rules in `browser/styles/components/rendered.css` trim
the margin of a frame's first and last block, picking the first or last
child that isn't chrome (`.lf-ui`), generated (`data-lf-gen`) or a
popover. An element that never renders still counted, so a `<style>`,
`<script>` or `<template>` beside the real edge block left that block's
margin standing: 13px at each end of an author's frame. The rules now
also skip `script`, `style` and `template`, as the group rule in
`browser/layouts.css` already does. The specificity is unchanged, since
`:not()` takes its most specific argument, which stays a class.

This is what broke
`test_each_sampled_focus_ring_is_shown_whole_in_its_surface` after
#7456. Playwright's `style` screenshot option appends an unmarked
`<style>` to every shadow root while it captures. Inside `lf-option`'s
shadow root that `<style>` became the last child, so the slotted
paragraph kept its bottom margin and every option below moved down 13px
in the capture. #7456 made the ring reading sample a whole-window
capture taken with that option (`browser.screenshot`), so the reading
looked for each lower option's ring 13px above where the capture drew
it. With the CSS fixed, #7456's whole-window reading stays as it is.

**Verification**
- New
`test_an_element_that_never_renders_does_not_stand_at_a_frames_edge`
(tests/browser/test_render_options.py) fails on main with `the frame
leaves {'top': 13, 'bottom': 13}` and passes with the change. It also
checks that appending a `<style>` to an option's shadow root leaves the
option's height unchanged.
- The journey test fails on main with the issue's 16 faults over 42
samples and passes with the change (run by node id on Linux).
- The other frame tests in `test_render_options.py` and
`test_render_gate.py` pass, and so does
`tests/model/test_interact_layer.py`.
- `uv run leaf-dev stills` across every state against main: every crop
is pixel-identical. The only differences are `page-about`, whose source
listing prints the edited CSS, and frame noise in the video states. No
shipped example has a never-rendering element beside a block at a
frame's edge.

Closes #7531 — automated triage

---------

Co-authored-by: leaf-agent <[email protected]>
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