Skip to content

LibWeb: Stretch aspect-ratio flex items only when container is definite#9710

Merged
awesomekling merged 1 commit into
LadybirdBrowser:masterfrom
tcl3:libweb_flex_aspect_ratio_sizing_fix
May 28, 2026
Merged

LibWeb: Stretch aspect-ratio flex items only when container is definite#9710
awesomekling merged 1 commit into
LadybirdBrowser:masterfrom
tcl3:libweb_flex_aspect_ratio_sizing_fix

Conversation

@tcl3

@tcl3 tcl3 commented May 28, 2026

Copy link
Copy Markdown
Member

A flex item with a preferred aspect ratio but no natural width or height and no definite cross size is stretched to fill its container's main size as a fallback. This was applied unconditionally, but when the container itself is being measured for an intrinsic size, the container's main size is indefinite and the size evaluated to zero. This clobbered the max-content size the flex algorithm had already computed as the intrinsic contribution.

Fixes #9708

A flex item with a preferred aspect ratio but no natural width or
height and no definite cross size is stretched to fill its container's
main size as a fallback. This was applied unconditionally, but when
the container itself is being measured for an intrinsic size, the
container's main size is indefinite and the size evaluated to zero.
This clobbered the max-content size the flex algorithm had already
computed as the intrinsic contribution.
@awesomekling
awesomekling merged commit 7752bc5 into LadybirdBrowser:master May 28, 2026
14 of 15 checks passed
@tcl3
tcl3 deleted the libweb_flex_aspect_ratio_sizing_fix branch May 29, 2026 02:18
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.

Percent-sized SVG in nested flexbox has 0 size

2 participants