Re: [csswg-drafts] [css-images] Behaviour of SVG degenerate aspect-ratios (#6286)

The CSS Working Group just discussed `[css-images] Behaviour of SVG degenerate aspect-ratios`.

<details><summary>The full IRC log of that discussion</summary>
&lt;dael> Topic:  [css-images] Behaviour of SVG degenerate aspect-ratios<br>
&lt;lea> I will reiterate that using CSSColorValue as input is not something that needs to be explicitly added to a spec, as long as it serializes<br>
&lt;dael> github: https://github.com/w3c/csswg-drafts/issues/6286<br>
&lt;dael> iank_: Digging into replaced elements. Series of test cases in grid repo that is probing this and there's a subtle difference in impl<br>
&lt;dael> iank_: If you go to SVG issue it contins example in 1st comment. When embed SVG in image need to know svg intrinsic size and aspect-ratio<br>
&lt;dael> iank_: svg are unique in you can have one or the other or both. FF has intrinsic but no a-r.<br>
&lt;dael> iank_: Blink and Gecko has both<br>
&lt;dael> iank_: Specific exampl,e have width 0px, height 50px. Viewbox says a-r is 1-1<br>
&lt;dael> iank_: FF have intrinsic 0x50 which matches. a-r is different<br>
&lt;dael> iank_: FF does one interpretation where treats a-r as degenerate and null. Blink and WK go this is degenerate so fallback to viewbox<br>
&lt;TabAtkins> example: &lt;img width=100px src="&lt;svg viewBox='0 0 1 1' width='0' height='50px'>"><br>
&lt;dael> iank_: That's the crux of the issue<br>
&lt;TabAtkins> what is the &lt;img>'s height?<br>
&lt;astearns> ack fantasai<br>
&lt;dael> fantasai: If in general case have width of 1px rather than 0 we will ignore viewbox and use a-r from width and height?<br>
&lt;dael> iank_: Correct<br>
&lt;dael> fantasai: b/c it's degenerate blink fallsback to viewbox<br>
&lt;dael> iank_: Correct. Written down in the css spec. Linked to SVG text but it's same text.<br>
&lt;fantasai> s/fallsback to viewbox/falls back to viewbox, and gecko continues to ignore viewbox/<br>
&lt;dael> iank_: I don't think when algo was written it considered that width and height could result in degenerate a-r<br>
&lt;dael> fantasai: Yeah, I don't htink we considered this<br>
&lt;dael> iank_: You can also spec width -50px and get same behavior<br>
&lt;dael> fantasai: I have no opinion of what we out to do here. Don't think it matters for authoring. Would be interested to know what Amelia thinks<br>
&lt;TabAtkins> I too have no real opinion on how we resolve this. Both behaviors seem reasonable.<br>
&lt;dael> iank_: Yeah, tagged Amelia on the SVG but haven't received a response<br>
&lt;dael> fantasai: Is there a reason to do one or the other?<br>
&lt;dael> iank_: Not particularly. Could argue blink/WK is slightly better in that we use an a-r when it's available. But really I don't expect authors to write this. Only reason I'm bringing it up is there's 6 test cases asserting a behavior, I think written by a Gecko engineer. Not clear those tests are right<br>
&lt;dael> fantasai: Yeah, should clarify<br>
&lt;dael> fantasai: As long as we can't think of a reason my inclination is let Amelia read and make a decision for us<br>
&lt;dael> fantasai: I can ping her<br>
&lt;dael> iank_: Anyone else with thoughts?<br>
&lt;dael> astearns: This is just what to do in this edge case and theres no real world changes we can think of that would result from this?<br>
&lt;dael> iank_: Correct. Not addressing b/c a bug. Going through grid test suite and noticed this edge case was unclear<br>
&lt;dael> astearns: Happy going with Amelia but also happy going with 2/3 of engines went this way so let's spec<br>
&lt;dael> astearns: Leave until Amelia comes?<br>
&lt;dael> fantasai: Or resolve to do whatever she says<br>
&lt;dael> astearns: Objects?<br>
&lt;dael> chrishtr: Question<br>
&lt;dael> chrishtr: Did we discuss if degenerate cases in non-svg handled same?<br>
&lt;dael> fantasai: 2 sourses of info for a-r. most image formats don't have that confusion. We have general degenerate case, but here is when hit in more primary source of information. Do we fall back to secondary?<br>
&lt;dael> iank_: Some precedent in a-r where if you specific degenerate it falls back to images a-r I believe<br>
&lt;dael> iank_: Is that right?<br>
&lt;dael> fantasai: Don't remember off top of head but I think we decided that to match SVG<br>
&lt;fantasai> "If the &lt;ratio> is degenerate, the property instead behaves as auto."<br>
&lt;dael> iank_: With that small amount of precedent then Blink/WK behavior you can tie together. a-r behavior is if it's degenerate it falls back to next best thing<br>
&lt;dael> astearns: Did that answer question?<br>
&lt;dael> chrishtr: What I heard is it's much more uncommon because images are unlikely to have 0 height<br>
&lt;dael> fantasai: Not a real world case<br>
&lt;iank_> https://www.software.hixie.ch/utilities/js/live-dom-viewer/?saved=9292<br>
&lt;dael> chrishtr: b/c SVG is replaced leemnt it behaves different<br>
&lt;dael> iank_: Example ^ showing fallback for a-r property. I spec degenerate where it will use the images a-r<br>
&lt;dael> iank_: That's the fallback. If we want a-r to have this fallback being more consistent then blink/wk fallback makes more sense<br>
&lt;cbiesinger> I mean, for a while a-r: 1/0 was a parse error<br>
&lt;dael> astearns: Given that bit of consistency shall we resolve on Blink/WK and see if Amelia objects?<br>
&lt;cbiesinger> but I think that was changed for consistency with calc() that computes to zero<br>
&lt;fantasai> and then changed to 'auto' because that's what SVG does, IIRC ...<br>
&lt;dael> dholbert: I weakly lean against that. Feel like with a-r property if you're explicitly providing invalid it makes sense to not do anything. In SVG we've got a usable height and width and it makes sense that does establish a value to use<br>
&lt;dael> iank_: You can also spec -10px width and has same behavior. And you don't render at -10<br>
&lt;dael> dholbert: True. More that a-r is downstream. Don't feel too strongly. Feels a little weird adding a special fallback that no one will need for real content. I think it's a trivial change<br>
&lt;dael> fantasai: I think we should wait and hear back from Amelia. She might have SVG logic that leans one way<br>
</details>


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


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

Received on Wednesday, 19 May 2021 16:36:03 UTC