Skip to content

Don't clamp replaced elements' max size to the available space - #937

Merged
nicoburns merged 1 commit into
mainfrom
devin/1790285644-no-available-space-clamp-replaced
Sep 24, 2026
Merged

nicoburns merged 1 commit into
mainfrom
devin/1790285644-no-available-space-clamp-replaced

Conversation

@nicoburns

@nicoburns nicoburns commented Sep 24, 2026 •

Copy link
Copy Markdown
Member

Summary

compute_replaced_layout capped replaced elements' max size at the available space:

 let max_size = style.max_size().maybe_resolve(..)
-    .or(available_space.into_options())
-    .maybe_min(available_space.into_options())
     .maybe_max(min_size)

That isn't in the spec. Replaced elements should overflow their container, not shrink to fit it. In narrow containers (e.g. the width: 0 divs used by many css-text/line-breaking tests) <img>s collapsed to 0×0.

WPT css + html vs main: 24 tests improved, 4 regressed (+18 subtests).

  • css-sizing/keyword-sizes-on-replaced-element.html, css-sizing/stretch/aspect-ratio-2.html and css-multicol/multicol-on-broken-image-alt-text.html were passing only because of the clamp. They depend on min-content/fit-content/stretch sizing of replaced elements, which isn't implemented properly.
  • css-text/line-breaking/line-breaking-replaced-005.html regresses with the current Parley pin. It's fixed by Don't force a line break after an inline box that overflows at the start of a line parley#61, which stops Parley from forcing a line break after an inline box that overflows at the start of a line. With that PR included the result is 25 improved, 3 regressed.

line-breaking-replaced-001/004/006 also need a root inline strut for image-only lines. That's left to #832.

Link to Devin session: https://dioxus.staging.devinenterprise.com/sessions/9f574399dc5b4df490331cd42ec926e5
Open in Devin Desktop: https://dioxus.staging.devinenterprise.com/desktop/session/9f574399dc5b4df490331cd42ec926e5?variant=devin-insiders
Requested by: @nicoburns

WPT results

Subtests: 31 newly passing, 14 newly failing (net +17).

Full diff (27 changed tests)
+ FAIL => PASS    [1/1]   +1  css/CSS2/margin-padding-clear/margin-border-padding-002.xht
+ FAIL => PASS    [1/1]   +1  css/CSS2/positioning/absolute-replaced-height-002.xht
+ FAIL => PASS    [1/1]   +1  css/CSS2/positioning/absolute-replaced-height-004.xht
+ FAIL => PASS    [1/1]   +1  css/CSS2/positioning/absolute-replaced-height-009.xht
+ FAIL => PASS    [1/1]   +1  css/CSS2/positioning/absolute-replaced-height-011.xht
+ FAIL => FAIL   [4/12]   +3  css/css-anchor-position/anchor-size-replaced-001.html
+ FAIL => PASS    [1/1]   +1  css/css-backgrounds/background-size/background-size-cover.xht
+ FAIL => PASS    [1/1]   +1  css/css-contain/contain-paint-clip-013.html
+ FAIL => PASS    [1/1]   +1  css/css-contain/contain-size-multicol-004.html
+ FAIL => PASS    [1/1]   +1  css/css-grid/abspos/grid-abspos-staticpos-align-self-img-001.html
+ FAIL => PASS    [1/1]   +1  css/css-grid/abspos/grid-abspos-staticpos-align-self-img-last-baseline-001.html
+ FAIL => PASS    [1/1]   +1  css/css-grid/abspos/grid-abspos-staticpos-justify-self-img-001.html
+ FAIL => PASS    [1/1]   +1  css/css-grid/abspos/grid-abspos-staticpos-justify-self-img-last-baseline-001.html
+ FAIL => PASS    [1/1]   +1  css/css-grid/nested-grid-item-block-size-001.html
- PASS => FAIL    [0/1]   -1  css/css-multicol/multicol-on-broken-image-alt-text.html
+ FAIL => PASS    [1/1]   +1  css/css-multicol/replaced-content-spanner-auto-width.html
+ FAIL => PASS    [1/1]   +1  css/css-overflow/overflow-img-display-table.html
+ FAIL => PASS    [1/1]   +1  css/css-sizing/canvas-intrinsic-dynamic.html
+ FAIL => PASS    [1/1]   +1  css/css-sizing/intrinsic-percent-replaced-014.html
+ FAIL => FAIL  [34/60]   +7  css/css-sizing/keyword-sizes-on-abspos.html
- FAIL => FAIL  [39/84]  -11  css/css-sizing/keyword-sizes-on-replaced-element.html
+ FAIL => PASS    [1/1]   +1  css/css-sizing/replaced-aspect-ratio-stretch-fit-001.html
+ FAIL => PASS    [1/1]   +1  css/css-sizing/replaced-aspect-ratio-stretch-fit-002.html
+ FAIL => PASS    [1/1]   +1  css/css-sizing/replaced-fractional-height-from-aspect-ratio-2.html
- FAIL => FAIL   [1/18]   -1  css/css-sizing/stretch/aspect-ratio-2.html
- PASS => FAIL    [0/1]   -1  css/css-text/line-breaking/line-breaking-replaced-005.html
+ FAIL => PASS    [1/1]   +1  css/css-transforms/skew-test1.html

Generated by the WPT workflow.

@staging-devin-ai-integration

Copy link
Copy Markdown
Contributor

I'll fix CI failures and address comments from users with write access that start with 'Devin'.

  • Disable automatic comment, CI, and merge conflict monitoring

@nicoburns
nicoburns merged commit 4282126 into main Sep 24, 2026
16 checks passed
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.

1 participant