Changeset 252883 in webkit


Ignore:
Timestamp:
Nov 26, 2019 4:09:04 AM (4 years ago)
Author:
Manuel Rego Casasnovas
Message:

LayoutTests/imported/w3c:
[css-grid] Avoid serializing [] in grid-template* specified values
https://bugs.webkit.org/show_bug.cgi?id=204501

Reviewed by Javier Fernandez.

Update tests results, several tests are now passing.
Other are still failing due to different bugs like webkit.org/b/204508.

  • web-platform-tests/css/css-grid/parsing/grid-shorthand-expected.txt:
  • web-platform-tests/css/css-grid/parsing/grid-shorthand-valid-expected.txt:
  • web-platform-tests/css/css-grid/parsing/grid-template-columns-valid-expected.txt:
  • web-platform-tests/css/css-grid/parsing/grid-template-rows-valid-expected.txt:
  • web-platform-tests/css/css-grid/parsing/grid-template-shorthand-expected.txt:
  • web-platform-tests/css/css-grid/parsing/grid-template-shorthand-valid-expected.txt:

Source/WebCore:
[css-grid] Avoid serializing [] in grid-template-* specified values
https://bugs.webkit.org/show_bug.cgi?id=204501

Reviewed by Javier Fernandez.

Based on Blink r699101 by <ericwilligers@chromium.org>.

This patch discards empty list of line names when parsing grid-template-* properties.
That way we avoid these empty lists "[]" during serialization.

This was discussed at: https://github.com/w3c/csswg-drafts/issues/4173.

Several WPT tests are passing thanks to this change.

  • css/parser/CSSPropertyParser.cpp:

(WebCore::consumeGridLineNames):
(WebCore::consumeGridTrackList):

