Skip to content

Commit

Permalink
[css-grid-1][css-grid-2] Fix auto minimum size to better handle perce…
Browse files Browse the repository at this point in the history
…ntage specified and maximum sizes. #6278
  • Loading branch information
fantasai committed Mar 3, 2022
1 parent ecd3d9b commit bb58d19
Show file tree
Hide file tree
Showing 2 changed files with 98 additions and 0 deletions.
49 changes: 49 additions & 0 deletions css-grid-1/Overview.bs
Original file line number Diff line number Diff line change
Expand Up @@ -1332,6 +1332,11 @@ Automatic Minimum Size of Grid Items</h3>

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

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

If the item’s has a [=preferred size=] or [=maximum size=]
in the relevant axis,
the [=transferred size suggestion=] is capped by those sizes,
resolving any indefinite percentages in these sizes
against zero for this purpose.

<dt><dfn>content size suggestion</dfn>
<dd>
The <a>content size suggestion</a> is
Expand Down Expand Up @@ -4761,6 +4772,44 @@ Changes since the <a href="https://www.w3.org/TR/2020/CRD-css-grid-1-20201218/">
via 'aspect-ratio'. [[CSS-SIZING-4]]
(<a href="https://github.com/w3c/csswg-drafts/issues/6069">Issue 6069</a>)

<li id="change-2020-auto-min-compressible">
Defined that percentages on the [=preferred size=] and the [=maximum size=]
of compressible replaced elements
are resolved against zero and used to clamp the [=content-based minimum size=],
so that their [=automatic minimum size=]
is not larger than their [=min-content contribution=].
(<a href="https://github.com/w3c/csswg-drafts/issues/6278">Issue #6278</a>)
<blockquote>
<p>In all cases, the size suggestion is additionally clamped by the [=maximum size=] in the affected axis,
if it's definite.
<ins>If the item is a [[css-sizing-3#min-content-zero|compressible replaced element]],
the size suggestion is clamped by both the [=maximum size=] and the [=preferred size=],
whichever are definite,
with their indefinite percentages resolved for this purpose against zero
(and therefore considered definite).</ins></p>
</blockquote>

<li id="change-2020-auto-min-transferred-clamp">
Defined that percentages on the [=preferred size=] and the [=maximum size=]
always clamp the [=transferred size suggestion=]
so that it is strictly weaker than any size constraints
applied natively to that axis.
(<a href="https://github.com/w3c/csswg-drafts/issues/6278">Issue #6278</a>)
<blockquote>
<p>If the item has a [=preferred aspect ratio=]
and its [=preferred size=] in the opposite axis is <a>definite</a>,
then the <a>transferred size suggestion</a> is that size
(clamped by the opposite-axis [=minimum size|minimum=] and [=maximum sizes=] if they are <a>definite</a>),
converted through the aspect ratio.
It is otherwise undefined.</p>

<p><ins>If the item’s has a [=preferred size=] or [=maximum size=]
in the relevant axis,
the [=transferred size suggestion=] is capped by those sizes,
resolving any indefinite percentages in these sizes
against zero for this purpose.</ins></p>
</blockquote>

<li id="change-2020-auto-margins">
Made [[#auto-margins]] normative and tightened up wording,
since some aspects of this behavior were not otherwise defined elsewhere.
Expand Down
49 changes: 49 additions & 0 deletions css-grid-2/Overview.bs
Original file line number Diff line number Diff line change
Expand Up @@ -1378,6 +1378,11 @@ Automatic Minimum Size of Grid Items</h3>

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

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

If the item’s has a [=preferred size=] or [=maximum size=]
in the relevant axis,
the [=transferred size suggestion=] is capped by those sizes,
resolving any indefinite percentages in these sizes
against zero for this purpose.

<dt><dfn>content size suggestion</dfn>
<dd>
The <a>content size suggestion</a> is
Expand Down Expand Up @@ -5406,6 +5417,44 @@ Changes since the <a href="https://www.w3.org/TR/2020/CRD-css-grid-2-20201218/">
via 'aspect-ratio'. [[CSS-SIZING-4]]
(<a href="https://github.com/w3c/csswg-drafts/issues/6069">Issue 6069</a>)

<li id="change-2020-auto-min-compressible">
Defined that percentages on the [=preferred size=] and the [=maximum size=]
of compressible replaced elements
are resolved against zero and used to clamp the [=content-based minimum size=],
so that their [=automatic minimum size=]
is not larger than their [=min-content contribution=].
(<a href="https://github.com/w3c/csswg-drafts/issues/6278">Issue #6278</a>)
<blockquote>
<p>In all cases, the size suggestion is additionally clamped by the [=maximum size=] in the affected axis,
if it's definite.
<ins>If the item is a [[css-sizing-3#min-content-zero|compressible replaced element]],
the size suggestion is clamped by both the [=maximum size=] and the [=preferred size=],
whichever are definite,
with their indefinite percentages resolved for this purpose against zero
(and therefore considered definite).</ins></p>
</blockquote>

<li id="change-2020-auto-min-transferred-clamp">
Defined that percentages on the [=preferred size=] and the [=maximum size=]
always clamp the [=transferred size suggestion=]
so that it is strictly weaker than any size constraints
applied natively to that axis.
(<a href="https://github.com/w3c/csswg-drafts/issues/6278">Issue #6278</a>)
<blockquote>
<p>If the item has a [=preferred aspect ratio=]
and its [=preferred size=] in the opposite axis is <a>definite</a>,
then the <a>transferred size suggestion</a> is that size
(clamped by the opposite-axis [=minimum size|minimum=] and [=maximum sizes=] if they are <a>definite</a>),
converted through the aspect ratio.
It is otherwise undefined.</p>

<p><ins>If the item’s has a [=preferred size=] or [=maximum size=]
in the relevant axis,
the [=transferred size suggestion=] is capped by those sizes,
resolving any indefinite percentages in these sizes
against zero for this purpose.</ins></p>
</blockquote>

<li id="change-2020-auto-margins">
Made [[#auto-margins]] normative and tightened up wording,
since some aspects of this behavior were not otherwise defined elsewhere.
Expand Down

0 comments on commit bb58d19

Please sign in to comment.