Skip to content

Commit cce83fc

Browse files
committed
[css-grid] Add repeat(auto, track-list). <http://lists.w3.org/Archives/Public/www-style/2014Oct/0108.html>
1 parent 690cd93 commit cce83fc

2 files changed

Lines changed: 35 additions & 13 deletions

File tree

css-grid/Overview.bs

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -830,7 +830,7 @@ Track Sizing: the 'grid-template-rows' and 'grid-template-columns' properties</h
830830
<dfn>&lt;track-size></dfn> = minmax( <<track-breadth>> , <<track-breadth>> ) | auto | <<track-breadth>>
831831
<dfn>&lt;track-breadth></dfn> = <<length>> | <<percentage>> | <<flex>> | min-content | max-content
832832
<dfn>&lt;line-names></dfn> = ( <<custom-ident>>* )
833-
<dfn>&lt;line-name-list></dfn> = [ <<line-names>> | repeat(<<positive-integer>>, <<line-names>>+) ]+
833+
<dfn>&lt;line-name-list></dfn> = [ <<line-names>> | repeat([ <<positive-integer>> | auto ], <<line-names>>+) ]+
834834
</pre>
835835

836836
Where:
@@ -967,20 +967,30 @@ Named Grid Lines: the ''(<<custom-ident>>*)'' syntax</h4>
967967
<h4 id='repeat-notation'>
968968
Repeating Rows and Columns: the ''repeat()'' notation</h4>
969969

970-
The ''repeat()'' notation represents a repeated fragment of the <a>track list</a>.
971-
This is just a syntactic shorthand that allows
972-
writing a large number of columns or rows that exhibit a recurring pattern
973-
in a more compact form.
970+
The ''repeat()'' notation represents a repeated fragment of the <a>track list</a>,
971+
allowing a large number of columns or rows that exhibit a recurring pattern
972+
to be written in a more compact form.
974973
The syntax of the ''repeat()'' notation is:
975974

976-
<pre class='prod'><dfn>repeat()</dfn> = repeat( <<positive-integer>> , [ <<line-names>>? <<track-size>> ]+ <<line-names>>? )</pre>
975+
<pre class='prod'>
976+
<dfn>repeat()</dfn> = repeat( <<positive-integer>>, [ <<line-names>>? <<track-size>> ]+ <<line-names>>? ) |
977+
repeat( auto, [ <<line-names>>? [ <<length>> | <<percentage>> ] ]+ <<line-names>>? )
978+
</pre>
977979

978980
The first argument specifies the number of repetitions.
979981
The second argument is a <a>track list</a>,
980982
which is repeated that number of times.
981983
The ''repeat()'' notation cannot be nested;
982984
doing so makes the declaration invalid.
983985

986+
If the number of repetitions is <dfn value for=repeat()>auto</dfn>
987+
and the <a>grid container</a> has a definite size in the relevant axis,
988+
then the number of repetitions is the largest possible integer
989+
that does not cause the <a>grid</a> to overflow its <a>grid container</a>
990+
(treating all tracks as their <a>max track sizing function</a> if that is <a>definite</a> or as zero otherwise).
991+
Otherwise, the <a>track list</a> repeats only once.
992+
A <<track-list>> with more than one ''repeat()/auto'' ''repeat()'' function is invalid.
993+
984994
<div class='example'>
985995
This example shows two equivalent ways of writing the same grid definition.
986996
Both ways produce a grid with a single row and four "main" columns, each 250px wide,

