Re: [csswg-drafts] [css-sizing-4] aspect-ratio via width and height attributes doesn't work for <video> (#7524)

The CSS Working Group just discussed `aspect-ratio via width/height doesn't work for <video>`, and agreed to the following:

* `RESOLVED: Clarify that aspect-ratio:auto doesn't pull aspect ratio from the default object size, it can only pull from an actual loaded resource`

<details><summary>The full IRC log of that discussion</summary>
&lt;fantasai> Topic: aspect-ratio via width/height doesn't work for &lt;video><br>
&lt;fantasai> github: https://github.com/w3c/csswg-drafts/issues/7524<br>
&lt;fantasai> scribe+ bramus<br>
&lt;bramus> TabAtkins: so, the aaspect ratio property has the auto keyword and it will take the ar from the resource otherwise use the other one as the fallback<br>
&lt;bramus> TabAtkins: this works great, expect for video<br>
&lt;bramus> TabAtkins: bc video does not communicate the ar<br>
&lt;bramus> TabAtkins: instead the size is 300 by 150<br>
&lt;bramus> TabAtkins: and the algo will say cool i have an ar<br>
&lt;bramus> TabAtkins: needs a small fix, suggested by jaffathecake<br>
&lt;emilio> q+<br>
&lt;bramus> TabAtkins:<br>
&lt;bramus> TabAtkins: new concept of pending your first resoruce size instead of "do you have an ar" ask "have you ever received an ar from you rcontent?"<br>
&lt;bramus> TabAtkins: if not use the fallback from the ar property<br>
&lt;bramus> TabAtkins: this would fix the problem so taht img and videos ar enot considered to have an r until they load their resource<br>
&lt;bramus> TabAtkins: it is flipped when they obtain the ar<br>
&lt;bramus> TabAtkins: other reason for a f2f bc the relevant algos are in images-3<br>
&lt;bramus> s/an r/an ar/<br>
&lt;bramus> fantasai:<br>
&lt;bramus> fantasai: why do we ignore wdth and height in favor of the 300 by 150?<br>
&lt;bramus> fantasai: if we have better info shoulndt we us that instead?<br>
&lt;bramus> TabAtkins: correct<br>
&lt;bramus> emilio: to clarify, thi sonly changes behavior before the video loads<br>
&lt;bramus> TabAtkins: correct<br>
&lt;iank_> there is also some special behaviour for video image placeholders i think.<br>
&lt;bramus> emilio: i htink images are a bit special ?? when there is mapped ar<br>
&lt;emilio> https://searchfox.org/mozilla-central/rev/417eb46de41c31c3223d7b84c275ba56fc7d4343/layout/generic/nsImageFrame.cpp#659-661<br>
&lt;bramus> emilio: so why dont we do the same for video?<br>
&lt;bramus> emilio: here is the gecko code for image intrinsic sizing<br>
&lt;bramus> emilio: fallback has a lot of stuff<br>
&lt;bramus> emilio: but basically intrinsic size is 0 if broken<br>
&lt;bramus> emilio: ???<br>
&lt;bramus> emilio: why cant we do same for video<br>
&lt;iank_> q+<br>
&lt;Rossen_> ack emilio<br>
&lt;bramus> emilio: that function does a lot of stuff … once you get to th ebottom the intrinsic size of a broken img is 0x0<br>
&lt;bramus> emilio: instead of that, have it check if you have an ar then return no intrinsic size and use the ar instead<br>
&lt;bramus> emilio: i dont see how that is gonna work for video<br>
&lt;fantasai> s/is/isn't/<br>
&lt;bramus> emilio: i think we need just the same check also for video<br>
&lt;bramus> iank_: i wnat to point out that videos are more complicated<br>
&lt;bramus> iank_: they define a ??? and we get the ar from there<br>
&lt;bramus> emilio: we also do that<br>
&lt;Rossen_> s/???/poster image/<br>
&lt;bramus> emilio: check the actual video, check the poster,  and then the fallback<br>
&lt;Rossen_> ack iank_<br>
&lt;bramus> TabAtkins: in the html spec, images do not have  a fallback size<br>
&lt;bramus> emilio: yes, 0x0<br>
&lt;bramus> TabAtkins: so we do not want that for video<br>
&lt;bramus> fantasai: ??? if you have an ar use that and not the default object size<br>
&lt;bramus> TabAtkins: where would this change be? html?<br>
&lt;bramus> emilio: possibly<br>
&lt;bramus> emilio: if the fallback is defined in html<br>
&lt;bramus> fantasai: it is fine to say the fallback size is what it is<br>
&lt;bramus> fantasai: we should make it clear if the ar is set, you do not need that fallback size<br>
&lt;bramus> TabAtkins: yes, you are saying what i suggested<br>
&lt;florian> q+<br>
&lt;bramus> Rossen: everyone is agreein, which is great<br>
&lt;bramus> Rossen_: other opinions?<br>
&lt;bramus> florian: given that videos have controls, how realistic is that w ecan nkow the ar wihtout the size?<br>
&lt;bramus> TabAtkins: controls are overlaid<br>
&lt;bramus> Rossen_: tab, can you verify?<br>
&lt;bramus> TabAtkins: if a video or any replaced element has not yet loaded, then we do not consider it to have an ar to come from its fallback size<br>
&lt;iank_> q+<br>
&lt;emilio> q+<br>
&lt;florian> q-<br>
&lt;bramus> fantasai: the default object size should not ???<br>
&lt;TabAtkins> s/???/provide an aspect ratio/<br>
&lt;bramus> Rossen_: no, this is not the case.<br>
&lt;fantasai> s/not ???/never provide an aspect ratio, it's just a width+height/<br>
&lt;bramus> Rossen_: if we have a defined ar, we do not have a prob?<br>
&lt;bramus> Rossen_: we need to figure out in case of auto to fallback to 350<br>
&lt;bramus> TabAtkins: you should not be doing that, that is the point<br>
&lt;Rossen_> q?<br>
&lt;bramus> TabAtkins: if your default sizes are used, do not consider that to provide an aspect-ratio but us the auto<br>
&lt;bramus> Rossen_: auto by default?<br>
&lt;bramus> fantasai: 16/9 set … use that inti loaded<br>
&lt;bramus> fantasai: what tab is trying to say that auto is not giving the aspect ratio, until the resource is loaded<br>
&lt;bramus> TabAtkins: it is what we intended for images, but a clear error we need to fix (in images-3)<br>
&lt;bramus> fantasai: images-3 does not define that<br>
&lt;bramus> TabAtkins: it does ?? with size<br>
&lt;bramus> TabAtkins: the default object size is defined in 2.1<br>
&lt;fantasai> fantasai: sizing rules for replaced elements is not in css-images-3<br>
&lt;fantasai> fantasai: css-images-3 defines sizing algorithms, but not for replaced elements<br>
&lt;Rossen_> q?<br>
&lt;fantasai> fantasai: it covers things like list-style-image and background-image<br>
&lt;Rossen_> ack iank_<br>
&lt;bramus> iank_: we may only want to do this for video and ?? elements because ther eis some funky stuff with object elements<br>
&lt;bramus> Rossen_: object and embed have similar proble which you do not want to change<br>
&lt;bramus> fantasai: we are not gonna run into probs here<br>
&lt;bramus> iank_: any other elems?<br>
&lt;bramus> TabAtkins: not sure<br>
&lt;bramus> iank_: canvas?<br>
&lt;bramus> TabAtkins: maybe<br>
&lt;bramus> emilio: input type image, video, image, canvas<br>
&lt;bramus> florian: svg?<br>
&lt;bramus> emilio: no<br>
&lt;bramus> iank_: it might take us a while to do bc the way our intrinsic logic handles it historically<br>
&lt;bramus> Rossen_: ok, ty<br>
&lt;bramus> Rossen_: but shouldt prevent us from resolving<br>
&lt;Rossen_> ack emilio<br>
&lt;bramus> emilio: i dont know if saying getting the ar from the fallback size or not, or if you hav ean ar make sure you do not have a falback intrinsic size to being with<br>
&lt;bramus> iank_: you mean the natural size?<br>
&lt;bramus> emilio: yeah<br>
&lt;bramus> emilio: i need to check how it works<br>
&lt;bramus> emilio: but we are in agreement<br>
&lt;bramus> emilio: i think you may not want an intrinsic size to begin with<br>
&lt;bramus> iank_: (thinks)<br>
&lt;TabAtkins> q+ to finish this up without requiring us to nail down all details right there<br>
&lt;bramus> iank_: thi swill lose the natural fallback sizing as well?<br>
&lt;bramus> emilio: i htink it should<br>
&lt;bramus> emilio: i need to check where tha tmakes a diff<br>
&lt;bramus> iank_: that will make the diff when you do sth like width fit-content<br>
&lt;bramus> iank_: in certain circusstances<br>
&lt;bramus> emilio: maybe yes<br>
&lt;bramus> TabAtkins: can i interrupt<br>
&lt;bramus> TabAtkins: suggestion is to resolve to fix it, without detailing it<br>
&lt;bramus> fantasai: mayb e more precise<br>
&lt;bramus> fantasai: that the auto part does not provide an aspect ratio<br>
&lt;bramus> fantasai: that you do no get it from the fallback size<br>
&lt;bramus> TabAtkins: sure<br>
&lt;bramus> fantasai: the spec was never intended to pull the ar from the fallback size<br>
&lt;bramus> fantasai: we should clarify that it doesnt<br>
&lt;bramus> fantasai: it always fall back to the provide aspect ratio<br>
&lt;bramus> emilio: for iframes?<br>
&lt;bramus> fantasai: no<br>
&lt;bramus> fantasai: they dont get one automagically<br>
&lt;bramus> fantasai: same with svg, until you load it<br>
&lt;bramus> Rossen_: back to resolution<br>
&lt;bramus> fantasai: 2 resolutions<br>
&lt;fantasai> Proposed: aspect-ratio:auto doesn't pull aspect ratio from the default object size, it can only pull from an actual loaded resource<br>
&lt;fantasai> Proposed: Clarify that aspect-ratio:auto doesn't pull aspect ratio from the default object size, it can only pull from an actual loaded resource<br>
&lt;bramus> fantasai: when providing the ar through the property then yo u no longer have a naturla size tha tis a default size<br>
&lt;bramus> Rossen_: so ar overrides default<br>
&lt;bramus> fantasai: yeah<br>
&lt;bramus> TabAtkins: would like to address in separate issue if needed<br>
&lt;bramus> Rossen_: first one is easy to resolve one<br>
&lt;bramus> s/one/on/<br>
&lt;bramus> emilio: poster image?<br>
&lt;bramus> fantasai: that is a loaded resource<br>
&lt;bramus> emilio: but not a video<br>
&lt;bramus> florian: proposed resol says a resource<br>
&lt;bramus> fantasai: if video is 16 by 9 and poster 1x1, then loaded poster will give 1 by 1 aspect ratio<br>
&lt;bramus> emilio: ok<br>
&lt;bramus> we agree on behavior<br>
&lt;bramus> emilio: we agree on behavior<br>
&lt;bramus> Rossen_: anyone objecting?<br>
&lt;fantasai> RESOLVED: Clarify that aspect-ratio:auto doesn't pull aspect ratio from the default object size, it can only pull from an actual loaded resource<br>
&lt;bramus> Rossen_: no, ok<br>
&lt;bramus> fantasai: second one when providing ar via aspect-ratio property then dont fallback to default object size<br>
&lt;bramus> iank_: unsure about that<br>
&lt;bramus> fantasai: if you want to hang on to the ar, you have to at least hang on to one of the sizes<br>
&lt;fantasai> s/hang on to one/let go of one/<br>
&lt;bramus> iank_: (missed)<br>
&lt;bramus> iank_: i think the behavior today you will still size at width 300 and take into account the new  ar, so you wont end up with 150 height<br>
&lt;bramus> iank_: and i think that  might be fine<br>
&lt;bramus> emilio: not sure<br>
&lt;bramus> emilio: images may want to overrride that<br>
&lt;bramus> emilio: bc their intrinsic size is 0x0<br>
&lt;bramus> emilio: but video maybe we do  not need to change intrinsic size<br>
&lt;bramus> emilio: consistency would b egood though<br>
&lt;bramus> Rossen_: so?<br>
&lt;bramus> Rossen_: we have resolution for original post<br>
&lt;bramus> Rossen_: suggest to open new issue for the 2nd thing<br>
&lt;bramus> Rossen_: we can record info there and give iank_ and emilio time to discuss<br>
&lt;bramus> Rossen_: we can come back to this later<br>
&lt;bramus> Rossen_: everyone ok with that?<br>
&lt;bramus> fantasai: ok<br>
</details>


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


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

Received on Wednesday, 3 August 2022 20:43:26 UTC