Skip to content

Commit 455fc00

Browse files
committed
[css-flexbox] Implement WG resolution to revert 'flex-basis: main-size' addition and to instead add 'flex-basis: content'.
1 parent dad8e2b commit 455fc00

2 files changed

Lines changed: 85 additions & 173 deletions

File tree

css-flexbox/Overview.bs

Lines changed: 37 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -917,7 +917,7 @@ Implied Minimum Size of Flex Items</h3>
917917
<dl>
918918
<dt><var>clamped size</var>
919919
<dd>
920-
is defined if the item’s 'flex-basis' is ''main-size''
920+
is defined if the item’s computed 'flex-basis' is ''auto''
921921
and its computed <a>main size property</a> is <a>definite</a>,
922922
and is that size (clamped by its <a>max main size property</a> if it's <a>definite</a>).
923923

@@ -1465,7 +1465,7 @@ The 'flex' Shorthand</h3>
14651465

14661466
<pre class='propdef'>
14671467
Name: flex
1468-
Value: none | auto | [ <<'flex-grow'>> <<'flex-shrink'>>? || <<'flex-basis'>> ]
1468+
Value: none | [ <<'flex-grow'>> <<'flex-shrink'>>? || <<'flex-basis'>> ]
14691469
Initial: see individual properties
14701470
Applies to: <a>flex items</a>
14711471
Inherited: see individual properties
@@ -1510,15 +1510,18 @@ The 'flex' Shorthand</h3>
15101510
<dt><dfn><<'flex-basis'>></dfn>
15111511
<dd>
15121512
<p>
1513-
This component, which takes the same values as the 'width' property,
1513+
This component, which takes the same values as the 'width' property
1514+
(plus an additional ''content'' keyword),
15141515
sets the 'flex-basis' <a href="#flex-components">longhand</a>
15151516
and specifies the <dfn dfn>flex basis</dfn>:
15161517
the initial <i>main size</i> of the <i>flex item</i>,
15171518
before free space is distributed according to the flex factors.
15181519
When omitted from the 'flex' shorthand, its specified value is ''0%''.
15191520
<p>
1520-
If the specified 'flex-basis' is <a value for=flex-basis>main-size</a>,
1521+
If the specified 'flex-basis' is <a value for=flex-basis>auto</a>,
15211522
the used <i>flex basis</i> is the computed value of the flex item’s <i>main size property</i>.
1523+
If that value is itself ''auto'',
1524+
then the used <i>flex basis</i> is automatically-determined based on its content (i.e. ''content'').
15221525

15231526
<figure>
15241527
<img src='images/rel-vs-abs-flex.svg' width='504' height='240'>
@@ -1531,20 +1534,13 @@ The 'flex' Shorthand</h3>
15311534
</figcaption>
15321535
</figure>
15331536

1534-
<dt><dfn>auto</dfn>
1535-
<dd>
1536-
The keyword ''flex/auto'' expands to ''1 1 main-size''.
1537-
1538-
<!-- This is a legacy value, because the "main-size" keyword used to be "auto", but that was confusing. -->
1539-
1540-
15411537
<dt><dfn>none</dfn>
15421538
<dd>
1543-
<p>The keyword ''none'' expands to ''0 0 main-size''.
1539+
<p>The keyword ''none'' expands to ''0 0 auto''.
15441540
</dl>
15451541

15461542
<p>
1547-
The initial values of the 'flex' components are equivalent to <a class="css-code" href="#flex-initial">flex: 0 1 main-size</a>.
1543+
The initial values of the 'flex' components are equivalent to <a class="css-code" href="#flex-initial">flex: 0 1 auto</a>.
15481544
<p class="note">
15491545
Note that the initial values of 'flex-grow' and 'flex-basis'
15501546
are different from their defaults when omitted in the 'flex' shorthand.
@@ -1557,38 +1553,37 @@ The 'flex' Shorthand</h3>
15571553
authors must specify a zero <<'flex-basis'>> component
15581554
with a unit or precede it by two flex factors.
15591555

1560-
<h3 id='flex-common'>
1561-
Common Values of 'flex'</h3>
1556+
<h4 id='flex-common'>
1557+
Common Values of 'flex'</h4>
15621558

15631559
<p><em>This section is informative.</em>
15641560

15651561
<p>
15661562
The list below summarizes the effects of the most common 'flex' values:
15671563

15681564
<dl>
1569-
<dt id="flex-initial">''flex: 0 main-size''
1570-
<dt>''flex: initial''
1565+
<dt id="flex-initial">''flex: initial''
15711566
<dd>
1572-
Equivalent to ''flex: 0 1 main-size''. (This is the initial value.)
1567+
Equivalent to ''flex: 0 1 auto''. (This is the initial value.)
15731568
Sizes the item based on the 'width'/'height' properties.
15741569
(If the item's <i>main size property</i> computes to <a value for=width>auto</a>,
15751570
this will size the flex item based on its contents.)
15761571
Makes the flex item inflexible when there is positive free space,
1577-
but allows it to shrink to its min-size when there is insufficient space.
1572+
but allows it to shrink to its minimum size when there is insufficient space.
15781573
The <a href="#alignment">alignment abilities</a> or <a href="#auto-margins"><span class=css>auto</span> margins</a>
15791574
can be used to align flex items along the <i>main axis</i>.
15801575

15811576
<dt>''flex: auto''
15821577
<dd>
1583-
Equivalent to ''flex: 1 1 main-size''.
1578+
Equivalent to ''flex: 1 1 auto''.
15841579
Sizes the item based on the 'width'/'height' properties,
15851580
but makes them fully flexible, so that they absorb any free space along the <i>main axis</i>.
15861581
If all items are either ''flex: auto'', ''flex: initial'', or ''flex: none'',
15871582
any positive free space after the items have been sized will be distributed evenly to the items with ''flex: auto''.
15881583

15891584
<dt>''flex: none''
15901585
<dd>
1591-
Equivalent to ''flex: 0 0 main-size''.
1586+
Equivalent to ''flex: 0 0 auto''.
15921587
This value sizes the item according to the 'width'/'height' properties,
15931588
but makes the flex item fully inflexible.
15941589
This is similar to ''initial'',
@@ -1674,8 +1669,8 @@ The 'flex-basis' property</h4>
16741669

16751670
<pre class='propdef'>
16761671
Name: flex-basis
1677-
Value: main-size | <<'width'>>
1678-
Initial: main-size
1672+
Value: content | <<'width'>>
1673+
Initial: auto
16791674
Applies to: <a>flex items</a>
16801675
Inherited: no
16811676
Computed value: as specified, with lengths made absolute
@@ -1691,49 +1686,29 @@ The 'flex-basis' property</h4>
16911686

16921687
<p>
16931688
The 'flex-basis' property sets the <i>flex basis</i>.
1694-
It accepts the same values as the 'width' and 'height' property.
1695-
1696-
<p>
1697-
The <dfn value for=flex-basis>main-size</dfn> keyword, when specified on a <i>flex item</i>,
1698-
retrieves the value of the <i>main size property</i>.
1699-
1700-
<div class="issue" id="issue-auto-name">
1701-
This value was originally named ''auto'',
1702-
but that was problematic because it left us with no keyword to represent an automatic flex basis.
1703-
There were two options for fixing this:
1704-
1705-
<dl>
1706-
<dt>''auto'' for automatic sizing; ''main-axis'' for size lookup
1707-
<dd>
1708-
The advantage of this is primarily that ''auto'' means “automatic”
1709-
both when it is specified for 'flex-basis' and when it is pulled in from 'width'/'height'.
1710-
It has the disadvantage (due to back-compat concerns) that the 'flex' shorthand had to be tweaked
1711-
to expand ''flex: auto'' to ''flex: 1 main-size'' rather than to ''flex: 1 auto''.
1712-
This fix is currently implemented in WebKit and Gecko,
1713-
but may be unshippable due to back-compat constraints.
1714-
<dt>''auto'' for size lookup; ''content''<sup>1</sup> for automatic sizing
1715-
<dd>
1716-
The advantage of this is that it will not break existing content:
1717-
a 'flex-basis' keyword for automatic sizing did not exist in the original CR,
1718-
so this option adds a new keyword but does not rename existing functionality.
1719-
It therefore avoids the ''flex: auto'' &ne; ''flex: 1 auto'' inequality,
1720-
but maintains the ''flex-basis: auto'' &ne; ''width: auto'' inequality.
1721-
</dl>
1722-
1723-
The CSSWG is waiting for feedback from implementers on this issue.
1724-
1725-
<small><sup>1</sup> Alternate keyword suggestions welcome.</small>
1726-
</div>
1689+
It accepts the same values as the 'width' and 'height' property, plus ''content''.
17271690

1728-
<p>
1729-
The <i>flex basis</i> is resolved the same way as 'width' in horizontal writing modes [[!CSS21]]:
1691+
<dl value for=flex-basis>
1692+
<dt><dfn>auto</dfn>
1693+
<dd>When specified on a <i>flex item</i>, the ''flex-basis/auto'' keyword
1694+
retrieves the value of the <i>main size property</i> as the used <i>flex basis</i>.
1695+
If that value is also ''auto'', then the used value is ''flex-basis/content''.
1696+
1697+
<dt><dfn>content</dfn>
1698+
<dd>Indicates automatic sizing, based on the <i>flex item</i>’s content.
1699+
1700+
<dt><<'width'>>
1701+
<dd>
1702+
For all other values,
1703+
<i>flex basis</i> is resolved the same way as 'width' in horizontal writing modes [[!CSS21]]:
17301704
percentage values of 'flex-basis' are resolved against
17311705
the flex item's containing block, i.e. its flex container,
17321706
and if that containing block's size is <a>indefinite</a>,
17331707
the result is the same as a <i>main size</i> of <a value for=width>auto</a>.
17341708
Similarly, 'flex-basis' determines the size of the content box,
17351709
unless otherwise specified
17361710
such as by 'box-sizing' [[CSS3UI]].
1711+
</dl>
17371712

17381713
<h2 id='alignment'>
17391714
Alignment</h2>
@@ -3171,7 +3146,7 @@ Boris Zbarsky.
31713146
<h3 id="changes-201403">
31723147
Changes since the 25 March 2014 LCWD</h3>
31733148

3174-
This section documents the changes since the previous publication.
3149+
This section documents the changes since previous publications.
31753150
A <a href="http://dev.w3.org/csswg/css-flexbox-1/issues-lc-20140325">Disposition of Comments</a> is also available.
31763151

31773152
<h4 id="change-201403-substantive">
@@ -3217,7 +3192,7 @@ Substantive Changes and Bugfixes</h4>
32173192
(Issue <a href="http://dev.w3.org/csswg/css-flexbox-1/issues-lc-20140325#issue-19">19</a>)
32183193

32193194
<blockquote>
3220-
<p>&hellip; is defined if <ins>the item’s flex-basis is ''main-size'' and</ins>
3195+
<p>&hellip; is defined if <ins>the item’s computed flex-basis is ''auto'' and</ins>
32213196
its computed main size property is definite &hellip;
32223197
</blockquote>
32233198

@@ -3240,14 +3215,8 @@ Substantive Changes and Bugfixes</h4>
32403215
so that “lookup from main-size property” and “automatic sizing” behaviors
32413216
could each be explicitly specified.
32423217
(Issue <a href="http://dev.w3.org/csswg/css-flexbox-1/issues-lc-20140325#issue-20">20</a>)
3243-
3244-
<blockquote>
3245-
<p><ins>The ''flex-basis/main-size'' keyword, when specified on a flex item, retrieves the value of the main size property.</ins>
3246-
<p><del>Except for auto, which retrieves the value of the main size property,</del> &hellip;
3247-
</blockquote>
3248-
3249-
<p>See <a href="#issue-auto-name">further discussion</a> on this issue
3250-
and a proposed alternative to solving the same problem.
3218+
This change was later reverted with an alternative proposal solving the same problem
3219+
by instead introducing the ''content'' keyword.
32513220

32523221
<li id="change-201403-definite-flexing">
32533222
Defined <i>flex items</i> with a <i>definite</i> <i>flex basis</i>

0 commit comments

Comments
 (0)