forked from chromium/chromium
-
-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Map the aspect ratio from width/height to CSS
Instead of having special code in image layout, map the aspect ratio that's computed from the width and height attributes to the aspect-ratio property. As a side-effect, this patch will also make the aspect-ratio property work when contain: size is specified in an image (as well as error images when no alt text is specified). As specified in whatwg/html#6032. R=masonfreed@chromium.org, xiaochengh@chromium.org Bug: 1137004 Change-Id: I1253fa2ecf1e176711d3c4d7bd4159f466656ae8 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2495560 Reviewed-by: Yu Han <yuzhehan@chromium.org> Reviewed-by: Mason Freed <masonfreed@chromium.org> Commit-Queue: Christian Biesinger <cbiesinger@chromium.org> Auto-Submit: Christian Biesinger <cbiesinger@chromium.org> Cr-Commit-Position: refs/heads/master@{#823124}
- Loading branch information
1 parent
1ca5abd
commit 8a0368a
Showing
9 changed files
with
88 additions
and
27 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
10 changes: 10 additions & 0 deletions
10
third_party/blink/web_tests/external/wpt/css/css-contain/contain-size-replaced-007.html
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 |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<!DOCTYPE html> | ||
<meta charset="utf-8"> | ||
<title>CSS Containment Test: Size containment replaced elements intrinsic size</title> | ||
<link rel="help" href="https://drafts.csswg.org/css-contain-1/#containment-size"> | ||
<link rel="help" href="https://html.spec.whatwg.org/multipage/rendering.html#attributes-for-embedded-content-and-images"> | ||
<link rel="match" href="../reference/ref-filled-green-100px-square.xht"> | ||
<meta name=assert content="This test checks that an aspect ratio computed from width and height attributes is used even with contain: size."> | ||
|
||
<p>Test passes if there is a filled green square and <strong>no red</strong>.</p> | ||
<img src="support/60x60-green.png" width="60" height="60" style="width: 100px; height: auto; contain: size;"> |
20 changes: 20 additions & 0 deletions
20
..._party/blink/web_tests/external/wpt/css/css-sizing/aspect-ratio/replaced-element-028.html
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 |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<!DOCTYPE html> | ||
<title>CSS aspect-ratio: img</title> | ||
<link rel="author" title="Google LLC" href="https://www.google.com/"> | ||
<link rel="help" href="https://drafts.csswg.org/css-sizing-4/#aspect-ratio"> | ||
<script src="/resources/testharness.js"></script> | ||
<script src="/resources/testharnessreport.js"></script> | ||
|
||
<div id="log"></div> | ||
|
||
<img id="test" src="error.png" style="width: 100px; aspect-ratio: 1/5; background: yellow;" alt="Should not be 500px high"> | ||
|
||
<script> | ||
function run_test() { | ||
test(function() { | ||
var img = document.getElementById("test"); | ||
assert_not_equals(img.offsetHeight, 500); | ||
}); | ||
} | ||
onload = run_test; | ||
</script> |
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