css-grid/Overview.html

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2084,7 +2084,7 @@ <h3 class="heading settled" data-level="5.1" id="track-sizing"><span class="secn
20842084
<dfn data-dfn-type="type" data-export="" id="typedef-track-size">&lt;track-size><a class="self-link" href="#typedef-track-size"></a></dfn> = minmax( <a class="production" data-link-type="type" href="#typedef-track-breadth">&lt;track-breadth></a> , <a class="production" data-link-type="type" href="#typedef-track-breadth">&lt;track-breadth></a> ) | auto | <a class="production" data-link-type="type" href="#typedef-track-breadth">&lt;track-breadth></a>
20852085
<dfn data-dfn-type="type" data-export="" id="typedef-track-breadth">&lt;track-breadth><a class="self-link" href="#typedef-track-breadth"></a></dfn> = <a class="production" data-link-type="type" href="http://dev.w3.org/csswg/css-values-3/#length-value">&lt;length></a> | <a class="production" data-link-type="type" href="http://dev.w3.org/csswg/css-values-3/#percentage-value">&lt;percentage></a> | <a class="production" data-link-type="type" href="#typedef-flex">&lt;flex></a> | min-content | max-content
20862086
<dfn data-dfn-type="type" data-export="" id="typedef-line-names">&lt;line-names><a class="self-link" href="#typedef-line-names"></a></dfn> = ( <a class="production" data-link-type="type" href="http://dev.w3.org/csswg/css-values-3/#identifier-value">&lt;custom-ident></a>* )
2087-
<dfn data-dfn-type="type" data-export="" id="typedef-line-name-list">&lt;line-name-list><a class="self-link" href="#typedef-line-name-list"></a></dfn> = [ <a class="production" data-link-type="type" href="#typedef-line-names">&lt;line-names></a> | repeat(<a class="production" data-link-type="type">&lt;positive-integer></a>, <a class="production" data-link-type="type" href="#typedef-line-names">&lt;line-names></a>+) ]+
2087+
<dfn data-dfn-type="type" data-export="" id="typedef-line-name-list">&lt;line-name-list><a class="self-link" href="#typedef-line-name-list"></a></dfn> = [ <a class="production" data-link-type="type" href="#typedef-line-names">&lt;line-names></a> | repeat([ <a class="production" data-link-type="type">&lt;positive-integer></a> | auto ], <a class="production" data-link-type="type" href="#typedef-line-names">&lt;line-names></a>+) ]+
20882088
</pre>
20892089

20902090

@@ -2278,15 +2278,16 @@ <h4 class="heading settled" data-level="5.1.2" id="repeat-notation"><span class=
22782278

22792279

22802280

2281-
<p>The <a class="css" data-link-type="maybe" href="#funcdef-repeat">repeat()</a> notation represents a repeated fragment of the <a data-link-type="dfn" href="#track-list">track list</a>.
2282-
This is just a syntactic shorthand that allows
2283-
writing a large number of columns or rows that exhibit a recurring pattern
2284-
in a more compact form.
2281+
<p>The <a class="css" data-link-type="maybe" href="#funcdef-repeat">repeat()</a> notation represents a repeated fragment of the <a data-link-type="dfn" href="#track-list">track list</a>,
2282+
allowing a large number of columns or rows that exhibit a recurring pattern
2283+
to be written in a more compact form.
22852284
The syntax of the <a class="css" data-link-type="maybe" href="#funcdef-repeat">repeat()</a> notation is:</p>
22862285

22872286

