Skip to content

Commit c7f01d8

Browse files
committed
[css-grid] Attempt to fix the handling of fit-content() to make more sense per issue #209. (This needs review.)
1 parent 22b395c commit c7f01d8

File tree

1 file changed

+17
-11
lines changed

1 file changed

+17
-11
lines changed

css-grid/Overview.bs

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3508,7 +3508,7 @@ Grid Sizing</h2>
35083508

35093509
<ul>
35103510
<li>A <dfn>fixed sizing function</dfn> (<<length>> or resolveable <<percentage>>).
3511-
<li>An <dfn>intrinsic sizing function</dfn> (''min-content'', ''max-content'', or ''auto'').
3511+
<li>An <dfn>intrinsic sizing function</dfn> (''min-content'', ''max-content'', ''auto'', ''fit-content()'').
35123512
<li>A <dfn>flexible sizing function</dfn> (<<flex>>).
35133513
</ul>
35143514

@@ -3607,9 +3607,9 @@ Track Sizing Terminology</h3>
36073607
<dd>
36083608
If the track was sized with a ''minmax()'' function,
36093609
this is the second argument to that function.
3610-
If the track was sized with a ''fit-content()'' function,
3611-
''max-content''.
36123610
Otherwise, the track's sizing function.
3611+
In all cases, treat ''auto'' and ''fit-content()'' as ''max-content'',
3612+
except where specified otherwise for ''fit-content()''.
36133613

36143614
<dt><dfn>available grid space</dfn>
36153615
<dd>
@@ -3766,11 +3766,13 @@ Resolve Intrinsic Track Sizes</h3>
37663766
set its <a>growth limit</a>
37673767
to the maximum of the items’ <a>min-content contributions</a>.
37683768

3769-
<dt>For max-content and auto maximums:
3769+
<dt>For max-content maximums:
37703770
<dd>
3771-
If the track has a ''max-content'' or ''auto'' <a>max track sizing function</a>,
3771+
If the track has a ''max-content'' <a>max track sizing function</a>,
37723772
set its <a>growth limit</a>
37733773
to the maximum of the items’ <a>max-content contributions</a>.
3774+
For ''fit-content()'' maximums,
3775+
furthermore clamp this <a>growth limit</a> by the ''fit-content()'' argument.
37743776
</dl>
37753777

37763778
In all cases, if a track’s <a>growth limit</a> is now less than its <a>base size</a>,
@@ -3786,7 +3788,7 @@ Resolve Intrinsic Track Sizes</h3>
37863788
<li>
37873789
<strong>For intrinsic minimums:</strong>
37883790
First increase the <a>base size</a> of tracks with
3789-
a <a>min track sizing function</a> of ''min-content'', ''max-content'', or ''auto''
3791+
an <a lt="intrinsic sizing function">intrinsic</a> <a>min track sizing function</a>
37903792
by <a href="#extra-space">distributing extra space</a> as needed
37913793
to accommodate the contributions dictated by these items’ <a>min-size contributions</a>.
37923794
<li>
@@ -3811,7 +3813,7 @@ Resolve Intrinsic Track Sizes</h3>
38113813
<li>
38123814
<strong>For intrinsic maximums:</strong>
38133815
Next increase the <a>growth limit</a> of tracks with
3814-
a <a>max track sizing function</a> of ''min-content'' or ''max-content'' (including ''auto'')
3816+
an <a lt="intrinsic sizing function">intrinsic</a> <a>max track sizing function</a>
38153817
by <a href="#extra-space">distributing extra space</a> as needed
38163818
to account for these items' <a>min-size contributions</a>.
38173819
Mark any tracks whose <a>growth limit</a> changed
@@ -3860,9 +3862,11 @@ Resolve Intrinsic Track Sizes</h3>
38603862
<li>
38613863
<strong>For max-content maximums:</strong>
38623864
Lastly continue to increase the <a>growth limit</a> of tracks with
3863-
a <a>max track sizing function</a> of ''max-content'' (including ''auto'')
3865+
a <a>max track sizing function</a> of ''max-content''
38643866
by <a href="#extra-space">distributing extra space</a> as needed
38653867
to account for these items' <a>max-content contributions</a>.
3868+
However, limit the growth of any ''fit-content()'' tracks
3869+
by their ''fit-content()'' argument.
38663870
</ol>
38673871

38683872
Repeat incrementally for items with greater spans until all items have been considered.
@@ -3925,6 +3929,11 @@ Resolve Intrinsic Track Sizes</h3>
39253929
<li>when handling any intrinsic <a>growth limit</a>:
39263930
all affected tracks.
39273931
</ul>
3932+
3933+
For this purpose, ''fit-content()'' tracks are treated as ''max-content''
3934+
until they reach the limit specified as the ''fit-content()'' argument,
3935+
after which they are treated as having a <a>fixed sizing function</a> of that argument.
3936+
39283937
<li>
39293938
<strong>Update the tracks' affected sizes</strong>
39303939
by folding in the calculated increase
@@ -3945,9 +3954,6 @@ Maximize Tracks</h3>
39453954
If the <a>free space</a> is positive, distribute it equally to all tracks,
39463955
freezing tracks as they reach their <a>growth limits</a>
39473956
(and continuing to grow the unfrozen tracks as needed).
3948-
For tracks sized with ''fit-content()'',
3949-
first clamp the <a>growth limit</a>
3950-
by the track sizing function given as the ''fit-content()'' argument.
39513957

39523958
For the purpose of this step:
39533959
if sizing the <a>grid container</a> under a <a>max-content constraint</a>,

0 commit comments

Comments
 (0)