Skip to content

Commit

Permalink
For <img src=""> (no current request), do not use mapped aspect ratio.
Browse files Browse the repository at this point in the history
This works in chrome because they don't event create an image box for this case,
which is totally against the spec.

The spec doesn't consider an image with a null image request, but our behavior
changes in some other places as well because of it...

Depends on D56367

Differential Revision: https://phabricator.services.mozilla.com/D56368

bugzilla-url: https://bugzilla.mozilla.org/show_bug.cgi?id=1602047
gecko-commit: bc309b2cd9e74e1116b82c908e0715741fda3e0e
gecko-integration-branch: autoland
gecko-reviewers: tnikkel
  • Loading branch information
emilio authored and moz-wptsync-bot committed Dec 11, 2019
1 parent 7a73cd0 commit 7976e77
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
</style>
<img src="/images/green.png">
<img src="/images/green.png" width=100 height=125>
<img src="" width=100 height=125>
<script>
let t = async_test("Image width and height attributes are used to infer aspect-ratio");
function assert_ratio(img, expected) {
Expand Down Expand Up @@ -46,7 +47,8 @@

onload = t.step_func_done(function() {
let images = document.querySelectorAll("img");
assert_ratio(images[2], 1.266); // 1.266 is the original aspect ratio of blue.png
assert_ratio(images[3], 1.266); // 1.266 is the original aspect ratio of blue.png
assert_equals(getComputedStyle(images[2]).height, "0px"); // aspect-ratio doesn't override intrinsic size of images that don't have any src.
assert_ratio(images[1], 2.0); // 2.0 is the original aspect ratio of green.png
assert_ratio(images[0], 2.0); // Loaded image's aspect ratio, at least by default, overrides width / height ratio.
});
Expand Down

0 comments on commit 7976e77

Please sign in to comment.