Intrinsic sizing for inline SVG; viewport re-resolution and clipping for SVG content; img/object dimension attributes - #634
Open
nicoburns wants to merge 1 commit 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:
|
staging-devin-ai-integration
Bot
changed the base branch from
main
to
devin/1786154184-item-is-replaced
August 8, 2026 01:57
staging-devin-ai-integration
Bot
force-pushed
the
devin/1786151607-block-replaced-sizing
branch
from
August 8, 2026 01:57
32505e0 to
9f6188e
Compare
staging-devin-ai-integration
Bot
force-pushed
the
devin/1786151607-block-replaced-sizing
branch
from
August 8, 2026 02:12
9f6188e to
9e02773
Compare
staging-devin-ai-integration
Bot
changed the base branch from
devin/1786154184-item-is-replaced
to
main
August 8, 2026 02:13
staging-devin-ai-integration
Bot
force-pushed
the
devin/1786151607-block-replaced-sizing
branch
from
August 8, 2026 02:19
9e02773 to
8cfe721
Compare
This was referenced Aug 8, 2026
staging-devin-ai-integration
Bot
force-pushed
the
devin/1786151607-block-replaced-sizing
branch
from
August 8, 2026 02:34
8cfe721 to
cc929f6
Compare
staging-devin-ai-integration
Bot
changed the base branch from
main
to
devin/1786156433-img-object-dims
August 8, 2026 02:34
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
Builds on #639 and #643 (img/object dimension attribute mapping, now the base branch of this PR). This PR fixes how replaced SVG (and img) elements are sized and painted. #642 (stacked on this PR) adds viewport re-resolution for viewBox-less SVG; together with #643 they make
css/CSS2/normal-flow/block-replaced-height-001/002/004/005/006/007pass and a full-suite comparison vs main shows 51 tests fixed, 3 regressed (regressions analysed below).Inline SVG intrinsic sizing (
layout/mod.rs,node/element.rs)SvgImageDatapreviously exposed onlyusvg::Tree::size(), which conflates "declared absolute dimensions" with usvg's fallbacks (percentages resolved against 100x100, viewBox size, etc.). New accessors preserve what the root<svg>actually declared:intrinsic_width()/intrinsic_height():Someonly for absolute (non-percentage)width/heightattributesviewbox_aspect_ratio(): ratio from theviewBoxwhen dimensions are missingresolved_width()/resolved_height(): inline-<svg>-only resolution where percentage attributes resolve against the containing blockThe replaced measure function now receives a correct
inherent_size/inherent_ratiofor SVG instead of usvg's fallback size, so CSS2's intrinsic-sizing rules (ratio transfer, 300x150 default) apply per spec.SVG content clipping (
render.rs)SVG elements now participate in replaced-content clipping like raster images (fixes overflow bleed in e.g.
css/CSS2/positioning/absolute-replaced-width-003b.xhtandcss/css-overflow/display-flex-svg-overflow-default.html). Exception: an SVG containing backdrop-blending groups (mix-blend-modemapped by usvg) is not clipped, since the isolated buffer of a clip layer would make the blend composite against transparency instead of the page backdrop (css/compositing/mix-blend-mode/mix-blend-mode-svg.html).Remaining known regressions (3)
css/css-rhythm/replaced-elements/block-level-{img,canvas}-margins-affected-by-block-step-size.html: these passed on main only because replaced elements were stretch-sized to the 100px container. With correct intrinsic sizing they need actualblock-step-sizesupport to pass.css/css-lists/list-item-definition.html:display: list-itemon<svg>/<img>plus::before/::afterlist-item markers; the previous pass was accidental (test and ref both rendered identically wrong). Needs marker-box work unrelated to replaced sizing.WPT results
52 newly passing, 5 newly failing (net +47).
Full diff (57 changed tests)
Generated by the WPT workflow.
Link to Devin session: https://dioxus.staging.devinenterprise.com/sessions/51256d0b440341bd874c6dc59e138478
Requested by: @nicoburns