From 13bcfc1aa8a49b8ead6aed4b70771e765592cfec Mon Sep 17 00:00:00 2001 From: Anne van Kesteren Date: Thu, 25 Mar 2021 12:32:35 +0100 Subject: [PATCH] Support zero dimension values for aspect-ratio Also map to aspect-ratio consistently with how the attributes are parsed. Tests: https://github.com/web-platform-tests/wpt/pull/28229. Follow-up: #6528. Closes #4961 and closes #6527. --- source | 33 +++++++++++++++++++++++---------- 1 file changed, 23 insertions(+), 10 deletions(-) diff --git a/source b/source index c127ef318d6..4de171560c1 100644 --- a/source +++ b/source @@ -26103,9 +26103,9 @@ interface HTMLSourceElement : HTMLElement { environment">match the environment.

The source element supports dimension attributes. These attributes - can map to the aspect-ratio property as well as the rendered dimensions of - sibling img element, if source element's parent is a - picture element and source element's source set is + can map to the aspect-ratio property (using dimension rules) as well as the + rendered dimensions of sibling img element, if source element's parent + is a picture element and source element's source set is returned as a result of update the source set for that sibling img.

@@ -62620,7 +62620,7 @@ try { CanvasRenderingContext2D APIs, and the source image's dimensions must be the intrinsic width and intrinsic height of the media resource - (i.e. after any aspect-ratio correction has been applied).

+ (i.e., after any aspect-ratio correction has been applied).

When a CanvasImageSource object represents an HTMLCanvasElement, the element's bitmap must be used as the source image.

@@ -112822,7 +112822,15 @@ console.assert(container.firstChild instanceof SuperP);

When the text below says that a pair of attributes w and h on an element element map to the aspect-ratio property, it means that if element has both attributes w and h, and parsing those - attributes' values using the rules for parsing nonzero dimension values doesn't + attributes' values using the rules for parsing non-negative integers doesn't + generate an error for either, then the user agent is expected to use the parsed integers as a + presentational hint for the 'aspect-ratio' + property of the form auto w / h.

+ +

When the text below says that a pair of attributes w and h on an + element element map to the aspect-ratio property (using dimension rules), it + means that if element has both attributes w and h, and parsing + those attributes' values using the rules for parsing dimension values doesn't generate an error or return a percentage for either, then the user agent is expected to use the parsed dimensions as a presentational hint for the 'aspect-ratio' property of the form auto @@ -114485,10 +114493,11 @@ input[type=image i][align=bottom i], object[align=bottom i] { data-x="concept-img-dimension-attribute-source">dimension attribute source map to the dimension properties 'width' and 'height' on the img element respectively. They - similarly map to the aspect-ratio property of the img element.

+ similarly map to the aspect-ratio property (using dimension rules) of the + img element.

The width and height - attributes on embed, iframe, object or video + attributes on embed, iframe, object, and video elements, and input elements with a type attribute in the Image Button state and that either represents an image or that the user expects will eventually represent an image, 'width' and 'height' on the element respectively.

The width and height - attributes map to the aspect-ratio property on img, canvas, - and video elements, and input elements with a map to the aspect-ratio property (using dimension rules) on + img and video elements, and input elements with a type attribute in the Image - Button state. + Button state.

+ +

The width and height attributes map to the aspect-ratio property + on canvas elements.