Skip to content

Commit 9610e55

Browse files
committed
Bug 1931955 [wpt PR 49234] - Fix min/max-content block size of replaced element, a=testonly
Automatic update from web-platform-tests Fix min/max-content block size of replaced element The min-content and max-content sizes on the block axis depend on the inline size. But when computing the SizeConstraint corresponding to the inline axis, we were resolving the preferred inline size ignoring intrinsic keywords. Now we will only ignore `auto`. Also, this patch refactors the logic to compute the min-content and max-content block sizes after fully resolving the inline size. This avoids having to resolve the inline sizing properties twice. Signed-off-by: Oriol Brufau <obrufauigalia.com> -- wpt-commits: f1eaa58ed9d3e0a9d875387422878f3640c79f97 wpt-pr: 49234 UltraBlame original commit: 7726ba113e468e8e245d5eaff2fb6582baeca873
1 parent 1f8c338 commit 9610e55

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
<!DOCTYPE html>
2+
<meta charset="utf-8">
3+
<title>CSS aspect-ratio: replaced element transferring intrinsic sizes</title>
4+
<link rel="help" href="https://drafts.csswg.org/css-sizing-4/#aspect-ratio">
5+
<link rel="help" href="https://drafts.csswg.org/css-sizing-4/#aspect-ratio-size-transfers">
6+
<link rel="help" href="https://github.com/w3c/csswg-drafts/issues/11236">
7+
<link rel="author" title="Oriol Brufau" href="mailto:[email protected]">
8+
<meta name="assert" content="
9+
The inline size resulting from an intrinsic keyword is transferred
10+
to the block axis through aspect ratio.
11+
Except if the inline size is `auto`, then we ignore the ratio and
12+
just use the natural block size instead.
13+
">
14+
15+
<style>
16+
canvas { aspect-ratio: 1; height: auto; background: cyan; }
17+
</style>
18+
19+
<canvas width="50" height="25" style="width: auto"
20+
data-expected-width="50" data-expected-height="25"></canvas>
21+
<canvas width="50" height="25" style="width: min-content"
22+
data-expected-width="50" data-expected-height="50"></canvas>
23+
<canvas width="50" height="25" style="width: fit-content"
24+
data-expected-width="50" data-expected-height="50"></canvas>
25+
<canvas width="50" height="25" style="width: max-content"
26+
data-expected-width="50" data-expected-height="50"></canvas>
27+
28+
<script src="/resources/testharness.js"></script>
29+
<script src="/resources/testharnessreport.js"></script>
30+
<script src="/resources/check-layout-th.js"></script>
31+
<script>
32+
checkLayout("canvas");
33+
</script>

0 commit comments

Comments
 (0)