Skip to content

Clip SVG replaced content, except SVGs that blend with their backdrop - #634

Open
nicoburns wants to merge 1 commit into
mainfrom
devin/1786151607-block-replaced-sizing
Open

Clip SVG replaced content, except SVGs that blend with their backdrop#634
nicoburns wants to merge 1 commit into
mainfrom
devin/1786151607-block-replaced-sizing

Conversation

@nicoburns

@nicoburns nicoburns commented Aug 8, 2026

Copy link
Copy Markdown
Member

Summary

Rebased on latest main; the intrinsic SVG sizing and img/object dimension-attribute work originally in this PR has since landed on main (e.g. #606, #643, #662), so what remains is the SVG content clipping fix.

SVG elements now participate in replaced-content clipping like raster images (fixes overflow bleed in e.g. css/CSS2/positioning/absolute-replaced-width-003b.xht and css/css-overflow/display-flex-svg-overflow-default.html). Exception: an SVG containing backdrop-blending groups (mix-blend-mode mapped 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):

fn blends_with_backdrop(group: &usvg::Group) -> bool {
    group.blend_mode() != usvg::BlendMode::Normal
        || (!group.isolate() && group.children().iter().any(/* recurse into groups */))
}
let is_svg = element.svg_image_data().is_some_and(|data| !blends_with_backdrop(data.tree.root()));
let is_image = is_svg || element.raster_image_data().is_some();

Also adds an ElementData::svg_image_data() accessor returning the full SvgImageData (used by #642, which is stacked on this PR).

Link to Devin session: https://dioxus.staging.devinenterprise.com/sessions/51256d0b440341bd874c6dc59e138478
Requested by: @nicoburns

@nicoburns nicoburns self-assigned this Aug 8, 2026
@staging-devin-ai-integration

Copy link
Copy Markdown
Contributor

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR that start with 'DevinAI' or '@devin'.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment, CI, and merge conflict monitoring

@staging-devin-ai-integration
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
staging-devin-ai-integration Bot force-pushed the devin/1786151607-block-replaced-sizing branch from 32505e0 to 9f6188e Compare August 8, 2026 01:57
@staging-devin-ai-integration staging-devin-ai-integration Bot changed the title Intrinsic sizing for block-level replaced elements; unscaled rendering for viewBox-less SVG Intrinsic sizing for inline SVG; viewport re-resolution and clipping for SVG content; img/object dimension attributes Aug 8, 2026
@staging-devin-ai-integration
staging-devin-ai-integration Bot force-pushed the devin/1786151607-block-replaced-sizing branch from 9f6188e to 9e02773 Compare August 8, 2026 02:12
@staging-devin-ai-integration
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
staging-devin-ai-integration Bot force-pushed the devin/1786151607-block-replaced-sizing branch from 9e02773 to 8cfe721 Compare August 8, 2026 02:19
@staging-devin-ai-integration
staging-devin-ai-integration Bot force-pushed the devin/1786151607-block-replaced-sizing branch from 8cfe721 to cc929f6 Compare August 8, 2026 02:34
@staging-devin-ai-integration
staging-devin-ai-integration Bot changed the base branch from main to devin/1786156433-img-object-dims August 8, 2026 02:34
@staging-devin-ai-integration
staging-devin-ai-integration Bot force-pushed the devin/1786151607-block-replaced-sizing branch from cc929f6 to 7a93e6b Compare August 13, 2026 17:30
@staging-devin-ai-integration
staging-devin-ai-integration Bot changed the base branch from devin/1786156433-img-object-dims to main August 13, 2026 17:31
@staging-devin-ai-integration staging-devin-ai-integration Bot changed the title Intrinsic sizing for inline SVG; viewport re-resolution and clipping for SVG content; img/object dimension attributes Clip SVG replaced content, except SVGs that blend with their backdrop Aug 13, 2026
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