Skip to content
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

Video elements should have a default intrinsic ratio #3090

Open
nox opened this issue Oct 2, 2017 · 12 comments
Open

Video elements should have a default intrinsic ratio #3090

nox opened this issue Oct 2, 2017 · 12 comments

Comments

@nox
Copy link
Member

nox commented Oct 2, 2017

Rendering <video width=500 style="border: 1px solid red"> renders a 500x250 box in all user agents, this means that the following rule apply, from CSS:

Otherwise, if 'height' has a computed value of 'auto', and the element has an intrinsic ratio then the used value of 'height' is:

(used width) / (intrinsic ratio)

But the HTML spec doesn't specify the default intrinsic ratio of the video element.

@annevk
Copy link
Member

annevk commented Oct 2, 2017

So the intrinsic ratio would be 2? I wonder why video has one but other replaced elements do not.

@annevk
Copy link
Member

annevk commented Oct 2, 2017

Does object-fit: contain come into play here somehow? https://drafts.csswg.org/css-images/#intrinsic-dimensions suggests it probably does not. This is all rather confusing though.

@annevk
Copy link
Member

annevk commented Oct 2, 2017

cc @fantasai @tabatkins

@annevk
Copy link
Member

annevk commented Oct 2, 2017

cc @whatwg/media

@nox
Copy link
Member Author

nox commented Oct 2, 2017

https://drafts.csswg.org/css-images/#intrinsic-dimensions suggests it probably does not.

That link states:

If an object (such as an icon) has multiple sizes, then the largest size (by area) is taken as its intrinsic size. If it has multiple aspect ratios at that size, or has multiple aspect ratios and no size, then the aspect ratio closest to the aspect ratio of the default object size is used.

And the HTML spec says:

The default object size is a width of 300 CSS pixels and a height of 150 CSS pixels.

@annevk
Copy link
Member

annevk commented Oct 2, 2017

Okay, so maybe this is all defined, but it's just hard to follow?

@foolip
Copy link
Member

foolip commented Oct 3, 2017

I know that this isn't entirely interoperable, or at least it wasn't a few years ago. At different points in time, the right thing has been to either have a default intrinsic ratio (2) or not. @nox, can you write some tests to see what the majority behavior is? If the specs don't agree, we should change them to agree.

@nox
Copy link
Member Author

nox commented Oct 3, 2017

Sure, will do that today. Here are the tests I think we need:

  • Default dimensions are 300x150.
  • Default height for empty video with width=500 is 250.
  • Default width for empty video with height=250 is 500.
  • Default dimensions for empty video with poster frame are the poster frame's dimensions(?).

Should we also have more tests with only a specific width or height, checking that the other dimension respects the aspect ratio of the poster frame?

@foolip
Copy link
Member

foolip commented Oct 3, 2017

@nox, that sounds about right. I could swear that tests like this already exist, but I can't find them. @zcorpan, does it sound familiar?

@nox
Copy link
Member Author

nox commented Oct 4, 2017

I will port them to WPT.

@nox
Copy link
Member Author

nox commented Oct 5, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

4 participants