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

The CSS Working Group just discussed ``[css-sizing-3][css-values-4] Define `width` and `height` CSS values for SVG Elements in a mapping``, and agreed to the following:

* `RESOLVED: content dependent units used in width and height for inner SVG elements resolve to SVG's definition of auto`

<details><summary>The full IRC log of that discussion</summary>
&lt;dmangal> q+<br>
&lt;astearns> ack dmangal<br>
&lt;ydaniv> dmangal: in SVG we allow width and height to be allowed<br>
&lt;ydaniv> ... these properties can take certain values, like pixels or relative values, or special keywords<br>
&lt;ydaniv> ... these values are already defined in SVG or CSS spec<br>
&lt;ydaniv> ... however there are values in form of viewport units and certain CSS keywords that depend on box model<br>
&lt;ydaniv> ... the spec is ambiguous about how to treat them<br>
&lt;ydaniv> ... so how to resolve is not clear<br>
&lt;ydaniv> ... the CSS spec requires resolving to ICB<br>
&lt;ydaniv> ... but SVG don't form that<br>
&lt;ydaniv> ... for same reason the min/max content keywords are also ambiguous<br>
&lt;ydaniv> ... we started conversations, that these should be resolved on ICB if available<br>
&lt;ydaniv> ... and for content based values would resolve on box model, we recommend to resolve to auto<br>
&lt;ydaniv> ... with defined behavior in SVG spec<br>
&lt;ydaniv> ... we want opinion on that proposal, if possible to have mapping of these values to properties in SVG spec<br>
&lt;kbabbitt> s/resolved on ICB if available/resolved on ICB if available, or browser viewport if ICB is not available/<br>
&lt;ydaniv> astearns: let's take viewport units first<br>
&lt;ydaniv> ... it seems there's general agreement in the issue<br>
&lt;ydaniv> SebastianZ: browsers seem to agree<br>
&lt;ydaniv> astearns: except for FF<br>
&lt;ydaniv> kbabbitt: they agree when these units are applied on the outmost SVG element, and we ask to specify these on the inner SVG elements<br>
&lt;ydaniv> dmangal: if the ICB is available the viewport units are resolved to that<br>
&lt;flackr> q+<br>
&lt;ydaniv> SebastianZ: sounds doable<br>
&lt;astearns> ack flackr<br>
&lt;ydaniv> flackr: what does it mean for ICB not to be available?<br>
&lt;ydaniv> dmangal: ICBs available can generate box model, and SVG elements don't have them<br>
&lt;ydaniv> flackr: inner SVG elements do have an element that initiates that block<br>
&lt;ydaniv> ... conceptually they still have an ICB, just don't live in a world where this box exists<br>
&lt;ydaniv> dmangal: initial proposal is that to use the ICB from inner elements got negative feedback from browsers<br>
&lt;ydaniv> ... instead they want to always use the viewport for resolution<br>
&lt;ydaniv> astearns: for  anything other than the outermost SVG element<br>
&lt;ydaniv> dmangal: yes<br>
&lt;ydaniv> flackr: the ones that use the innermost of the SVG?<br>
&lt;ydaniv> dmangal: in the current proposal no<br>
&lt;ydaniv> flackr: as an analogy, if you make an iframe the vh unit inside it refer to the viewport<br>
&lt;ydaniv> astearns: everything in the iframe respects the box model<br>
&lt;ydaniv> flackr: I like the context<br>
&lt;dholbert> s/like/lack/<br>
&lt;ydaniv> astearns: wondering whether  we should try again<br>
&lt;ydaniv> ... there is supposed to be a recharted WG to deal with bugs in SVG<br>
&lt;ydaniv> ... and this seems like a bug to me that they could spend time on fixing<br>
&lt;dholbert> (I've got similar confusion/concerns to flackr FWIW, but am also lacking context about why we can't just use the ICB for the iframe &amp; how the ICB might not be defined)<br>
&lt;ydaniv> astearns: not pleased that we spec this just because current behavior is bad<br>
&lt;ydaniv> astearns: dmangal do you have more feedback?<br>
&lt;ydaniv> dmangal: one feedback to resolve against the ancestor's ICB<br>
&lt;ydaniv> ... in SVG case that would be the root SVG element<br>
&lt;ydaniv> ... the other proposal we got to resolve against the nearest element which is creating the viewport<br>
&lt;ydaniv> ... the first proposal was disliked because viewport units would be no different than percentages<br>
&lt;ydaniv> ... and second one was diliked because browsers don't currently do that<br>
&lt;ydaniv> astearns: don't accept either of those feedbacks<br>
&lt;flackr> q+<br>
&lt;ydaniv> ... if browers are currently managing at doing something with outermost SVG it wouldn't be that hard for doing it on inner SVG elements<br>
&lt;astearns> ack flackr<br>
&lt;ydaniv> flackr: I agree with astearns but also SVG have viewport definition that could establish a viewport that different than percentage resolution<br>
&lt;ydaniv> ...  if we did resolved against the viewport of the SVG element , where would it won't match its size it would have a meaning<br>
&lt;ydaniv> ... agree it's better to have something, even it's the same value, to be more sensible<br>
&lt;astearns> s/feedbacks/feedbacks. viewport units being the same as percentages is better than viewport units having different behavoir based on the SVG hierarchy/<br>
&lt;ydaniv> astearns: let's not resolve on anything regarding viewport units, and move on<br>
&lt;ydaniv> ... proposal for content units is to resovle to auto<br>
&lt;ydaniv> dmangal: the auto behavior is specifyed in spec<br>
&lt;ydaniv> ... for SVG is to default to 100%<br>
&lt;ydaniv> ... for image tag is to default to intrinsic image size<br>
&lt;flackr> q+<br>
&lt;ydaniv> ... for all other elements it should default to 0<br>
&lt;astearns> ack flackr<br>
&lt;ydaniv> flackr: does the SVG document have intrinsic size as well?<br>
&lt;ydaniv> dmangal: the outermost SVG can have a size<br>
&lt;ydaniv> ... other define their size using the width/height properties<br>
&lt;ydaniv> flackr: when you specify auto, would it make sense to follow the image's conventions?<br>
&lt;ydaniv> dmangal: for elements like rect or other SVG elements we won't be referencing anything<br>
&lt;ydaniv> ... for image tag we take intrinsic sizes when auto is used<br>
&lt;ydaniv> ... but for other SVG elements we take the intrinsic is their portion of the size<br>
&lt;ydaniv> flackr: for SVG we would use the known size, and if not known then , what would it be? maybe 0?<br>
&lt;astearns> SVG definition of auto: https://www.w3.org/TR/SVG2/geometry.html#Sizing<br>
&lt;ydaniv> dmangal:  in SVG case we use the width and height attributes<br>
&lt;ydaniv> ... would that cause a kind of confusion when we define their size?<br>
&lt;ydaniv> flackr: that would make sense for using intrisic size<br>
&lt;ydaniv> s/intrisic/intrinsic/<br>
&lt;ydaniv> flackr: I was thinking of viewbox for also providing the intrisic size<br>
&lt;ydaniv> dmangal: yes,<br>
&lt;ydaniv> flackr: we could have multiple fallbacks<br>
&lt;ydaniv> dmangal: Ok<br>
&lt;ydaniv> dholbert: for viewbox and intrinsic size it wouldn't good for many cases where they have ridicules values<br>
&lt;ydaniv> flackr: I think these are sensible<br>
&lt;ydaniv> dholbert: not necessarily<br>
&lt;ydaniv> ... in default we render 300x100<br>
&lt;ydaniv> ... there are edge cases, but not in specs<br>
&lt;astearns> dholbert: the viewbox is only reliable as a source of aspect ratio<br>
&lt;ydaniv> flackr: what happens when it's referenced by img elemnt?<br>
&lt;ydaniv> dholbert: we render the default 300x100<br>
&lt;ydaniv> ... I think there cases that we might resolved image to be size of the viewport when we don't have another fallback<br>
&lt;ydaniv> ... but in common fallback we use the 300x100 pixels<br>
&lt;ydaniv> ... we do use the viewbox to distinguish the aspect-ratio, but not for intrinsic size<br>
&lt;ydaniv> ... long story short, recommend against using viewbox for intrinsic size<br>
&lt;ydaniv> flackr: I know that many SVG editing tools have meaningful viewbox<br>
&lt;ydaniv> dholbert: usually that would be the coordinates space<br>
&lt;ydaniv> ... but when you export it's not good as defaults<br>
&lt;astearns> ydaniv: dholbert is correct. when designers export, they may just unknowingly export their huge design canvas<br>
&lt;kbabbitt> q+<br>
&lt;ydaniv> flackr: I'm convinced<br>
&lt;ydaniv> ... doesn't make value to use that<br>
&lt;astearns> ack kbabbitt<br>
&lt;ydaniv> kbabbitt: the proposal here is to treat CSS units that are content dependent as if they were auto<br>
&lt;ydaniv> ... does that make sense?<br>
&lt;ydaniv> astearns: makes some sense to me<br>
&lt;flackr> +1 makes sense to me to<br>
&lt;ydaniv> ... in particular that if SVG does get a better sense that they get that defintion if it's available to them<br>
&lt;ydaniv> ... sounds more flexible than 100%<br>
&lt;ydaniv> kbabbitt: that what the SVG spe currently says<br>
&lt;ydaniv> ... if there is no concept of content dependent units then treat it as auto<br>
&lt;ydaniv> ... and then we defer to what auto means in that concept<br>
&lt;flackr> q+<br>
&lt;ydaniv> astearns: proposed resolution: content dependent units resolve to SVG's definition of auto<br>
&lt;astearns> ack flackr<br>
&lt;ydaniv> flackr: one calrification, only for inner SVG elements?<br>
&lt;ydaniv> astearns: only for inner elements that don't participate in box model<br>
&lt;ydaniv> dholbert: just making sure there isn't anything other in the SVG spec<br>
&lt;astearns> https://www.w3.org/TR/SVG2/geometry.html#Sizing<br>
&lt;ydaniv> dmangal: you mentioned that in the SVG spec that auto has different meaning for different elements<br>
&lt;ydaniv> astearns: right, and dholbert was asking if this resolution applies only to some properties and not others?<br>
&lt;ydaniv> ... should we apply it only to widht and height?<br>
&lt;ydaniv> dmangal: yes, this is just for width and height<br>
&lt;ydaniv> astearns: fine let's scope it for that<br>
&lt;dmangal> q-<br>
&lt;astearns> proposed resolution:  content dependent units used in width and height for inner SVG elements resolve to SVG's definition of auto<br>
&lt;astearns> RESOLVED: content dependent units used in width and height for inner SVG elements resolve to SVG's definition of auto<br>
</details>


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


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

Received on Thursday, 21 August 2025 15:02:34 UTC