Fix automatic minimum size and aspect-ratio sizing of replaced flex items - #526
Closed
nicoburns wants to merge 2 commits into
Closed
Fix automatic minimum size and aspect-ratio sizing of replaced flex items#526nicoburns wants to merge 2 commits into
nicoburns wants to merge 2 commits into
Conversation
Contributor
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
devin-ai-integration
Bot
force-pushed
the
devin/1784873193-flexbox-min-size-aspect-ratio
branch
from
July 24, 2026 18:30
5a6ef1b to
cdbf229
Compare
nicoburns
marked this pull request as ready for review
July 25, 2026 03:23
devin-ai-integration
Bot
force-pushed
the
devin/1784873193-flexbox-min-size-aspect-ratio
branch
from
July 25, 2026 03:25
cdbf229 to
73efd3b
Compare
devin-ai-integration
Bot
force-pushed
the
devin/1784873193-flexbox-min-size-aspect-ratio
branch
from
August 4, 2026 12:26
73efd3b to
6ae77d2
Compare
Contributor
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.
Summary
Fixes a group of failing css-flexbox WPT tests around
min-width/height: auto(automatic minimum size, css-flexbox-1 §4.5) and aspect-ratio/replaced flex items. Fulljust wpt css/css-flexboxresults: 654 → 699 whole tests passed, 1714 → 1765 subtests passed (no regressions; a companion Taffy fix adds 6 more, see below).Root causes and fixes:
replaced_measure_functionre-clamped/overrode sizes already resolved by the parent layout algorithm. It now receivessizing_modeandrequested_axisfromLayoutInput:SizingMode::ContentSize, preferred/min size styles in the measured axis are ignored (the parent algorithm applies them itself), while opposite-axis constraints are kept so they transfer through the aspect ratio (transferred size suggestion).SvgImageDatanow recordsviewbox_aspect_ratioalongside the absoluteintrinsic_width/intrinsic_height, andintrinsic_size()implements CSS replaced-element sizing: declared absolute dimensions win; a missing dimension is computed from the viewBox ratio; with no dimensions at all, the CSS default object size (300x150, contained by the intrinsic ratio) applies. Previouslyusvg::Tree::size()was used directly, which resolvesviewBox-only SVGs to the viewBox dimensions.parse_svg_imagealso re-parses with the CSS-computed missing dimension injected so the painted canvas matches layout.<canvas>elements now get their intrinsic size fromwidth/heightattributes (default 300x150) instead of 0x0, andcanvaswas missing from the inline-box tag list inconstruct.rs, so inline canvases were dropped from layout entirely.data-expected-client-width/heightassertions (border-box size minus borders).Companion Taffy PR (transferred min/max sizes, cross-size clamping in flex base size calculation) fixes 6 further tests in this group:
flex-minimum-width-flex-items-012,flexbox-min-width-auto-002c,flexbox-min-height-auto-002c,flex-minimum-height-flex-items-021,flex-aspect-ratio-img-column-005,aspect-ratio-transferred-max-size.Tests fixed (requested group):
flex-minimum-width-flex-items-004..013,flexbox-min-width-auto-002a/b/c,flex-aspect-ratio-img-row-001/002/003/007/008/009/010/011/013/015/017,flex-aspect-ratio-img-column-013,aspect-ratio-intrinsic-size-001,flexitem-percentage-height-img-001, plus 3 of 4 subtests offlex-aspect-ratio-img-row-005.Not fixed (with reasons):
flex-minimum-height-flex-items-009— requires dynamic style mutation via script + relayout (runner limitation).flexitem-stretch-image— needsdata-expected-displayrunner support and hypothetical-cross-size-from-flexed-main-size behaviour.flex-minimum-size-001(5/6),flex-minimum-size-002,flex-aspect-ratio-cross-size-002— percentage min-size / nested percentage cross-size resolution issues out of scope for this group.flex-aspect-ratio-img-row-005(3/4) — remaining subtest needs content-box-aware aspect-ratio transfer in Taffy (Taffy currently applies aspect ratios to border-box sizes).Link to Devin session: https://app.devin.ai/sessions/0f8547b7fbb949e28e9acdbedb1ca8d2
Requested by: @nicoburns
Devin Review
WPT results
96 newly passing, 10 newly failing (net +86).
Full diff (106 changed tests)
Generated by the WPT workflow.