2288-
2289-
<pre class="prod"><dfn data-dfn-type="function" data-export="" id="funcdef-repeat">repeat()<a class="self-link" href="#funcdef-repeat"></a></dfn> = repeat( <a class="production" data-link-type="type">&lt;positive-integer></a> <a data-link-for="" data-link-type="grammar" href="http://dev.w3.org/csswg/css-values-3/#comb-comma">,</a> [ <a class="production" data-link-type="type" href="#typedef-line-names">&lt;line-names></a><a data-link-for="" data-link-type="grammar" href="http://dev.w3.org/csswg/css-values-3/#mult-opt">?</a> <a class="production" data-link-type="type" href="#typedef-track-size">&lt;track-size></a> ]<a data-link-for="" data-link-type="grammar" href="http://dev.w3.org/csswg/css-values-3/#mult-one-plus">+</a> <a class="production" data-link-type="type" href="#typedef-line-names">&lt;line-names></a><a data-link-for="" data-link-type="grammar" href="http://dev.w3.org/csswg/css-values-3/#mult-opt">?</a> )</pre>
2287+
2288+
<pre class="prod"><dfn data-dfn-type="function" data-export="" id="funcdef-repeat">repeat()<a class="self-link" href="#funcdef-repeat"></a></dfn> = repeat( <a class="production" data-link-type="type">&lt;positive-integer></a><a data-link-for="" data-link-type="grammar" href="http://dev.w3.org/csswg/css-values-3/#comb-comma">,</a> [ <a class="production" data-link-type="type" href="#typedef-line-names">&lt;line-names></a><a data-link-for="" data-link-type="grammar" href="http://dev.w3.org/csswg/css-values-3/#mult-opt">?</a> <a class="production" data-link-type="type" href="#typedef-track-size">&lt;track-size></a> ]<a data-link-for="" data-link-type="grammar" href="http://dev.w3.org/csswg/css-values-3/#mult-one-plus">+</a> <a class="production" data-link-type="type" href="#typedef-line-names">&lt;line-names></a><a data-link-for="" data-link-type="grammar" href="http://dev.w3.org/csswg/css-values-3/#mult-opt">?</a> ) <a data-link-for="" data-link-type="grammar" href="http://dev.w3.org/csswg/css-values-3/#comb-one">|</a>
2289+
repeat( auto<a data-link-for="" data-link-type="grammar" href="http://dev.w3.org/csswg/css-values-3/#comb-comma">,</a> [ <a class="production" data-link-type="type" href="#typedef-line-names">&lt;line-names></a><a data-link-for="" data-link-type="grammar" href="http://dev.w3.org/csswg/css-values-3/#mult-opt">?</a> [ <a class="production" data-link-type="type" href="http://dev.w3.org/csswg/css-values-3/#length-value">&lt;length></a> <a data-link-for="" data-link-type="grammar" href="http://dev.w3.org/csswg/css-values-3/#comb-one">|</a> <a class="production" data-link-type="type" href="http://dev.w3.org/csswg/css-values-3/#percentage-value">&lt;percentage></a> ] ]<a data-link-for="" data-link-type="grammar" href="http://dev.w3.org/csswg/css-values-3/#mult-one-plus">+</a> <a class="production" data-link-type="type" href="#typedef-line-names">&lt;line-names></a><a data-link-for="" data-link-type="grammar" href="http://dev.w3.org/csswg/css-values-3/#mult-opt">?</a> )
2290+
</pre>
22902291

22912292

22922293

@@ -2297,6 +2298,16 @@ <h4 class="heading settled" data-level="5.1.2" id="repeat-notation"><span class=
22972298
doing so makes the declaration invalid.</p>
22982299

22992300

2301+
2302+
<p>If the number of repetitions is <dfn class="css" data-dfn-for="repeat()" data-dfn-type="value" data-export="" id="valdef-repeat-auto">auto<a class="self-link" href="#valdef-repeat-auto"></a></dfn>
2303+
and the <a data-link-type="dfn" href="#grid-container">grid container</a> has a definite size in the relevant axis,
2304+
then the number of repetitions is the largest possible integer
2305+
that does not cause the <a data-link-type="dfn" href="#grid">grid</a> to overflow its <a data-link-type="dfn" href="#grid-container">grid container</a>
2306+
(treating all tracks as their <a data-link-type="dfn" href="#max-track-sizing-function">max track sizing function</a> if that is <a data-link-type="dfn" href="http://dev.w3.org/csswg/css-sizing-3/#definite">definite</a> or as zero otherwise).
2307+
Otherwise, the <a data-link-type="dfn" href="#track-list">track list</a> repeats only once.
2308+
A <a class="production css" data-link-type="type" href="#typedef-track-list">&lt;track-list></a> with more than one <a class="css" data-link-for="repeat()" data-link-type="maybe" href="#valdef-repeat-auto">auto</a> <a class="css" data-link-type="maybe" href="#funcdef-repeat">repeat()</a> function is invalid.</p>
2309+
2310+
23002311

23012312
<div class="example">
23022313
This example shows two equivalent ways of writing the same grid definition.
@@ -6080,6 +6091,7 @@ <h2 class="no-num heading settled" id="index"><span class="content">Index</span>
60806091
<li>auto
60816092
<ul>
60826093
<li>value for grid-template-columns, grid-template-rows, <a href="#valdef-grid-template-columns-grid-template-rows-auto" title="section 5.1">5.1</a></li>
6094+
<li>value for repeat(), <a href="#valdef-repeat-auto" title="section 5.1.2">5.1.2</a></li>
60836095
<li>value for &lt;grid-line>, <a href="#grid-placement-auto" title="section 9.2">9.2</a></li>
60846096
</ul>
60856097
</li>

0 commit comments

Comments
 (0)