Bug 1700640 - Map width and height to aspect-ratio in <canvas>, <input type=image>, and <video>. r=boris

As per https://html.spec.whatwg.org/#attributes-for-embedded-content-and-images:

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

See https://github.com/whatwg/html/issues/6527 for the parsing issue
with canvas and zero. For now allow both behaviors in the tests.

We also remove the width-and-height-map-to-aspect-ratio pref, as it is
true everywhere and has been for a while.

Differential Revision: https://phabricator.services.mozilla.com/D109618
This commit is contained in:
Emilio Cobos Álvarez
2021-03-24 22:18:55 +00:00
parent e4040a448c
commit 6ddc96e2db
14 changed files with 136 additions and 108 deletions

View File

@@ -5133,8 +5133,8 @@ void HTMLInputElement::ImageInputMapAttributesIntoRule(
aDecls);
nsGenericHTMLFormElementWithState::MapImageMarginAttributeInto(aAttributes,
aDecls);
nsGenericHTMLFormElementWithState::MapImageSizeAttributesInto(aAttributes,
aDecls);
nsGenericHTMLFormElementWithState::MapImageSizeAttributesInto(
aAttributes, aDecls, MapAspectRatio::Yes);
// Images treat align as "float"
nsGenericHTMLFormElementWithState::MapImageAlignAttributeInto(aAttributes,
aDecls);