Changeset 200755 in webkit


Ignore:
Timestamp:
May 12, 2016 2:12:13 AM (8 years ago)
Author:
Manuel Rego Casasnovas
Message:

[css-grid] Incorrect parsing when using just 'span" as grid-line value
https://bugs.webkit.org/show_bug.cgi?id=157615

Reviewed by Sergio Villar Senin.

Source/WebCore:

The spec is pretty clear about this:
https://drafts.csswg.org/css-grid/#typedef-grid-row-start-grid-line

The possible options when using "span" to reference a grid line are:

[ span && [ <integer>
<custom-ident> ] ]

Thus, "span" keyword alone produces an invalid declaration.

  • css/CSSParser.cpp:

(WebCore::CSSParser::parseGridPosition):

LayoutTests:

Add new test case in grid-item-column-row-get-set.html.

Updated other tests that were using "span" alone, with 2 approaches:

  • In some of them changing "span" by "span 1" making it valid.
  • In other changing the expected result to "auto", as it's invalid now.
  • fast/css-grid-layout/grid-item-area-get-set.html:
  • fast/css-grid-layout/grid-item-bad-named-area-auto-placement.html:
  • fast/css-grid-layout/grid-item-column-row-get-set-expected.txt:
  • fast/css-grid-layout/grid-item-column-row-get-set.html:
  • fast/css-grid-layout/grid-item-end-after-get-set-expected.txt:
  • fast/css-grid-layout/grid-item-end-after-get-set.html:
  • fast/css-grid-layout/grid-item-negative-position-resolution.html:
  • fast/css-grid-layout/grid-item-start-before-get-set-expected.txt:
  • fast/css-grid-layout/grid-item-start-before-get-set.html:
