Repository navigation
fix: let no style, script or template stand at a frame's edge - #7543
Merged
Merged
Conversation
The frame-edge rules in rendered.css trim the margin of a frame's first and last block, picking that block as the first or last child that isn't chrome, generated or a popover. An element that never renders counted as a block, so a `<style>`, `<script>` or `<template>` beside the real edge block left that block's margin standing: 13px at each edge of an author's frame. Playwright's `style` screenshot option appends an unmarked `<style>` to every shadow root while it captures. Inside `lf-option`'s root it became the last child, the slotted paragraph kept its bottom margin, and every option below moved down 13px in the capture. Since #7456 the ring reading samples a whole-window capture taken with that option (`browser.screenshot`), so it read each lower option's ring 13px from where the page measured it, failing test_each_sampled_focus_ring_is_shown_whole_in_its_surface with 16 faults on option lists. The rules now skip `script`, `style` and `template`, as layouts.css's group rule already does. The new browser test fails before the change (13px at each end of an author's frame) and passes after; the ring journey test fails on main and passes with the change. Closes #7531
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.
The frame-edge rules in
browser/styles/components/rendered.csstrim 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 skipscript,styleandtemplate, as the group rule inbrowser/layouts.cssalready 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_surfaceafter #7456. Playwright'sstylescreenshot option appends an unmarked<style>to every shadow root while it captures. Insidelf-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
test_an_element_that_never_renders_does_not_stand_at_a_frames_edge(tests/browser/test_render_options.py) fails on main withthe 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.test_render_options.pyandtest_render_gate.pypass, and so doestests/model/test_interact_layer.py.uv run leaf-dev stillsacross every state against main: every crop is pixel-identical. The only differences arepage-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