Ignore:
Timestamp:
Feb 23, 2016, 8:49:54 AM (10 years ago)
Author:
Manuel Rego Casasnovas
Message:

[css-grid] Rows track sizes are optional in grid-template shorthand
https://bugs.webkit.org/show_bug.cgi?id=154586

Reviewed by Sergio Villar Senin.

You can omit the size of the rows in grid-template shorthand,
even if you specify a named grid line for the end of the row,
due to a change in the spec back in 2014:
https://github.com/w3c/csswg-drafts/commit/9f660c4183c73c1f5279c46904dc6cb314f76194

Before if you want to specify a named grid line,
you need to set the row size.

Update parsing, so it nows accepts things like:

grid-template: 100px / "a" [bottom];

Source/WebCore:

  • css/CSSParser.cpp:

(WebCore::CSSParser::parseGridTemplateRowsAndAreasAndColumns):
(WebCore::CSSParser::parseGridTemplateShorthand):

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/fast/css-grid-layout/grid-template-shorthand-get-set.html

    r196934 r196978  
    2525    -webkit-grid-template: [head] "a" 15px [tail] / 10px;
    2626}
     27#gridTemplateComplexFormWithLineNamesWithoutRowSize {
     28    -webkit-grid-template: [head] "a" [tail] / 10px;
     29}
    2730#gridTemplateComplexFormWithLineNamesMultipleColumns {
    2831    -webkit-grid-template: [head] "a b" 15px [tail] / 10px;
     32}
     33#gridTemplateComplexFormWithLineNamesMultipleColumnsWithoutRowSize {
     34    -webkit-grid-template: [head] "a b" [tail] / 10px;
    2935}
    3036#gridTemplateComplexFormWithLineNamesMultipleRows {
    3137    -webkit-grid-template: [head1] "a" 15px [tail1]
    3238                           [head2] "b" 20px [tail2] / 10px;
     39}
     40#gridTemplateComplexFormWithLineNamesMultipleRowsWithoutRowsSizes {
     41    -webkit-grid-template: [head1] "a" [tail1]
     42                           [head2] "b" [tail2] / 10px;
    3343}
    3444#gridTemplateComplexFormWithLineNamesMultipleRowsAndColumns {
     
    3747                           [nav2] "g h i" 25px  [last] / [first] 10px repeat(2, [nav nav2] 15px);
    3848}
     49#gridTemplateComplexFormWithLineNamesMultipleRowsAndColumnsWithoutRowsSizes {
     50    -webkit-grid-template:        "a b c" [nav]
     51                           [nav2] "d e f" [nav]
     52                           [nav2] "g h i" [last] / [first] 10px repeat(2, [nav nav2] 15px);
     53}
    3954#gridTemplateComplexFormWithAuto {
    4055    -webkit-grid-template: "a" / 10px;
     
    99114#gridTemplateComplexFormMisplacedRowsSize2 {
    100115    -webkit-grid-template: "a" [name] 10px / 25px;
     116}
     117#gridTemplateComplexFormMisplacedRowsSize3 {
     118    -webkit-grid-template: [head] "a" [tail] 10px / 10px;
     119}
     120#gridTemplateComplexFormMisplacedRowsSize4 {
     121    -webkit-grid-template: [head1] "a" [tail1]
     122                           [head2] "a" [tail2] 100px / 10px;
    101123}
    102124#gridTemplateComplexFormColumnsNotParsing1 {
     
    127149<div class="grid" id="gridTemplateComplexForm"></div>
    128150<div class="grid" id="gridTemplateComplexFormWithLineNames"></div>
     151<div class="grid" id="gridTemplateComplexFormWithLineNamesWithoutRowSize"></div>
    129152<div class="grid" id="gridTemplateComplexFormWithLineNamesMultipleColumns"></div>
     153<div class="grid" id="gridTemplateComplexFormWithLineNamesMultipleColumnsWithoutRowSize"></div>
    130154<div class="grid" id="gridTemplateComplexFormWithLineNamesMultipleRows"></div>
     155<div class="grid" id="gridTemplateComplexFormWithLineNamesMultipleRowsWithoutRowsSizes"></div>
    131156<div class="grid" id="gridTemplateComplexFormWithLineNamesMultipleRowsAndColumns"></div>
     157<div class="grid" id="gridTemplateComplexFormWithLineNamesMultipleRowsAndColumnsWithoutRowsSizes"></div>
    132158<div class="grid" id="gridTemplateComplexFormWithAuto"></div>
    133159<div class="grid" id="gridTemplateComplexFormOnlyAreas"></div>
     
    152178<div class="grid" id="gridTemplateComplexFormMisplacedRowsSize1"></div>
    153179<div class="grid" id="gridTemplateComplexFormMisplacedRowsSize2"></div>
     180<div class="grid" id="gridTemplateComplexFormMisplacedRowsSize3"></div>
     181<div class="grid" id="gridTemplateComplexFormMisplacedRowsSize4"></div>
    154182<div class="grid" id="gridTemplateComplexFormColumnsNotParsing1"></div>
    155183<div class="grid" id="gridTemplateComplexFormColumnsNotParsing2"></div>
     
    168196    testGridDefinitionsValues(document.getElementById("gridTemplateComplexForm"), "10px", "15px", '"a"');
    169197    testGridDefinitionsValues(document.getElementById("gridTemplateComplexFormWithLineNames"), "10px", "[head] 15px [tail]", '"a"');
     198    testGridDefinitionsValues(document.getElementById("gridTemplateComplexFormWithLineNamesWithoutRowSize"), "10px", "[head] 0px [tail]", '"a"');
    170199    testGridDefinitionsValues(document.getElementById("gridTemplateComplexFormWithLineNamesMultipleColumns"), "10px", "[head] 15px [tail]", '"a b"');
     200    testGridDefinitionsValues(document.getElementById("gridTemplateComplexFormWithLineNamesMultipleColumnsWithoutRowSize"), "10px", "[head] 0px [tail]", '"a b"');
    171201    testGridDefinitionsValues(document.getElementById("gridTemplateComplexFormWithLineNamesMultipleRows"), "10px", "[head1] 15px [tail1 head2] 20px [tail2]", '"a" "b"');
     202    testGridDefinitionsValues(document.getElementById("gridTemplateComplexFormWithLineNamesMultipleRowsWithoutRowsSizes"), "10px", "[head1] 0px [tail1 head2] 0px [tail2]", '"a" "b"');
    172203    testGridDefinitionsValues(document.getElementById("gridTemplateComplexFormWithLineNamesMultipleRowsAndColumns"), "[first] 10px [nav nav2] 15px [nav nav2] 15px", "100px [nav nav2] 25px [nav nav2] 25px [last]", '"a b c" "d e f" "g h i"');
     204    testGridDefinitionsValues(document.getElementById("gridTemplateComplexFormWithLineNamesMultipleRowsAndColumnsWithoutRowsSizes"), "[first] 10px [nav nav2] 15px [nav nav2] 15px", "0px [nav nav2] 0px [nav nav2] 0px [last]", '"a b c" "d e f" "g h i"');
    173205    testGridDefinitionsValues(document.getElementById("gridTemplateComplexFormWithAuto"), "10px", "0px", '"a"');
    174206    testGridDefinitionsValues(document.getElementById("gridTemplateComplexFormOnlyAreas"), "none", "0px", '"a"');
     
    194226    testGridDefinitionsValues(document.getElementById("gridTemplateComplexFormMisplacedRowsSize1"), "none", "none", "none");
    195227    testGridDefinitionsValues(document.getElementById("gridTemplateComplexFormMisplacedRowsSize2"), "none", "none", "none");
     228    testGridDefinitionsValues(document.getElementById("gridTemplateComplexFormMisplacedRowsSize3"), "none", "none", "none");
     229    testGridDefinitionsValues(document.getElementById("gridTemplateComplexFormMisplacedRowsSize4"), "none", "none", "none");
    196230    testGridDefinitionsValues(document.getElementById("gridTemplateComplexFormColumnsNotParsing1"), "none", "none", "none");
    197231    testGridDefinitionsValues(document.getElementById("gridTemplateComplexFormColumnsNotParsing2"), "none", "none", "none");
Note: See TracChangeset for help on using the changeset viewer.