Repository navigation
Read every element's computed style in leaf-dev stills, beside its screenshots - #4648
Merged
Merged
Conversation
…reenshots Each stills capture now also reads a fixed set of computed properties (the faces, boxes and flow a rule sets, not the geometry it produces) for every element in the document and its open shadow trees, hidden ones included, on both arms. A state whose styles differ, or that has a subtree only one arm has, counts as changed, and its styles.txt groups the differences by property and values. The corpus states read every composed page. Sessions kept hand-writing this sweep (about nine since September, 50 to 1,100 lines each); developing-leaf now points cascade questions at stills.
leaf-agent
approved these changes
Oct 28, 2026
leaf-agent
left a comment
Collaborator
There was a problem hiding this comment.
The additional developer-tool test test_preview_file_subscription_follows_atomic_replacements fails at assert pin in watched.roots on both this head and current main (ed2bc25f9386813ac917320d7fc4148c81c3c399); it does not withhold this approval.
max-sixty
added a commit
that referenced
this pull request
Oct 29, 2026
…and keys #4648 made `stills` read every element's `STYLED` computed properties, keyed by its path, in every capture. The census read the same elements a second time: its own walk for presses, its own `getComputedStyle` reads and its own ids for pairing. It now has the one reader: - The styles reading moves to `dev/leaf_dev/styled.js` and leaves its reader on the page (`leafDevStyled`): the properties, the element each key names, and the read of any element or pseudo-element through `STYLED`. `STYLED` gains `stroke` and `fill`, an icon's ink, which `styles.txt` now reads too. - The census finds its presses among the elements that reading keyed, and reads every computed property, at rest, revealed and under the pointer, through that reader. It reads only geometry itself: boxes, the hit test and the `::before` box, which `STYLED` leaves out. - A press's identity is its styles key. Pairing reads its own id and its nearest ancestor's id off that key, in place of the census's own id/data-key reading, and the report names an element by its key's last part.
max-sixty
added a commit
that referenced
this pull request
Oct 30, 2026
…ev stills (#4713) `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 ae2e3f3 --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_
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.
leaf-dev stillsnow reads every element's computed style on both arms, beside the screenshots it already takes, so a cascade question ("does moving this rule change anything?") is one command instead of a hand-written sweep. Sessions here have written that sweep at least nine times since September, at 50 to 1,100 lines each; the reading-theme split (#4637) alone wrote five variants.What it does
STYLED: faces, borders, outlines, margins, padding, display, overflow and similar) for every element in the document and in every open shadow tree, hidden ones included. It leaves out width, height and offsets, which shift with every reflow and which the screenshots already show.styles.txtgroups the differences by property and value, with example elements, and names each one-sided subtree by its outermost element, so a chart that drew in only one arm is one row rather than 500.on-me,on-agent) read every page the corpus composes. A rule that depends on a page's own Layout, such as a sidebar page's panels, shows up only in that page's own states.build_sourcenow generates the corpus before reading it. Without that, the corpus states failed in any checkout that hadn't generated it yet, and so did--authored, which now copiesdocs/examples.htmlfor the generator.developing-leafnow points cascade questions atstillsinstead of a hand-written sweep.Checked against earlier sessions
ae2e3f34fvs13b1289e2): it reproduces that session's findings:html's own colour and font changed, and nothing else changed except timing noise. It also shows that the Another option form and its wrappers changed from UI sans 14px to the inherited reading serif 17px. The text field inside is 17px serif on both arms and the box is the same size, so nothing visible changed. The session's PR didn't list this.theme.cssplacement (rebuilt on a scratch commit): it reproduces the finding that decided the placement,section.panelregaining 18px margins on sidebar pages (pr-walkthrough, triage-board)..lf-uireorder that repainted lf-diff (Sept 19): the pages involved (pr-walkthrough, corpus) are in the catalogue, and its probe read the same kind of difference.<style>with element rules. A trial version of that reading on Split Leaf's reading look into a bundled theme a page can decline #4637 added nothing the plain reading didn't already show. Leaf's faces now sit in cascade layers that page CSS outranks by design, so I left it out. Also not covered: hover/focus censuses within one arm (the unmergedface-censusbranch), pseudo-elements, print media, and Firefox.Noise
A widget inside a tab or disclosure the page opens shut may or may not have drawn by the time of the reading, in either arm. This happened with lf-chart in the corpus's shut tabs, and with lf-generated-document in dynamic-widgets under
--authored. The module header says to rerun a state before taking a difference confined to one such widget as a change. The race itself is a runtime question, left for a separate change.