Re: [csswg-drafts] [css-sizing-3][css-values-4] Define `width` and `height` CSS values for SVG Elements in a mapping (#12376)

Hi @kbabbitt, your first statement is correct, but Firefox also behaves the same for these units, that is: 

**Currently, both Chromium and Firefox resolves vh, vw, vmin, vmax in SVG against the ICB if one is available, otherwise against the initial viewport. Here the initial viewport's definition is of the browser viewport and not in the SVG context.**
(Note: This is the behaviour I observed when width and height were given as attributes on a SVG element itself)

As for your second question of why certain tests are failing in Chromium,
For the viewport-units (like vw,vh): That is because I wrote the expectations taking the *initial viewport* in SVG context which deviates from the current implementation in Chromium. 
Based on the feedback from @longsonr and @emilio if I update the expectations of these tests with the *initial viewport* being browser viewport the tests in Chromium should start passing.

For content-based keywords (like min-content.stretch etc): I believe in one of the comments it was suggested that we should treat them as `auto` rather than a blanket 100%. This new behaviour is currently not implemented in Chromium for SVG elements and hence they fail. When passed as styles they are simply ignored.

I will update this discussion of viewport-units and content-based keywords as a new proposal in the description of this issue, so that we are aligned. I am also working on a [draft PR](https://github.com/web-platform-tests/wpt/pull/54128) to update the expectations of viewport-units related test cases based on this discussion.

-- 
GitHub Notification of comment by goldenboy777
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/12376#issuecomment-3154021803 using your GitHub account


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Tuesday, 5 August 2025 08:06:54 UTC