Ignore:
Timestamp:
May 25, 2016, 7:44:48 AM (10 years ago)
Author:
Manuel Rego Casasnovas
Message:

[css-grid] Simplify grid track sizes parsing
https://bugs.webkit.org/show_bug.cgi?id=158021

Reviewed by Sergio Villar Senin.

Previously once we saw an auto-repeat function,
we passed the "FixedSizeOnly" restriction to the rest of methods.
That way we were sure that all the tracks after the auto-repeat
had fixed sizes.
But we needed to call allTracksAreFixedSized() to be sure that
the tracks before the auto-repeat had fixed sizes too.

Now we're introducing a new boolean |allTracksAreFixedSized|,
to check in advance if the declaration contains any track not fixed.
If that's the case and we found an auto-repeat method,
we consider it invalid.
With this approach we avoid the loop to verify
that all the tracks (before and after the auto-repeat) are fixed.
It also allows us to simplify the code and avoid passing
the restriction to all the methods parsing the track size.

No new tests, no change of behavior.

  • css/CSSParser.cpp:

(WebCore::isGridTrackFixedSized): New method to check if a grid track
size is fixed or not (based on old allTracksAreFixedSized()).
(WebCore::CSSParser::parseGridTrackList): Add new boolean to detect
if any track has not a fixed size.
(WebCore::CSSParser::parseGridTrackRepeatFunction): Ditto.
(WebCore::CSSParser::parseGridTrackSize): Remove usage of
TrackSizeRestriction enum.
Check here if |minTrackBreadth| is a flexible size.
(WebCore::CSSParser::parseGridBreadth): Remove usage of
TrackSizeRestriction enum.
(WebCore::allTracksAreFixedSized): Deleted.

  • css/CSSParser.h: Remove TrackSizeRestriction enum and update headers.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/css/CSSParser.h

    r201378 r201382  
    240240    bool parseSingleGridAreaLonghand(RefPtr<CSSValue>&);
    241241    RefPtr<CSSValue> parseGridTrackList();
    242     bool parseGridTrackRepeatFunction(CSSValueList&, bool& isAutoRepeat);
    243     enum TrackSizeRestriction { FixedSizeOnly, InflexibleSizeOnly, AllowAll };
    244     RefPtr<CSSValue> parseGridTrackSize(CSSParserValueList& inputList, TrackSizeRestriction = AllowAll);
    245     RefPtr<CSSPrimitiveValue> parseGridBreadth(CSSParserValue&, TrackSizeRestriction = AllowAll);
     242    bool parseGridTrackRepeatFunction(CSSValueList&, bool& isAutoRepeat, bool& allTracksAreFixedSized);
     243    RefPtr<CSSValue> parseGridTrackSize(CSSParserValueList& inputList);
     244    RefPtr<CSSPrimitiveValue> parseGridBreadth(CSSParserValue&);
    246245    bool parseGridTemplateAreasRow(NamedGridAreaMap&, const unsigned, unsigned&);
    247246    RefPtr<CSSValue> parseGridTemplateAreas();
Note: See TracChangeset for help on using the changeset viewer.