Location:
trunk
Files:
12 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r200746 r200755  
     12016-05-12  Manuel Rego Casasnovas  <rego@igalia.com>
     2
     3        [css-grid] Incorrect parsing when using just 'span" as grid-line value
     4        https://bugs.webkit.org/show_bug.cgi?id=157615
     5
     6        Reviewed by Sergio Villar Senin.
     7
     8        Add new test case in grid-item-column-row-get-set.html.
     9
     10        Updated other tests that were using "span" alone, with 2 approaches:
     11        - In some of them changing "span" by "span 1" making it valid.
     12        - In other changing the expected result to "auto", as it's invalid now.
     13
     14        * fast/css-grid-layout/grid-item-area-get-set.html:
     15        * fast/css-grid-layout/grid-item-bad-named-area-auto-placement.html:
     16        * fast/css-grid-layout/grid-item-column-row-get-set-expected.txt:
     17        * fast/css-grid-layout/grid-item-column-row-get-set.html:
     18        * fast/css-grid-layout/grid-item-end-after-get-set-expected.txt:
     19        * fast/css-grid-layout/grid-item-end-after-get-set.html:
     20        * fast/css-grid-layout/grid-item-negative-position-resolution.html:
     21        * fast/css-grid-layout/grid-item-start-before-get-set-expected.txt:
     22        * fast/css-grid-layout/grid-item-start-before-get-set.html:
     23
    1242016-05-12  Joseph Pecoraro  <pecoraro@apple.com>
    225
  • trunk/LayoutTests/fast/css-grid-layout/grid-item-area-get-set.html

    r200510 r200755  
    2626
    2727#threeValueGridArea {
    28     grid-area: span / 10 / -1;
     28    grid-area: span 1 / 10 / -1;
    2929}
    3030
     
    3434
    3535#fourValueMixedGridArea {
    36     grid-area: firstArea / span / nonexistent / 1 foobar;
     36    grid-area: firstArea / span 1 / nonexistent / 1 foobar;
    3737}
    3838</style>
  • trunk/LayoutTests/fast/css-grid-layout/grid-item-bad-named-area-auto-placement.html

    r200510 r200755  
    3232.namedGridLineSpanColumn {
    3333    grid-row: 1;
    34     grid-column: nonExistentArea / span;
     34    grid-column: nonExistentArea / span 1;
    3535    background-color: lime;
    3636}
  • trunk/LayoutTests/fast/css-grid-layout/grid-item-column-row-get-set-expected.txt

    r200510 r200755  
    5353PASS getComputedStyle(gridItemWithAfterSpanElement, '').getPropertyValue('grid-row-start') is "3"
    5454PASS getComputedStyle(gridItemWithAfterSpanElement, '').getPropertyValue('grid-row-end') is "span 5"
    55 PASS getComputedStyle(gridItemWith2OnlySpanElement, '').getPropertyValue('grid-column') is "span 1 / span 1"
    56 PASS getComputedStyle(gridItemWith2OnlySpanElement, '').getPropertyValue('grid-column-start') is "span 1"
    57 PASS getComputedStyle(gridItemWith2OnlySpanElement, '').getPropertyValue('grid-column-end') is "span 1"
    58 PASS getComputedStyle(gridItemWith2OnlySpanElement, '').getPropertyValue('grid-row') is "span 1 / span 1"
    59 PASS getComputedStyle(gridItemWith2OnlySpanElement, '').getPropertyValue('grid-row-start') is "span 1"
    60 PASS getComputedStyle(gridItemWith2OnlySpanElement, '').getPropertyValue('grid-row-end') is "span 1"
     55PASS getComputedStyle(gridItemWith2OnlySpanElement, '').getPropertyValue('grid-column') is "auto / auto"
     56PASS getComputedStyle(gridItemWith2OnlySpanElement, '').getPropertyValue('grid-column-start') is "auto"
     57PASS getComputedStyle(gridItemWith2OnlySpanElement, '').getPropertyValue('grid-column-end') is "auto"
     58PASS getComputedStyle(gridItemWith2OnlySpanElement, '').getPropertyValue('grid-row') is "auto / auto"
     59PASS getComputedStyle(gridItemWith2OnlySpanElement, '').getPropertyValue('grid-row-start') is "auto"
     60PASS getComputedStyle(gridItemWith2OnlySpanElement, '').getPropertyValue('grid-row-end') is "auto"
    6161PASS getComputedStyle(gridItemWith2AutoElement, '').getPropertyValue('grid-column') is "auto / auto"
    6262PASS getComputedStyle(gridItemWith2AutoElement, '').getPropertyValue('grid-column-start') is "auto"
     
    171171PASS getComputedStyle(gridItem, '').getPropertyValue('grid-row-start') is "auto"
    172172PASS getComputedStyle(gridItem, '').getPropertyValue('grid-row-end') is "8"
     173PASS getComputedStyle(gridItem, '').getPropertyValue('grid-column') is "auto / auto"
     174PASS getComputedStyle(gridItem, '').getPropertyValue('grid-column-start') is "auto"
     175PASS getComputedStyle(gridItem, '').getPropertyValue('grid-column-end') is "auto"
     176PASS getComputedStyle(gridItem, '').getPropertyValue('grid-row') is "auto / auto"
     177PASS getComputedStyle(gridItem, '').getPropertyValue('grid-row-start') is "auto"
     178PASS getComputedStyle(gridItem, '').getPropertyValue('grid-row-end') is "auto"
    173179PASS getComputedStyle(gridItem, '').getPropertyValue('grid-column') is "span 1 / 3"
    174180PASS getComputedStyle(gridItem, '').getPropertyValue('grid-column-start') is "span 1"
     
    461467PASS getComputedStyle(gridItem, '').getPropertyValue('grid-row-start') is "auto"
    462468PASS getComputedStyle(gridItem, '').getPropertyValue('grid-row-end') is "auto"
     469PASS getComputedStyle(gridItem, '').getPropertyValue('grid-column') is "auto / auto"
     470PASS getComputedStyle(gridItem, '').getPropertyValue('grid-column-start') is "auto"
     471PASS getComputedStyle(gridItem, '').getPropertyValue('grid-column-end') is "auto"
     472PASS getComputedStyle(gridItem, '').getPropertyValue('grid-row') is "auto / auto"
     473PASS getComputedStyle(gridItem, '').getPropertyValue('grid-row-start') is "auto"
     474PASS getComputedStyle(gridItem, '').getPropertyValue('grid-row-end') is "auto"
     475PASS getComputedStyle(gridItem, '').getPropertyValue('grid-column') is "auto / auto"
     476PASS getComputedStyle(gridItem, '').getPropertyValue('grid-column-start') is "auto"
     477PASS getComputedStyle(gridItem, '').getPropertyValue('grid-column-end') is "auto"
     478PASS getComputedStyle(gridItem, '').getPropertyValue('grid-row') is "auto / auto"
     479PASS getComputedStyle(gridItem, '').getPropertyValue('grid-row-start') is "auto"
     480PASS getComputedStyle(gridItem, '').getPropertyValue('grid-row-end') is "auto"
    463481PASS successfullyParsed is true
    464482
  • trunk/LayoutTests/fast/css-grid-layout/grid-item-column-row-get-set.html

    r200510 r200755  
    7777}
    7878.gridItemWithNamedGridAreaAndSpan {
    79     grid-column: thirdArea / span;
     79    grid-column: thirdArea / span 1;
    8080    grid-row: firstArea / span 2;
    8181}
     
    117117    testColumnRowCSSParsing("gridItemWithBeforeSpanElement", "span 2 / 4", "3 / span 5");
    118118    testColumnRowCSSParsing("gridItemWithAfterSpanElement", "span 2 / 4", "3 / span 5");
    119     testColumnRowCSSParsing("gridItemWith2OnlySpanElement", "span 1 / span 1", "span 1 / span 1");
     119    testColumnRowCSSParsing("gridItemWith2OnlySpanElement", "auto / auto", "auto / auto");
    120120    testColumnRowCSSParsing("gridItemWith2AutoElement", "auto / auto" , "auto / auto");
    121121    testColumnRowCSSParsing("gridItemWithBothShortLongHandElement", "10 / 11", "4 / 5");
     
    149149    testColumnRowJSParsing("4 / auto", "5 / auto");
    150150    testColumnRowJSParsing("auto / 5", "auto / 8");
    151     testColumnRowJSParsing("span / 3", "5 / span", "span 1 / 3", "5 / span 1");
     151    testColumnRowJSParsing("span / 3", "5 / span", "auto / auto", "auto / auto");
     152    testColumnRowJSParsing("span 1 / 3", "5 / span 1", "span 1 / 3", "5 / span 1");
    152153    testColumnRowJSParsing("first span / 3", "5 / last span", "span 1 first / 3", "5 / span 1 last");
    153154    testColumnRowJSParsing("first / last", "nav / last span", "first / last", "nav / span 1 last");
     
    201202    testColumnRowInvalidJSParsing("6 / 0", "8 / 0");
    202203    testColumnRowInvalidJSParsing("0", "0");
     204
     205    // 'span' alone is invalid
     206    testColumnRowInvalidJSParsing("span", "span");
     207    testColumnRowInvalidJSParsing("span / span", "span / span");
    203208
    204209    testColumnRowInvalidJSParsing("span span / span span", "span span / span span");
  • trunk/LayoutTests/fast/css-grid-layout/grid-item-end-after-get-set-expected.txt

    r200510 r200755  
    3535PASS getComputedStyle(gridItemWithAfterSpan, '').getPropertyValue('grid-row-start') is "auto"
    3636PASS getComputedStyle(gridItemWithAfterSpan, '').getPropertyValue('grid-row-end') is "span 9"
    37 PASS getComputedStyle(gridItemWithOnlySpan, '').getPropertyValue('grid-column') is "auto / span 1"
     37PASS getComputedStyle(gridItemWithOnlySpan, '').getPropertyValue('grid-column') is "auto / auto"
    3838PASS getComputedStyle(gridItemWithOnlySpan, '').getPropertyValue('grid-column-start') is "auto"
    39 PASS getComputedStyle(gridItemWithOnlySpan, '').getPropertyValue('grid-column-end') is "span 1"
    40 PASS getComputedStyle(gridItemWithOnlySpan, '').getPropertyValue('grid-row') is "auto / span 1"
     39PASS getComputedStyle(gridItemWithOnlySpan, '').getPropertyValue('grid-column-end') is "auto"
     40PASS getComputedStyle(gridItemWithOnlySpan, '').getPropertyValue('grid-row') is "auto / auto"
    4141PASS getComputedStyle(gridItemWithOnlySpan, '').getPropertyValue('grid-row-start') is "auto"
    42 PASS getComputedStyle(gridItemWithOnlySpan, '').getPropertyValue('grid-row-end') is "span 1"
     42PASS getComputedStyle(gridItemWithOnlySpan, '').getPropertyValue('grid-row-end') is "auto"
    4343PASS getComputedStyle(gridItemWithAutoElement, '').getPropertyValue('grid-column') is "auto / auto"
    4444PASS getComputedStyle(gridItemWithAutoElement, '').getPropertyValue('grid-column-start') is "auto"
  • trunk/LayoutTests/fast/css-grid-layout/grid-item-end-after-get-set.html

    r200510 r200755  
    8282    testColumnRowCSSParsing("gridItemWithBeforeSpan", "auto / span 2", "auto / span 9");
    8383    testColumnRowCSSParsing("gridItemWithAfterSpan", "auto / span 2", "auto / span 9");
    84     testColumnRowCSSParsing("gridItemWithOnlySpan", "auto / span 1", "auto / span 1");
     84    testColumnRowCSSParsing("gridItemWithOnlySpan", "auto / auto", "auto / auto");
    8585    testColumnRowCSSParsing("gridItemWithAutoElement", "auto / auto", "auto / auto");
    8686    testColumnRowCSSParsing("gridItemWithCustomIdent", "auto / first", "auto / last");
  • trunk/LayoutTests/fast/css-grid-layout/grid-item-negative-position-resolution.html

    r200510 r200755  
    6060
    6161.negativeEndPositionStartSpanInColumnDirection {
    62     grid-column: span / -1;
     62    grid-column: span 1 / -1;
    6363    grid-row: 1;
    6464}
     
    7070
    7171.negativeNamedGridLineEndPositionStartSpanInColumnDirection {
    72     grid-column: span / last;
     72    grid-column: span 1 / last;
    7373    grid-row: 1;
    7474}
  • trunk/LayoutTests/fast/css-grid-layout/grid-item-start-before-get-set-expected.txt

    r200510 r200755  
    3333PASS getComputedStyle(gridItemWithAfterSpan, '').getPropertyValue('grid-row-start') is "span 8"
    3434PASS getComputedStyle(gridItemWithAfterSpan, '').getPropertyValue('grid-row-end') is "auto"
    35 PASS getComputedStyle(gridItemWithOnlySpan, '').getPropertyValue('grid-column') is "span 1 / auto"
    36 PASS getComputedStyle(gridItemWithOnlySpan, '').getPropertyValue('grid-column-start') is "span 1"
     35PASS getComputedStyle(gridItemWithOnlySpan, '').getPropertyValue('grid-column') is "auto / auto"
     36PASS getComputedStyle(gridItemWithOnlySpan, '').getPropertyValue('grid-column-start') is "auto"
    3737PASS getComputedStyle(gridItemWithOnlySpan, '').getPropertyValue('grid-column-end') is "auto"
    38 PASS getComputedStyle(gridItemWithOnlySpan, '').getPropertyValue('grid-row') is "span 1 / auto"
    39 PASS getComputedStyle(gridItemWithOnlySpan, '').getPropertyValue('grid-row-start') is "span 1"
     38PASS getComputedStyle(gridItemWithOnlySpan, '').getPropertyValue('grid-row') is "auto / auto"
     39PASS getComputedStyle(gridItemWithOnlySpan, '').getPropertyValue('grid-row-start') is "auto"
    4040PASS getComputedStyle(gridItemWithOnlySpan, '').getPropertyValue('grid-row-end') is "auto"
    4141PASS getComputedStyle(gridItemWithAutoElement, '').getPropertyValue('grid-column') is "auto / auto"
  • trunk/LayoutTests/fast/css-grid-layout/grid-item-start-before-get-set.html

    r200510 r200755  
    8787    testColumnRowCSSParsing("gridItemWithBeforeSpan", "span 2 / auto", "span 8 / auto");
    8888    testColumnRowCSSParsing("gridItemWithAfterSpan", "span 2 / auto", "span 8 / auto");
    89     testColumnRowCSSParsing("gridItemWithOnlySpan", "span 1 / auto", "span 1 / auto");
     89    testColumnRowCSSParsing("gridItemWithOnlySpan", "auto / auto", "auto / auto");
    9090    testColumnRowCSSParsing("gridItemWithAutoElement", "auto / auto", "auto / auto");
    9191    testColumnRowCSSParsing("gridItemWithCustomIdent", "first / auto", "last / auto");
  • trunk/Source/WebCore/ChangeLog

    r200747 r200755  
     12016-05-12  Manuel Rego Casasnovas  <rego@igalia.com>
     2
     3        [css-grid] Incorrect parsing when using just 'span" as grid-line value
     4        https://bugs.webkit.org/show_bug.cgi?id=157615
     5
     6        Reviewed by Sergio Villar Senin.
     7
     8        The spec is pretty clear about this:
     9        https://drafts.csswg.org/css-grid/#typedef-grid-row-start-grid-line
     10
     11        The possible options when using "span" to reference a grid line are:
     12          [ span && [ <integer> || <custom-ident> ] ]
     13
     14        Thus, "span" keyword alone produces an invalid declaration.
     15
     16        * css/CSSParser.cpp:
     17        (WebCore::CSSParser::parseGridPosition):
     18
    1192016-05-12  Csaba Osztrogonác  <ossy@webkit.org>
    220
  • trunk/Source/WebCore/css/CSSParser.cpp

    r200626 r200755  
    55025502    // If we didn't parse anything, this is not a valid grid position.
    55035503    if (!hasSeenSpanKeyword && !gridLineName && !numericValue)
     5504        return nullptr;
     5505
     5506    // If we have "span" keyword alone is invalid.
     5507    if (hasSeenSpanKeyword && !gridLineName && !numericValue)
    55045508        return nullptr;
    55055509
Note: See TracChangeset for help on using the changeset viewer.