-
Notifications
You must be signed in to change notification settings - Fork 2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Bug 1700640 - Map width and height to aspect-ratio in <canvas>, <inpu…
…t 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 whatwg/html#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
- Loading branch information
Showing
14 changed files
with
136 additions
and
108 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 1 addition & 10 deletions
11
...replaced-elements/attributes-for-embedded-content-and-images/canvas-aspect-ratio.html.ini
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,2 @@ | ||
[canvas-aspect-ratio.html] | ||
[Canvas width and height attributes are used as the surface size with contain:size] | ||
expected: FAIL | ||
|
||
[Computed style] | ||
expected: FAIL | ||
|
||
[Computed style for invalid ratios] | ||
bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1693029 | ||
expected: | ||
if release_or_beta: FAIL | ||
prefs: [layout.css.aspect-ratio.enabled:true] |
9 changes: 1 addition & 8 deletions
9
...ng/replaced-elements/attributes-for-embedded-content-and-images/img-aspect-ratio.html.ini
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,2 @@ | ||
[img-aspect-ratio.html] | ||
prefs: [layout.css.width-and-height-map-to-aspect-ratio.enabled:true] | ||
[Computed style] | ||
expected: FAIL | ||
|
||
[Computed style for invalid ratios] | ||
bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1693029 | ||
expected: | ||
if release_or_beta: FAIL | ||
prefs: [layout.css.aspect-ratio.enabled:true] |
11 changes: 1 addition & 10 deletions
11
.../replaced-elements/attributes-for-embedded-content-and-images/video-aspect-ratio.html.ini
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,2 @@ | ||
[video-aspect-ratio.html] | ||
[Video width and height attributes are not used to infer aspect-ratio] | ||
expected: FAIL | ||
|
||
[Computed style] | ||
expected: FAIL | ||
|
||
[Computed style for invalid ratios] | ||
bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1693029 | ||
expected: | ||
if release_or_beta: FAIL | ||
prefs: [layout.css.aspect-ratio.enabled:true] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 16 additions & 8 deletions
24
...ng/replaced-elements/attributes-for-embedded-content-and-images/resources/aspect-ratio.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,18 @@ | ||
function test_computed_style_aspect_ratio(tag, attributes, expected) { | ||
var elem = document.createElement(tag); | ||
for (name in attributes) { | ||
let val = attributes[name]; | ||
if (val !== null) | ||
elem.setAttribute(name, val); | ||
} | ||
document.body.appendChild(elem); | ||
assert_equals(getComputedStyle(elem).aspectRatio, expected); | ||
test(function() { | ||
var elem = document.createElement(tag); | ||
for (name in attributes) { | ||
let val = attributes[name]; | ||
if (val !== null) | ||
elem.setAttribute(name, val); | ||
} | ||
document.body.appendChild(elem); | ||
let aspectRatio = getComputedStyle(elem).aspectRatio; | ||
if (Array.isArray(expected)) { | ||
assert_in_array(aspectRatio, expected); | ||
} else { | ||
assert_equals(aspectRatio, expected); | ||
} | ||
elem.remove(); | ||
}, `${tag} with ${JSON.stringify(attributes)}`); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters