Skip to content

Name the declarations behind each computed-style difference in leaf-dev stills - #4713

Merged
max-sixty merged 3 commits into
mainfrom
stills-computed-styles
Oct 30, 2026
Merged

max-sixty merged 3 commits into
mainfrom
stills-computed-styles

Conversation

@max-sixty

Copy link
Copy Markdown
Owner

leaf-dev stills now says which rule is behind each computed-style difference it reports. Under the grouped differences in styles.txt, it takes each group's first element and lists the declarations that match it in only one arm, or in a different order, each labelled with its sheet, @layer, @scope and selector. The declarations come from Chrome's DevTools protocol (CSS.getMatchedStylesForNode). Two of the sessions surveyed for #4648 wrote this lookup by hand to find a cause.

What it shows

Replayed against #4637's base (leaf-dev stills ae2e3f34f --state on-me, about 2 minutes), it names both causes that session found by hand:

html
    + theme.css @layer lf-base :where(:root) { color: revert; }
    + theme.css @layer lf-base :where(:root) { font-family: revert; }
…lf-options#ar-3ds-choice > form.lf-another.lf-ui
    + theme.css @layer lf-base lf-options:has(> lf-option > strong) > .lf-another { font: inherit; }

It also names a later commit's :nth-child(1 of :not(.lf-ui, [data-lf-gen])) { margin-block-start: 0 } behind a paragraph's margin change. Where an element's declarations match on both arms, such as the hidden-widget noise, it says none: it inherits the difference or reads it from a custom property. A separate probe read an element inside lf-diff's shadow tree on pr-walkthrough, which is where the .lf-ui reorder regression appeared.

Design

  • Declarations, not a winner. Naming the declaration that wins would take part of the cascade. Shorthands such as font: var(...) leave their longhands blank in the protocol, and on top of that it would need logical properties, !important across layers, and shadow-tree ordering. Listing what changed, in the protocol's order, avoids all of that, and the reader infers the winner. A declaration that moved shows as a - line and a + line with the same text.
  • Labels stable across arms. The labels use a sheet's file name, or constructed, <style> or user-agent. Never a URL, since an inline sheet's URL is its document's and includes the arm's port.
  • Both arms stay open. capture is now a context manager, so the comparison can read both tabs after style_changes has found which elements differ.

Also here

main's stills tests have failed since #4686, which launches the browser with ignore_default_args; the test's stand-in for headless_shell now accepts launch options. capture is annotated as a Generator, as ty (#4647) asks.

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

…ev stills

For the first element of each style group, `styles.txt` now lists the
declarations Chromium's inspector reads as matching it in only one arm, or
in another order, each labelled with its sheet, layers, scope and selector.
That names the rule a change added, removed, edited or moved, which sessions
had been finding by hand with their own CDP scripts. Both arms' tabs now stay
open through the comparison so the inspector can read them.

It lists declarations rather than naming a winner. Working out which
declaration wins would take a partial cascade: shorthands whose longhands
wait on var(), logical properties, !important across layers, and shadow-tree
contexts.

Replayed against #4637's base (ae2e3f3) on the corpus state, it names both
causes that session found by hand: `:where(:root) { color: revert;
font-family: revert }` behind html's colour and font, and
`lf-options:has(> lf-option > strong) > .lf-another { font: inherit }` behind
the Another option form's change to the reading face.
…ate capture as a Generator

#4686 launched stills' browser with ignore_default_args, which the test's
headless_shell stand-in refused, so all three stills tests failed on main.
ty (#4647) asks a @contextmanager to return Generator.
@max-sixty
max-sixty merged commit f4f7a19 into main Oct 30, 2026
4 checks passed
@max-sixty
max-sixty deleted the stills-computed-styles branch October 30, 2026 00:32
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