Location:
trunk
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/imported/w3c/ChangeLog

    r252867 r252883  
     12019-11-26  Manuel Rego Casasnovas  <rego@igalia.com>
     2
     3        [css-grid] Avoid serializing [] in grid-template* specified values
     4        https://bugs.webkit.org/show_bug.cgi?id=204501
     5
     6        Reviewed by Javier Fernandez.
     7
     8        Update tests results, several tests are now passing.
     9        Other are still failing due to different bugs like webkit.org/b/204508.
     10
     11        * web-platform-tests/css/css-grid/parsing/grid-shorthand-expected.txt:
     12        * web-platform-tests/css/css-grid/parsing/grid-shorthand-valid-expected.txt:
     13        * web-platform-tests/css/css-grid/parsing/grid-template-columns-valid-expected.txt:
     14        * web-platform-tests/css/css-grid/parsing/grid-template-rows-valid-expected.txt:
     15        * web-platform-tests/css/css-grid/parsing/grid-template-shorthand-expected.txt:
     16        * web-platform-tests/css/css-grid/parsing/grid-template-shorthand-valid-expected.txt:
     17
    1182019-11-25  Manuel Rego Casasnovas  <rego@igalia.com>
    219
  • trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-grid/parsing/grid-shorthand-expected.txt

    r252867 r252883  
    3939FAIL e.style['grid'] = " [] \"a a a\"     [] [] \"b b b\" 1fr []  / [] auto 1fr [] auto []" should set grid-auto-rows assert_equals: grid-auto-rows should be canonical expected "auto" but got "initial"
    4040PASS e.style['grid'] = " [] \"a a a\"     [] [] \"b b b\" 1fr []  / [] auto 1fr [] auto []" should set grid-template-areas
    41 FAIL e.style['grid'] = " [] \"a a a\"     [] [] \"b b b\" 1fr []  / [] auto 1fr [] auto []" should set grid-template-columns assert_equals: grid-template-columns should be canonical expected "auto 1fr auto" but got "[] auto 1fr [] auto []"
    42 FAIL e.style['grid'] = " [] \"a a a\"     [] [] \"b b b\" 1fr []  / [] auto 1fr [] auto []" should set grid-template-rows assert_equals: grid-template-rows should be canonical expected "auto 1fr" but got "[] auto [] [] 1fr []"
     41PASS e.style['grid'] = " [] \"a a a\"     [] [] \"b b b\" 1fr []  / [] auto 1fr [] auto []" should set grid-template-columns
     42PASS e.style['grid'] = " [] \"a a a\"     [] [] \"b b b\" 1fr []  / [] auto 1fr [] auto []" should set grid-template-rows
    4343PASS e.style['grid'] = " [] \"a a a\"     [] [] \"b b b\" 1fr []  / [] auto 1fr [] auto []" should not set unrelated longhands
    4444PASS e.style['grid'] = "10px / auto-flow dense 20px" should set grid-auto-columns
  • trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-grid/parsing/grid-shorthand-valid-expected.txt

    r252867 r252883  
    22FAIL e.style['grid'] = "auto / auto" should set the property value assert_equals: serialization should be canonical expected "auto / auto" but got "auto auto none"
    33FAIL e.style['grid'] = "none / [a] 0px" should set the property value assert_equals: serialization should be canonical expected "none / [a] 0px" but got "none [a] 0px none"
    4 FAIL e.style['grid'] = "none / [] 0px" should set the property value assert_equals: serialization should be canonical expected "none / 0px" but got "none [] 0px none"
     4FAIL e.style['grid'] = "none / [] 0px" should set the property value assert_equals: serialization should be canonical expected "none / 0px" but got "none 0px none"
    55FAIL e.style['grid'] = "[a] 10px / auto" should set the property value assert_equals: serialization should be canonical expected "[a] 10px / auto" but got "[a] 10px auto none"
    66FAIL e.style['grid'] = "[a] 10px / none" should set the property value assert_equals: serialization should be canonical expected "[a] 10px / none" but got "[a] 10px none none"
    7 FAIL e.style['grid'] = "[] 10px [] / [] auto []" should set the property value assert_equals: serialization should be canonical expected "10px / auto" but got "[] 10px [] [] auto [] none"
     7FAIL e.style['grid'] = "[] 10px [] / [] auto []" should set the property value assert_equals: serialization should be canonical expected "10px / auto" but got "10px auto none"
    88FAIL e.style['grid'] = "[a] \"a\" 10px" should set the property value assert_equals: serialization should be canonical expected "[a] \"a\" 10px" but got "[a] 10px none \"a\""
    9 FAIL e.style['grid'] = "[a] \"a\" 10px []" should set the property value assert_equals: serialization should be canonical expected "[a] \"a\" 10px" but got "[a] 10px [] none \"a\""
     9FAIL e.style['grid'] = "[a] \"a\" 10px []" should set the property value assert_equals: serialization should be canonical expected "[a] \"a\" 10px" but got "[a] 10px none \"a\""
    1010FAIL e.style['grid'] = "\"a\" 10px" should set the property value assert_equals: serialization should be canonical expected "\"a\" 10px" but got "10px none \"a\""
    11 FAIL e.style['grid'] = "[] \"a\" 10px" should set the property value assert_equals: serialization should be canonical expected "\"a\" 10px" but got "[] 10px none \"a\""
     11FAIL e.style['grid'] = "[] \"a\" 10px" should set the property value assert_equals: serialization should be canonical expected "\"a\" 10px" but got "10px none \"a\""
    1212FAIL e.style['grid'] = "[a] \"a\" 10px [a]" should set the property value assert_equals: serialization should be canonical expected "[a] \"a\" 10px [a]" but got "[a] 10px [a] none \"a\""
    1313
  • trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-grid/parsing/grid-template-columns-valid-expected.txt

    r252867 r252883  
    2323PASS e.style['grid-template-columns'] = "fit-content(calc(0.5em + 10px))" should set the property value
    2424PASS e.style['grid-template-columns'] = "fit-content(calc(30% + 40vw))" should set the property value
    25 FAIL e.style['grid-template-columns'] = "repeat(1, [] 10px [])" should set the property value assert_equals: serialization should be canonical expected "repeat(1, 10px)" but got "repeat(1, [] 10px [])"
     25PASS e.style['grid-template-columns'] = "repeat(1, [] 10px [])" should set the property value
    2626PASS e.style['grid-template-columns'] = "repeat(1, [one two] 20%)" should set the property value
    2727PASS e.style['grid-template-columns'] = "repeat(2, minmax(10px, auto))" should set the property value
    2828PASS e.style['grid-template-columns'] = "repeat(2, fit-content(20%) [three four] 30px 40px [five six])" should set the property value
    2929PASS e.style['grid-template-columns'] = "min-content repeat(5, minmax(10px, auto))" should set the property value
    30 FAIL e.style['grid-template-columns'] = "[] 150px [] 1fr []" should set the property value assert_equals: serialization should be canonical expected "150px 1fr" but got "[] 150px [] 1fr []"
     30PASS e.style['grid-template-columns'] = "[] 150px [] 1fr []" should set the property value
    3131PASS e.style['grid-template-columns'] = "repeat(auto-fill, 10px)" should set the property value
    3232PASS e.style['grid-template-columns'] = "repeat(auto-fit, [one] 20%)" should set the property value
  • trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-grid/parsing/grid-template-rows-valid-expected.txt

    r252867 r252883  
    2323PASS e.style['grid-template-rows'] = "fit-content(calc(0.5em + 10px))" should set the property value
    2424PASS e.style['grid-template-rows'] = "fit-content(calc(30% + 40vw))" should set the property value
    25 FAIL e.style['grid-template-rows'] = "repeat(1, [] 10px [])" should set the property value assert_equals: serialization should be canonical expected "repeat(1, 10px)" but got "repeat(1, [] 10px [])"
     25PASS e.style['grid-template-rows'] = "repeat(1, [] 10px [])" should set the property value
    2626PASS e.style['grid-template-rows'] = "repeat(1, [one two] 20%)" should set the property value
    2727PASS e.style['grid-template-rows'] = "repeat(2, minmax(10px, auto))" should set the property value
    2828PASS e.style['grid-template-rows'] = "repeat(2, fit-content(20%) [three four] 30px 40px [five six])" should set the property value
    2929PASS e.style['grid-template-rows'] = "min-content repeat(5, minmax(10px, auto))" should set the property value
    30 FAIL e.style['grid-template-rows'] = "[] 150px [] 1fr []" should set the property value assert_equals: serialization should be canonical expected "150px 1fr" but got "[] 150px [] 1fr []"
     30PASS e.style['grid-template-rows'] = "[] 150px [] 1fr []" should set the property value
    3131PASS e.style['grid-template-rows'] = "repeat(auto-fill, 10px)" should set the property value
    3232PASS e.style['grid-template-rows'] = "repeat(auto-fit, [one] 20%)" should set the property value
  • trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-grid/parsing/grid-template-shorthand-expected.txt

    r252867 r252883  
    2121PASS e.style['grid-template'] = "  \"a a a\"  \"b b b\" 1fr/ auto 1fr auto" should not set unrelated longhands
    2222PASS e.style['grid-template'] = " [] \"a a a\"     [] [] \"b b b\" 1fr []  / [] auto 1fr [] auto []" should set grid-template-areas
    23 FAIL e.style['grid-template'] = " [] \"a a a\"     [] [] \"b b b\" 1fr []  / [] auto 1fr [] auto []" should set grid-template-columns assert_equals: grid-template-columns should be canonical expected "auto 1fr auto" but got "[] auto 1fr [] auto []"
    24 FAIL e.style['grid-template'] = " [] \"a a a\"     [] [] \"b b b\" 1fr []  / [] auto 1fr [] auto []" should set grid-template-rows assert_equals: grid-template-rows should be canonical expected "auto 1fr" but got "[] auto [] [] 1fr []"
     23PASS e.style['grid-template'] = " [] \"a a a\"     [] [] \"b b b\" 1fr []  / [] auto 1fr [] auto []" should set grid-template-columns
     24PASS e.style['grid-template'] = " [] \"a a a\"     [] [] \"b b b\" 1fr []  / [] auto 1fr [] auto []" should set grid-template-rows
    2525PASS e.style['grid-template'] = " [] \"a a a\"     [] [] \"b b b\" 1fr []  / [] auto 1fr [] auto []" should not set unrelated longhands
    2626
  • trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-grid/parsing/grid-template-shorthand-valid-expected.txt

    r252867 r252883  
    22FAIL e.style['grid-template'] = "auto / auto" should set the property value assert_equals: serialization should be canonical expected "auto / auto" but got "auto auto none"
    33FAIL e.style['grid-template'] = "none / [a] 0px" should set the property value assert_equals: serialization should be canonical expected "none / [a] 0px" but got "none [a] 0px none"
    4 FAIL e.style['grid-template'] = "none / [] 0px" should set the property value assert_equals: serialization should be canonical expected "none / 0px" but got "none [] 0px none"
     4FAIL e.style['grid-template'] = "none / [] 0px" should set the property value assert_equals: serialization should be canonical expected "none / 0px" but got "none 0px none"
    55FAIL e.style['grid-template'] = "[a] 10px / auto" should set the property value assert_equals: serialization should be canonical expected "[a] 10px / auto" but got "[a] 10px auto none"
    66FAIL e.style['grid-template'] = "[a] 10px / none" should set the property value assert_equals: serialization should be canonical expected "[a] 10px / none" but got "[a] 10px none none"
    7 FAIL e.style['grid-template'] = "[] 10px [] / [] auto []" should set the property value assert_equals: serialization should be canonical expected "10px / auto" but got "[] 10px [] [] auto [] none"
     7FAIL e.style['grid-template'] = "[] 10px [] / [] auto []" should set the property value assert_equals: serialization should be canonical expected "10px / auto" but got "10px auto none"
    88FAIL e.style['grid-template'] = "[a] \"a\" 10px" should set the property value assert_equals: serialization should be canonical expected "[a] \"a\" 10px" but got "[a] 10px none \"a\""
    9 FAIL e.style['grid-template'] = "[a] \"a\" 10px []" should set the property value assert_equals: serialization should be canonical expected "[a] \"a\" 10px" but got "[a] 10px [] none \"a\""
     9FAIL e.style['grid-template'] = "[a] \"a\" 10px []" should set the property value assert_equals: serialization should be canonical expected "[a] \"a\" 10px" but got "[a] 10px none \"a\""
    1010FAIL e.style['grid-template'] = "\"a\" 10px" should set the property value assert_equals: serialization should be canonical expected "\"a\" 10px" but got "10px none \"a\""
    11 FAIL e.style['grid-template'] = "[] \"a\" 10px" should set the property value assert_equals: serialization should be canonical expected "\"a\" 10px" but got "[] 10px none \"a\""
     11FAIL e.style['grid-template'] = "[] \"a\" 10px" should set the property value assert_equals: serialization should be canonical expected "\"a\" 10px" but got "10px none \"a\""
    1212FAIL e.style['grid-template'] = "[a] \"a\" 10px [a]" should set the property value assert_equals: serialization should be canonical expected "[a] \"a\" 10px [a]" but got "[a] 10px [a] none \"a\""
    1313
  • trunk/Source/WebCore/ChangeLog

    r252882 r252883  
     12019-11-26  Manuel Rego Casasnovas  <rego@igalia.com>
     2
     3        [css-grid] Avoid serializing [] in grid-template-* specified values
     4        https://bugs.webkit.org/show_bug.cgi?id=204501
     5
     6        Reviewed by Javier Fernandez.
     7
     8        Based on Blink r699101 by <ericwilligers@chromium.org>.
     9
     10        This patch discards empty list of line names when parsing grid-template-* properties.
     11        That way we avoid these empty lists "[]" during serialization.
     12
     13        This was discussed at: https://github.com/w3c/csswg-drafts/issues/4173.
     14
     15        Several WPT tests are passing thanks to this change.
     16
     17        * css/parser/CSSPropertyParser.cpp:
     18        (WebCore::consumeGridLineNames):
     19        (WebCore::consumeGridTrackList):
     20
    1212019-11-26  Carlos Garcia Campos  <cgarcia@igalia.com>
    222
  • trunk/Source/WebCore/css/parser/CSSPropertyParser.cpp

    r252467 r252883  
    33423342}
    33433343
    3344 // Appends to the passed in CSSGridLineNamesValue if any, otherwise creates a new one.
     3344// Appends to the passed in CSSGridLineNamesValue if any, otherwise creates a new one. Returns nullptr if an empty list is consumed.
    33453345static RefPtr<CSSGridLineNamesValue> consumeGridLineNames(CSSParserTokenRange& range, CSSGridLineNamesValue* lineNames = nullptr)
    33463346{
     
    33573357        return nullptr;
    33583358    range = rangeCopy;
    3359     return result;
     3359    return result->length() ? result : nullptr;
    33603360}
    33613361
     
    34203420    bool allowGridLineNames = trackListType != GridAuto;
    34213421    RefPtr<CSSValueList> values = CSSValueList::createSpaceSeparated();
     3422    if (!allowGridLineNames && range.peek().type() == LeftBracketToken)
     3423        return nullptr;
    34223424    RefPtr<CSSGridLineNamesValue> lineNames = consumeGridLineNames(range);
    3423     if (lineNames) {
    3424         if (!allowGridLineNames)
    3425             return nullptr;
     3425    if (lineNames)
    34263426        values->append(lineNames.releaseNonNull());
    3427     }
    34283427   
    34293428    bool allowRepeat = trackListType == GridTemplate;
     
    34493448        if (seenAutoRepeat && !allTracksAreFixedSized)
    34503449            return nullptr;
     3450        if (!allowGridLineNames && range.peek().type() == LeftBracketToken)
     3451            return nullptr;
    34513452        lineNames = consumeGridLineNames(range);
    3452         if (lineNames) {
    3453             if (!allowGridLineNames)
    3454                 return nullptr;
     3453        if (lineNames)
    34553454            values->append(lineNames.releaseNonNull());
    3456         }
    34573455    } while (!range.atEnd() && range.peek().type() != DelimiterToken);
    34583456    return values;
Note: See TracChangeset for help on using the changeset viewer.