Skip to content

Commit be54c07

Browse files
committed
Factor out the final 'clamp by the maximum size' step that was in every individual size suggestion algo. #4901
1 parent 3ff1900 commit be54c07

File tree

3 files changed

+18
-18
lines changed

3 files changed

+18
-18
lines changed

css-flexbox-1/Overview.bs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -978,6 +978,7 @@ Automatic Minimum Size of Flex Items</h3>
978978
is the smaller of its <a>content size suggestion</a> and its <a>transferred size suggestion</a>.
979979
If the box has neither a <a>specified size suggestion</a> nor an [=preferred aspect ratio|aspect ratio=],
980980
its <a>content-based minimum size</a> is the <a>content size suggestion</a>.
981+
In all cases, the size is clamped by the [=maximum size|maximum=] [=main size=] if it's <a>definite</a>.
981982

982983
The <a>content size suggestion</a>, <a>specified size suggestion</a>, and <a>transferred size suggestion</a>
983984
used in this calculation account for the relevant min/max/preferred size properties
@@ -988,8 +989,7 @@ Automatic Minimum Size of Flex Items</h3>
988989
<dt><dfn>specified size suggestion</dfn>
989990
<dd>
990991
If the item’s [=preferred size|preferred=] [=main size=] is <a>definite</a>,
991-
then the <a>specified size suggestion</a> is that size
992-
(clamped by its [=maximum size|maximum=] [=main size=] if it's <a>definite</a>).
992+
then the <a>specified size suggestion</a> is that size.
993993
It is otherwise undefined.
994994

995995
<dt><dfn>transferred size suggestion</dfn>
@@ -998,16 +998,14 @@ Automatic Minimum Size of Flex Items</h3>
998998
and its [=preferred size|preferred=] [=cross size=] is <a>definite</a>,
999999
then the <a>transferred size suggestion</a> is that size
10001000
(clamped by its [=minimum size|minimum=] and [=maximum size|maximum=] [=cross sizes=] if they are <a>definite</a>),
1001-
converted through the aspect ratio,
1002-
and finally clamped by the same-axis [=maximum size=] if that is [=definite=].
1001+
converted through the aspect ratio.
10031002
It is otherwise undefined.
10041003

10051004
<dt><dfn>content size suggestion</dfn>
10061005
<dd>
10071006
The <a>content size suggestion</a> is the <a>min-content size</a> in the <a>main axis</a>,
10081007
clamped, if it has a [=preferred aspect ratio=],
1009-
by any <a>definite</a> [=minimum size|minimum=] and [=maximum size|maximum=] [=cross sizes=] converted through the aspect ratio,
1010-
and finally clamped by the [=maximum size|maximum=] [=main size=] if that is <a>definite</a>.
1008+
by any <a>definite</a> [=minimum size|minimum=] and [=maximum size|maximum=] [=cross sizes=] converted through the aspect ratio.
10111009
</dl>
10121010

10131011
For the purpose of calculating an intrinsic size of the box

css-grid-1/Overview.bs

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1321,6 +1321,10 @@ Automatic Minimum Size of Grid Items</h3>
13211321
as represented by the sum of those <a>grid tracks</a><a>max track sizing functions</a>
13221322
plus any intervening <a lt="fixed sizing function">fixed</a> <a>gutters</a>.
13231323

1324+
In all cases, the size suggestion is additionally clamped by the [=maximum size=],
1325+
if it's definite,
1326+
in the given axis.
1327+
13241328
Note: The argument to ''fit-content()'' does <em>not</em> clamp
13251329
the [=content-based minimum size=] in the same way as a
13261330
<a lt="fixed sizing function">fixed</a> <a>max track sizing function</a>.
@@ -1334,8 +1338,7 @@ Automatic Minimum Size of Grid Items</h3>
13341338
<dt><dfn>specified size suggestion</dfn>
13351339
<dd>
13361340
If the item’s [=preferred size=] in the relevant axis is <a>definite</a>,
1337-
then the <a>specified size suggestion</a> is that size
1338-
(clamped by the relevant [=maximum size=] if it's <a>definite</a>).
1341+
then the <a>specified size suggestion</a> is that size.
13391342
It is otherwise undefined.
13401343

13411344
<dt><dfn>transferred size suggestion</dfn>
@@ -1344,8 +1347,7 @@ Automatic Minimum Size of Grid Items</h3>
13441347
and its [=preferred size=] in the opposite axis is <a>definite</a>,
13451348
then the <a>transferred size suggestion</a> is that size
13461349
(clamped by the opposite-axis [=minimum size|minimum=] and [=maximum sizes=] if they are <a>definite</a>),
1347-
converted through the aspect ratio,
1348-
and finally clamped by the same-axis [=maximum size=] if that is [=definite=].
1350+
converted through the aspect ratio.
13491351
It is otherwise undefined.
13501352

13511353
<dt><dfn>content size suggestion</dfn>
@@ -1354,8 +1356,7 @@ Automatic Minimum Size of Grid Items</h3>
13541356
the <a>min-content size</a> in the relevant axis,
13551357
clamped, if it has a [=preferred aspect ratio=],
13561358
by any <a>definite</a> opposite-axis [=minimum size|minimum=] and [=maximum sizes=]
1357-
converted through the aspect ratio,
1358-
and finally clamped by the same-axis [=maximum size=] if that is <a>definite</a>.
1359+
converted through the aspect ratio.
13591360
</dl>
13601361

13611362
For the purpose of calculating an intrinsic size of the box

css-grid-2/Overview.bs

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1368,6 +1368,10 @@ Automatic Minimum Size of Grid Items</h3>
13681368
as represented by the sum of those <a>grid tracks</a><a>max track sizing functions</a>
13691369
plus any intervening <a lt="fixed sizing function">fixed</a> <a>gutters</a>.
13701370

1371+
In all cases, the size suggestion is additionally clamped by the [=maximum size=],
1372+
if it's definite,
1373+
in the given axis.
1374+
13711375
Note: The argument to ''fit-content()'' does <em>not</em> clamp
13721376
the [=content-based minimum size=] in the same way as a
13731377
<a lt="fixed sizing function">fixed</a> <a>max track sizing function</a>.
@@ -1381,8 +1385,7 @@ Automatic Minimum Size of Grid Items</h3>
13811385
<dt><dfn>specified size suggestion</dfn>
13821386
<dd>
13831387
If the item’s [=preferred size=] in the relevant axis is <a>definite</a>,
1384-
then the <a>specified size suggestion</a> is that size
1385-
(clamped by the relevant [=maximum size=] if it's <a>definite</a>).
1388+
then the <a>specified size suggestion</a> is that size.
13861389
It is otherwise undefined.
13871390

13881391
<dt><dfn>transferred size suggestion</dfn>
@@ -1391,8 +1394,7 @@ Automatic Minimum Size of Grid Items</h3>
13911394
and its [=preferred size=] in the opposite axis is <a>definite</a>,
13921395
then the <a>transferred size suggestion</a> is that size
13931396
(clamped by the opposite-axis [=minimum size|minimum=] and [=maximum sizes=] if they are <a>definite</a>),
1394-
converted through the aspect ratio,
1395-
and finally clamped by the same-axis [=maximum size=] if that is [=definite=].
1397+
converted through the aspect ratio.
13961398
It is otherwise undefined.
13971399

13981400
<dt><dfn>content size suggestion</dfn>
@@ -1401,8 +1403,7 @@ Automatic Minimum Size of Grid Items</h3>
14011403
the <a>min-content size</a> in the relevant axis,
14021404
clamped, if it has a [=preferred aspect ratio=],
14031405
by any <a>definite</a> opposite-axis [=minimum size|minimum=] and [=maximum sizes=]
1404-
converted through the aspect ratio,
1405-
and finally clamped by the same-axis [=maximum size=] if that is <a>definite</a>.
1406+
converted through the aspect ratio.
14061407
</dl>
14071408

14081409
For the purpose of calculating an intrinsic size of the box

0 commit comments

Comments
 (0)