Description
whatwg/html#6529 attempted to solve whatwg/html#4961 (auto aspect-ratio) for <img>
and <video>
. It works for <img>
, but it doesn't work for <video>
.
The problem is, <video width="16" height="9" …>
creates an internal style rule like aspect-ratio: auto 16 / 9
.
The auto
part means the provided ratio (16 / 9
) is ignored once the element has a natural aspect ratio.
Images start off without a natural aspect ratio, and they gain one once the resource is loaded enough to know its dimensions. The benefit is, if the provided width
and height
are wrong, that information is discarded in favour of the accurate values from the image resource.
However, <video>
has a defined default object size of 300x150, meaning the aspect ratio derived from the width and height attributes is instantly ignored in favour of 300 / 150
. So, although browsers are generating the aspect-ratio
rule for <video>
, it's useless.
We can't just remove the default object size from <video>
, otherwise it'd be 0x0 by default, which would break cases where the element didn't have a width and height set, and the browser doesn't attempt to fetch the video until some kind of interaction. Because the element would be 0x0, that interaction would be impossible.
So, it feels like the definition of auto
in aspect-ratio
needs to altered in some way so the provided ratio has higher priority than the default object size.
Metadata
Metadata
Assignees
Labels
Type
Projects
Status