-
Notifications
You must be signed in to change notification settings - Fork 670
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[css-sizing] Intrinsic size of <img> / <video> with aspect ratio but no definite size #10605
Comments
I don't understand the question from this level of explanation. Can you provide more context? |
So, consider a For Falling back to 0x0 is not so terrible as 300x150, so I think I'd be ok with such thing (even if a bit unfortunate / inconsistent). The main question is whether we go with the 0x0 (and I change Firefox and add a test), or with the no size behavior (and I close the bug as invalid and add a test). cc @jakearchibald too (since he filed #7524), and @Loirooriol since he was involved on some of those discussions. |
I think I could get behind a |
@bfgeek 0x0 probably doesn't quite work for |
So if I get it right, this is about <!DOCTYPE html>
<style>video, img { width: auto; height: auto; aspect-ratio: 1; border: solid; background: cyan }</style>
<div style="width: 200px">
<video width="100" height="100"></video>
<img width="100" height=100 src="https://software.hixie.ch/utilities/cgi/test-tools/delayed-file?pause=60">
</div> In Servo we currently match Blink: the video is 300x150, and the image is 0x0 (but unlike Blink, we pass the video test). The difference is because we let image elements with no resource fall back to a 0x0 natural size. The video gets no natural size, so it uses a default object size of 300x150. |
Consider this test-case from Mozilla bug 1905511.
In it, you can see how, while loading an image, Firefox treats it as having no intrinsic size (like the SVG). This is consistent with how we want to treat videos (for the use-case in #7524 to work, which works now in Firefox and WebKit).
However that's not what Blink does, and people get a bit confused (because the image might grow too much). It seems WebKit does something weird where it doesn't stretch images with no intrinsic size but a ratio (like the SVG in the test-case).
Blink seems to just give the image a 0x0 size while loading, which is slightly unfortunate, but maybe fine. I could live with that inconsistency between
<img>
and<video>
I guess. The issue with<video>
is really the default object size.Questions:
<img>
behaviors do we want? Both seem acceptable to me, but let's be interoperable? :)<img>
has0x0
intrinsic size (doesn't respect aspect-ratio if no dimension is definite, Blink's behavior)<img>
has no intrinsic size (might grow too much, Firefox's behavior).<video>
situation in [css-sizing-4] aspect-ratio via width and height attributes doesn't work for <video> #7524? (test here). Chromium filed it so I was hoping they'd get to it sooner rather than later.Want to run it through the group before going with Blink's behavior, in case people have strong opinions...
cc: @fantasai @jensimmons @bfgeek @chrishtr
The text was updated successfully, but these errors were encountered: