Ignore:
Timestamp:
May 25, 2016, 4:17:38 AM (10 years ago)
Author:
commit-queue@webkit.org
Message:

Unreviewed, rolling out r201373.
https://bugs.webkit.org/show_bug.cgi?id=158064

Several tests are hitting the ASSERT (Requested by rego on
#webkit).

Reverted changeset:

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

File:
1 edited

Legend:

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

    r201373 r201378  
    58185818}
    58195819
    5820 static bool isGridTrackFixedSized(const CSSValue& value)
    5821 {
    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());
     5820static bool allTracksAreFixedSized(CSSValueList& valueList)
     5821{
     5822    for (auto& value : valueList) {
     5823        if (is<CSSGridLineNamesValue>(value))
     5824            continue;
     5825        // The auto-repeat value holds a <fixed-size> = <fixed-breadth> | minmax( <fixed-breadth>, <track-breadth> )
     5826        if (is<CSSGridAutoRepeatValue>(value)) {
     5827            if (!allTracksAreFixedSized(downcast<CSSValueList>(value.get())))
     5828                return false;
     5829            continue;
     5830        }
     5831        ASSERT(value->isPrimitiveValue() || (value->isFunctionValue() && downcast<CSSFunctionValue>(value.get()).arguments()));
     5832        const CSSPrimitiveValue& primitiveValue = value->isPrimitiveValue()
     5833            ? downcast<CSSPrimitiveValue>(value.get())
     5834            : downcast<CSSPrimitiveValue>(*downcast<CSSFunctionValue>(value.get()).arguments()->item(0));
     5835        CSSValueID valueID = primitiveValue.getValueID();
     5836        if (valueID == CSSValueWebkitMinContent || valueID == CSSValueWebkitMaxContent || valueID == CSSValueAuto || primitiveValue.isFlex())
     5837            return false;
     5838    }
    58315839    return true;
    58325840}
     
    58505858    bool seenTrackSizeOrRepeatFunction = false;
    58515859    bool seenAutoRepeat = false;
    5852     bool allTracksAreFixedSized = true;
    58535860    while (CSSParserValue* currentValue = m_valueList->current()) {
    58545861        if (isForwardSlashOperator(*currentValue))
     
    58565863        if (currentValue->unit == CSSParserValue::Function && equalLettersIgnoringASCIICase(currentValue->function->name, "repeat(")) {
    58575864            bool isAutoRepeat;
    5858             if (!parseGridTrackRepeatFunction(values, isAutoRepeat, allTracksAreFixedSized))
     5865            if (!parseGridTrackRepeatFunction(values, isAutoRepeat))
    58595866                return nullptr;
    58605867            if (isAutoRepeat && seenAutoRepeat)
     
    58625869            seenAutoRepeat = seenAutoRepeat || isAutoRepeat;
    58635870        } else {
    5864             RefPtr<CSSValue> value = parseGridTrackSize(*m_valueList);
     5871            RefPtr<CSSValue> value = parseGridTrackSize(*m_valueList, seenAutoRepeat ? FixedSizeOnly : AllowAll);
    58655872            if (!value)
    58665873                return nullptr;
    5867             if (allTracksAreFixedSized)
    5868                 allTracksAreFixedSized = isGridTrackFixedSized(*value);
    58695874            values->append(value.releaseNonNull());
    58705875        }
    58715876        seenTrackSizeOrRepeatFunction = true;
    5872 
    5873         if (seenAutoRepeat && !allTracksAreFixedSized)
    5874             return nullptr;
    58755877
    58765878        // This will handle the trailing <custom-ident>* in the grammar.
     
    58835885        return nullptr;
    58845886
     5887    // <auto-repeat> requires definite minimum track sizes in order to compute the number of repetitions.
     5888    // The above while loop detects those appearances after the <auto-repeat> but not the ones before.
     5889    if (seenAutoRepeat && !allTracksAreFixedSized(values))
     5890        return nullptr;
     5891
    58855892    return WTFMove(values);
    58865893}
    58875894
    5888 bool CSSParser::parseGridTrackRepeatFunction(CSSValueList& list, bool& isAutoRepeat, bool& allTracksAreFixedSized)
     5895bool CSSParser::parseGridTrackRepeatFunction(CSSValueList& list, bool& isAutoRepeat)
    58895896{
    58905897    ASSERT(isCSSGridLayoutEnabled());
     
    59165923
    59175924    unsigned numberOfTracks = 0;
     5925    TrackSizeRestriction restriction = isAutoRepeat ? FixedSizeOnly : AllowAll;
    59185926    while (arguments->current()) {
    59195927        if (isAutoRepeat && numberOfTracks)
    59205928            return false;
    59215929
    5922         RefPtr<CSSValue> trackSize = parseGridTrackSize(*arguments);
     5930        RefPtr<CSSValue> trackSize = parseGridTrackSize(*arguments, restriction);
    59235931        if (!trackSize)
    59245932            return false;
    5925         if (allTracksAreFixedSized)
    5926             allTracksAreFixedSized = isGridTrackFixedSized(*trackSize);
    59275933
    59285934        repeatedValues->append(trackSize.releaseNonNull());
     
    59565962}
    59575963
    5958 RefPtr<CSSValue> CSSParser::parseGridTrackSize(CSSParserValueList& inputList)
     5964RefPtr<CSSValue> CSSParser::parseGridTrackSize(CSSParserValueList& inputList, TrackSizeRestriction restriction)
    59595965{
    59605966    ASSERT(isCSSGridLayoutEnabled());
     
    59725978            return nullptr;
    59735979
    5974         RefPtr<CSSPrimitiveValue> minTrackBreadth = parseGridBreadth(*arguments->valueAt(0));
    5975         if (!minTrackBreadth || minTrackBreadth->isFlex())
     5980        TrackSizeRestriction minTrackBreadthRestriction = restriction == AllowAll ? InflexibleSizeOnly : restriction;
     5981        RefPtr<CSSPrimitiveValue> minTrackBreadth = parseGridBreadth(*arguments->valueAt(0), minTrackBreadthRestriction);
     5982        if (!minTrackBreadth)
    59765983            return nullptr;
    59775984
     
    59865993    }
    59875994
    5988     return parseGridBreadth(currentValue);
    5989 }
    5990 
    5991 RefPtr<CSSPrimitiveValue> CSSParser::parseGridBreadth(CSSParserValue& value)
     5995    return parseGridBreadth(currentValue, restriction);
     5996}
     5997
     5998RefPtr<CSSPrimitiveValue> CSSParser::parseGridBreadth(CSSParserValue& value, TrackSizeRestriction restriction)
    59925999{
    59936000    ASSERT(isCSSGridLayoutEnabled());
    59946001
    5995     if (value.id == CSSValueWebkitMinContent || value.id == CSSValueWebkitMaxContent || value.id == CSSValueAuto)
     6002    if (value.id == CSSValueWebkitMinContent || value.id == CSSValueWebkitMaxContent || value.id == CSSValueAuto) {
     6003        if (restriction == FixedSizeOnly)
     6004            return nullptr;
    59966005        return CSSValuePool::singleton().createIdentifierValue(value.id);
     6006    }
    59976007
    59986008    if (value.unit == CSSPrimitiveValue::CSS_FR) {
     6009        if (restriction == FixedSizeOnly || restriction == InflexibleSizeOnly)
     6010            return nullptr;
     6011
    59996012        double flexValue = value.fValue;
    60006013
Note: See TracChangeset for help on using the changeset viewer.