Changeset 201399 in webkit


Ignore:
Timestamp:
May 25, 2016 12:52:53 PM (8 years ago)
Author:
Manuel Rego Casasnovas
Message:

[css-grid] Update <fixed-size> syntax
https://bugs.webkit.org/show_bug.cgi?id=158063

Reviewed by Darin Adler.

Source/WebCore:

The syntax for <fixed-size> has been updated on the spec:
https://drafts.csswg.org/css-grid/#typedef-fixed-size

New syntax is:

<fixed-size> =

<fixed-breadth> |
minmax( <fixed-breadth> , <track-breadth> ) |
minmax( <inflexible-breadth> , <fixed-breadth> )

This means that it's enough to have one <fixed-breadth>,
it doesn't matter if it's as minimum or maximum.
Before it was required that the minimum was fixed.

  • css/CSSParser.cpp:

(WebCore::isGridTrackFixedSized):

  • rendering/RenderGrid.cpp:

(WebCore::RenderGrid::computeAutoRepeatTracksCount):

LayoutTests:

Updated test to check the new expected behavior.

  • fast/css-grid-layout/grid-element-auto-repeat-get-set-expected.txt:
  • fast/css-grid-layout/grid-element-auto-repeat-get-set.html:
Location:
trunk
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r201397 r201399  
     12016-05-25  Manuel Rego Casasnovas  <rego@igalia.com>
     2
     3        [css-grid] Update <fixed-size> syntax
     4        https://bugs.webkit.org/show_bug.cgi?id=158063
     5
     6        Reviewed by Darin Adler.
     7
     8        Updated test to check the new expected behavior.
     9
     10        * fast/css-grid-layout/grid-element-auto-repeat-get-set-expected.txt:
     11        * fast/css-grid-layout/grid-element-auto-repeat-get-set.html:
     12
    1132016-05-25  Zalan Bujtas  <zalan@apple.com>
    214
  • trunk/LayoutTests/fast/css-grid-layout/grid-element-auto-repeat-get-set-expected.txt

    r200821 r201399  
    1616PASS element.style.gridTemplateColumns is "repeat(auto-fill, minmax(50px, 100px)) 250px 250px"
    1717PASS getComputedStyle(element, '').getPropertyValue('grid-template-rows') is "450px 50px [bar] 50px [bar foo] 10px [foo] 10px"
    18 PASS element.style.gridTemplateRows is "450px repeat(auto-fill, minmax(5em, -webkit-max-content) [bar]) [foo] 1em [foo] 1em"
     18PASS element.style.gridTemplateRows is "450px repeat(auto-fill, minmax(-webkit-max-content, 5em) [bar]) [foo] 1em [foo] 1em"
    1919PASS getComputedStyle(element, '').getPropertyValue('grid-template-columns') is "[start] 80px [foo bar] 200px [foo bar] 200px [foo bar] 200px [end]"
    2020PASS element.style.gridTemplateColumns is "[start] 10% repeat(auto-fill, [foo bar] 200px) [end]"
     
    5757PASS window.getComputedStyle(element, '').getPropertyValue('grid-template-columns') is "none"
    5858PASS window.getComputedStyle(element, '').getPropertyValue('grid-template-columns') is "none"
    59 PASS window.getComputedStyle(element, '').getPropertyValue('grid-template-columns') is "none"
    60 PASS window.getComputedStyle(element, '').getPropertyValue('grid-template-columns') is "none"
    6159PASS successfullyParsed is true
    6260
  • trunk/LayoutTests/fast/css-grid-layout/grid-element-auto-repeat-get-set.html

    r200618 r201399  
    1414    testGridTemplatesSetJSValues("repeat(auto-fill, [foo bar] 200px)", "repeat(auto-fill, 20em [foo bar])", "[foo bar] 200px [foo bar] 200px [foo bar] 200px [foo bar] 200px", "200px [foo bar] 200px [foo bar] 200px [foo bar]");
    1515    testGridTemplatesSetJSValues("repeat(auto-fill, [foo bar] minmax(300px, 1fr))", "repeat(auto-fill, [foo] minmax(175px, -webkit-max-content) [bar])", "[foo bar] 400px [foo bar] 400px", "[foo] 175px [bar foo] 175px [bar foo] 175px [bar]");
    16     testGridTemplatesSetJSValues("repeat(auto-fill, minmax(50px, 100px)) repeat(2, 250px)", "repeat(1, 450px) repeat(auto-fill, minmax(5em, -webkit-max-content) [bar]) repeat(2, [foo] 1em)", "100px 100px 100px 250px 250px", "450px 50px [bar] 50px [bar foo] 10px [foo] 10px", "repeat(auto-fill, minmax(50px, 100px)) 250px 250px", "450px repeat(auto-fill, minmax(5em, -webkit-max-content) [bar]) [foo] 1em [foo] 1em");
     16    testGridTemplatesSetJSValues("repeat(auto-fill, minmax(50px, 100px)) repeat(2, 250px)", "repeat(1, 450px) repeat(auto-fill, minmax(-webkit-max-content, 5em) [bar]) repeat(2, [foo] 1em)", "100px 100px 100px 250px 250px", "450px 50px [bar] 50px [bar foo] 10px [foo] 10px", "repeat(auto-fill, minmax(50px, 100px)) 250px 250px", "450px repeat(auto-fill, minmax(-webkit-max-content, 5em) [bar]) [foo] 1em [foo] 1em");
    1717    testGridTemplatesSetJSValues("[start] 10% repeat(auto-fill, [foo bar] 200px) [end]", "75px [prev] repeat(auto-fill, 20em [foo bar]) [next] 15em [last end]", "[start] 80px [foo bar] 200px [foo bar] 200px [foo bar] 200px [end]", "75px [prev] 200px [foo bar next] 150px [last end]");
    1818    testGridTemplatesSetJSValues("repeat(auto-fit, [foo bar] 150px)", "repeat(auto-fit, 24em [foo bar])", "none", "none");
     
    3131
    3232    testInvalidSyntax("repeat(auto-fill, 1fr)");
    33     testInvalidSyntax("repeat(auto-fill, minmax(-webkit-min-content, 20px))");
    3433    testInvalidSyntax("repeat(auto-fill, [bar] auto)");
    3534    testInvalidSyntax("repeat(auto-fill, 20px 10px)");
     
    3837    testInvalidSyntax("repeat(auto-fill, [foo])");
    3938    testInvalidSyntax("repeat(auto-fit, 1fr)");
    40     testInvalidSyntax("repeat(auto-fit, minmax(-webkit-min-content, 20px))");
    4139    testInvalidSyntax("repeat(auto-fit, [bar] auto)");
    4240    testInvalidSyntax("repeat(auto-fit, 20px 10px)");
  • trunk/Source/WebCore/ChangeLog

    r201398 r201399  
     12016-05-25  Manuel Rego Casasnovas  <rego@igalia.com>
     2
     3        [css-grid] Update <fixed-size> syntax
     4        https://bugs.webkit.org/show_bug.cgi?id=158063
     5
     6        Reviewed by Darin Adler.
     7
     8        The syntax for <fixed-size> has been updated on the spec:
     9        https://drafts.csswg.org/css-grid/#typedef-fixed-size
     10
     11        New syntax is:
     12          <fixed-size> =
     13            <fixed-breadth> |
     14            minmax( <fixed-breadth> , <track-breadth> ) |
     15            minmax( <inflexible-breadth> , <fixed-breadth> )
     16
     17        This means that it's enough to have one <fixed-breadth>,
     18        it doesn't matter if it's as minimum or maximum.
     19        Before it was required that the minimum was fixed.
     20
     21        * css/CSSParser.cpp:
     22        (WebCore::isGridTrackFixedSized):
     23        * rendering/RenderGrid.cpp:
     24        (WebCore::RenderGrid::computeAutoRepeatTracksCount):
     25
    1262016-05-25  Alex Christensen  <achristensen@webkit.org>
    227
  • trunk/Source/WebCore/css/CSSParser.cpp

    r201382 r201399  
    58185818}
    58195819
     5820static bool isGridTrackFixedSized(const CSSPrimitiveValue& value)
     5821{
     5822    CSSValueID valueID = value.getValueID();
     5823    if (valueID == CSSValueWebkitMinContent || valueID == CSSValueWebkitMaxContent || valueID == CSSValueAuto || value.isFlex())
     5824        return false;
     5825
     5826    ASSERT(value.isLength() || value.isPercentage() || value.isCalculated());
     5827    return true;
     5828}
     5829
    58205830static bool isGridTrackFixedSized(const CSSValue& value)
    58215831{
    5822     ASSERT(value.isPrimitiveValue() || (value.isFunctionValue() && downcast<CSSFunctionValue>(value).arguments()));
    5823     const auto& primitiveValue = value.isPrimitiveValue()
    5824         ? downcast<CSSPrimitiveValue>(value)
    5825         : downcast<CSSPrimitiveValue>(*downcast<CSSFunctionValue>(value).arguments()->item(0));
    5826     CSSValueID valueID = primitiveValue.getValueID();
    5827     if (valueID == CSSValueWebkitMinContent || valueID == CSSValueWebkitMaxContent || valueID == CSSValueAuto || primitiveValue.isFlex())
    5828         return false;
    5829 
    5830     ASSERT(primitiveValue.isLength() || primitiveValue.isPercentage() || primitiveValue.isCalculated());
    5831     return true;
     5832    if (value.isPrimitiveValue())
     5833        return isGridTrackFixedSized(downcast<CSSPrimitiveValue>(value));
     5834
     5835    ASSERT(value.isFunctionValue());
     5836    ASSERT(downcast<CSSFunctionValue>(value).arguments());
     5837    ASSERT(downcast<CSSFunctionValue>(value).arguments()->length() == 2);
     5838
     5839    auto& min = downcast<CSSPrimitiveValue>(*downcast<CSSFunctionValue>(value).arguments()->item(0));
     5840    auto& max = downcast<CSSPrimitiveValue>(*downcast<CSSFunctionValue>(value).arguments()->item(1));
     5841    return isGridTrackFixedSized(min) || isGridTrackFixedSized(max);
    58325842}
    58335843
  • trunk/Source/WebCore/rendering/RenderGrid.cpp

    r201379 r201399  
    12281228    auto autoTrackSize = autoRepeatTracks.at(0);
    12291229    ASSERT(autoTrackSize.minTrackBreadth().isLength());
    1230     ASSERT(!autoTrackSize.minTrackBreadth().isContentSized());
     1230    ASSERT(!autoTrackSize.minTrackBreadth().isFlex());
    12311231
    12321232    Optional<LayoutUnit> availableSize = isRowAxis ? availableLogicalWidth() : computeContentLogicalHeight(MainOrPreferredSize, style().logicalHeight(), Nullopt);
Note: See TracChangeset for help on using the changeset viewer.