Skip to content

Commit bb58d19

Browse files
committed
[css-grid-1][css-grid-2] Fix auto minimum size to better handle percentage specified and maximum sizes. w3c#6278
1 parent ecd3d9b commit bb58d19

2 files changed

Lines changed: 98 additions & 0 deletions

File tree

css-grid-1/Overview.bs

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1332,6 +1332,11 @@ Automatic Minimum Size of Grid Items</h3>
13321332

13331333
In all cases, the size suggestion is additionally clamped by the [=maximum size=] in the affected axis,
13341334
if it's definite.
1335+
If the item is a [[css-sizing-3#min-content-zero|compressible replaced element]],
1336+
the size suggestion is clamped
1337+
by both the [=maximum size=] and the [=preferred size=], whichever are definite,
1338+
with their indefinite percentages resolved for this purpose against zero
1339+
(and therefore considered definite).
13351340

13361341
Note: The argument to ''fit-content()'' does <em>not</em> clamp
13371342
the [=content-based minimum size=] in the same way as a
@@ -1358,6 +1363,12 @@ Automatic Minimum Size of Grid Items</h3>
13581363
converted through the aspect ratio.
13591364
It is otherwise undefined.
13601365

1366+
If the item’s has a [=preferred size=] or [=maximum size=]
1367+
in the relevant axis,
1368+
the [=transferred size suggestion=] is capped by those sizes,
1369+
resolving any indefinite percentages in these sizes
1370+
against zero for this purpose.
1371+
13611372
<dt><dfn>content size suggestion</dfn>
13621373
<dd>
13631374
The <a>content size suggestion</a> is
@@ -4761,6 +4772,44 @@ Changes since the <a href="https://www.w3.org/TR/2020/CRD-css-grid-1-20201218/">
47614772
via 'aspect-ratio'. [[CSS-SIZING-4]]
47624773
(<a href="https://github.com/w3c/csswg-drafts/issues/6069">Issue 6069</a>)
47634774

4775+
<li id="change-2020-auto-min-compressible">
4776+
Defined that percentages on the [=preferred size=] and the [=maximum size=]
4777+
of compressible replaced elements
4778+
are resolved against zero and used to clamp the [=content-based minimum size=],
4779+
so that their [=automatic minimum size=]
4780+
is not larger than their [=min-content contribution=].
4781+
(<a href="https://github.com/w3c/csswg-drafts/issues/6278">Issue #6278</a>)
4782+
<blockquote>
4783+
<p>In all cases, the size suggestion is additionally clamped by the [=maximum size=] in the affected axis,
4784+
if it's definite.
4785+
<ins>If the item is a [[css-sizing-3#min-content-zero|compressible replaced element]],
4786+
the size suggestion is clamped by both the [=maximum size=] and the [=preferred size=],
4787+
whichever are definite,
4788+
with their indefinite percentages resolved for this purpose against zero
4789+
(and therefore considered definite).</ins></p>
4790+
</blockquote>
4791+
4792+
<li id="change-2020-auto-min-transferred-clamp">
4793+
Defined that percentages on the [=preferred size=] and the [=maximum size=]
4794+
always clamp the [=transferred size suggestion=]
4795+
so that it is strictly weaker than any size constraints
4796+
applied natively to that axis.
4797+
(<a href="https://github.com/w3c/csswg-drafts/issues/6278">Issue #6278</a>)
4798+
<blockquote>
4799+
<p>If the item has a [=preferred aspect ratio=]
4800+
and its [=preferred size=] in the opposite axis is <a>definite</a>,
4801+
then the <a>transferred size suggestion</a> is that size
4802+
(clamped by the opposite-axis [=minimum size|minimum=] and [=maximum sizes=] if they are <a>definite</a>),
4803+
converted through the aspect ratio.
4804+
It is otherwise undefined.</p>
4805+
4806+
<p><ins>If the item’s has a [=preferred size=] or [=maximum size=]
4807+
in the relevant axis,
4808+
the [=transferred size suggestion=] is capped by those sizes,
4809+
resolving any indefinite percentages in these sizes
4810+
against zero for this purpose.</ins></p>
4811+
</blockquote>
4812+
47644813
<li id="change-2020-auto-margins">
47654814
Made [[#auto-margins]] normative and tightened up wording,
47664815
since some aspects of this behavior were not otherwise defined elsewhere.

css-grid-2/Overview.bs

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1378,6 +1378,11 @@ Automatic Minimum Size of Grid Items</h3>
13781378

13791379
In all cases, the size suggestion is additionally clamped by the [=maximum size=] in the affected axis,
13801380
if it's definite.
1381+
If the item is a [[css-sizing-3#min-content-zero|compressible replaced element]],
1382+
the size suggestion is clamped
1383+
by both the [=maximum size=] and the [=preferred size=], whichever are definite,
1384+
with their indefinite percentages resolved for this purpose against zero
1385+
(and therefore considered definite).
13811386

13821387
Note: The argument to ''fit-content()'' does <em>not</em> clamp
13831388
the [=content-based minimum size=] in the same way as a
@@ -1404,6 +1409,12 @@ Automatic Minimum Size of Grid Items</h3>
14041409
converted through the aspect ratio.
14051410
It is otherwise undefined.
14061411

1412+
If the item’s has a [=preferred size=] or [=maximum size=]
1413+
in the relevant axis,
1414+
the [=transferred size suggestion=] is capped by those sizes,
1415+
resolving any indefinite percentages in these sizes
1416+
against zero for this purpose.
1417+
14071418
<dt><dfn>content size suggestion</dfn>
14081419
<dd>
14091420
The <a>content size suggestion</a> is
@@ -5406,6 +5417,44 @@ Changes since the <a href="https://www.w3.org/TR/2020/CRD-css-grid-2-20201218/">
54065417
via 'aspect-ratio'. [[CSS-SIZING-4]]
54075418
(<a href="https://github.com/w3c/csswg-drafts/issues/6069">Issue 6069</a>)
54085419

5420+
<li id="change-2020-auto-min-compressible">
5421+
Defined that percentages on the [=preferred size=] and the [=maximum size=]
5422+
of compressible replaced elements
5423+
are resolved against zero and used to clamp the [=content-based minimum size=],
5424+
so that their [=automatic minimum size=]
5425+
is not larger than their [=min-content contribution=].
5426+
(<a href="https://github.com/w3c/csswg-drafts/issues/6278">Issue #6278</a>)
5427+
<blockquote>
5428+
<p>In all cases, the size suggestion is additionally clamped by the [=maximum size=] in the affected axis,
5429+
if it's definite.
5430+
<ins>If the item is a [[css-sizing-3#min-content-zero|compressible replaced element]],
5431+
the size suggestion is clamped by both the [=maximum size=] and the [=preferred size=],
5432+
whichever are definite,
5433+
with their indefinite percentages resolved for this purpose against zero
5434+
(and therefore considered definite).</ins></p>
5435+
</blockquote>
5436+
5437+
<li id="change-2020-auto-min-transferred-clamp">
5438+
Defined that percentages on the [=preferred size=] and the [=maximum size=]
5439+
always clamp the [=transferred size suggestion=]
5440+
so that it is strictly weaker than any size constraints
5441+
applied natively to that axis.
5442+
(<a href="https://github.com/w3c/csswg-drafts/issues/6278">Issue #6278</a>)
5443+
<blockquote>
5444+
<p>If the item has a [=preferred aspect ratio=]
5445+
and its [=preferred size=] in the opposite axis is <a>definite</a>,
5446+
then the <a>transferred size suggestion</a> is that size
5447+
(clamped by the opposite-axis [=minimum size|minimum=] and [=maximum sizes=] if they are <a>definite</a>),
5448+
converted through the aspect ratio.
5449+
It is otherwise undefined.</p>
5450+
5451+
<p><ins>If the item’s has a [=preferred size=] or [=maximum size=]
5452+
in the relevant axis,
5453+
the [=transferred size suggestion=] is capped by those sizes,
5454+
resolving any indefinite percentages in these sizes
5455+
against zero for this purpose.</ins></p>
5456+
</blockquote>
5457+
54095458
<li id="change-2020-auto-margins">
54105459
Made [[#auto-margins]] normative and tightened up wording,
54115460
since some aspects of this behavior were not otherwise defined elsewhere.

0 commit comments

Comments
 (0)