diff --git a/layout/style/nsCSSParser.cpp b/layout/style/nsCSSParser.cpp index 93b03963ce73..85d84c20d51d 100644 --- a/layout/style/nsCSSParser.cpp +++ b/layout/style/nsCSSParser.cpp @@ -962,6 +962,8 @@ protected: // and alternating between that and . bool ParseGridTrackListWithFirstLineNames(nsCSSValue& aValue, const nsCSSValue& aFirstLineNames); + + bool ParseGridTrackList(nsCSSProperty aPropID); bool ParseGridTemplateColumnsRows(nsCSSProperty aPropID); // |aAreaIndices| is a lookup table to help us parse faster, @@ -8935,6 +8937,19 @@ CSSParserImpl::ParseGridTrackListRepeat(nsCSSValueList** aTailPtr) return true; } +bool +CSSParserImpl::ParseGridTrackList(nsCSSProperty aPropID) +{ + nsCSSValue value; + nsCSSValue firstLineNames; + if (ParseGridLineNames(firstLineNames) == CSSParseResult::Error || + !ParseGridTrackListWithFirstLineNames(value, firstLineNames)) { + return false; + } + AppendValue(aPropID, value); + return true; +} + bool CSSParserImpl::ParseGridTemplateColumnsRows(nsCSSProperty aPropID) { @@ -8960,13 +8975,7 @@ CSSParserImpl::ParseGridTemplateColumnsRows(nsCSSProperty aPropID) UngetToken(); } - nsCSSValue firstLineNames; - if (ParseGridLineNames(firstLineNames) == CSSParseResult::Error || - !ParseGridTrackListWithFirstLineNames(value, firstLineNames)) { - return false; - } - AppendValue(aPropID, value); - return true; + return ParseGridTrackList(aPropID); } bool @@ -9160,14 +9169,9 @@ CSSParserImpl::ParseGridTemplate() } // Parse an optional [ / ] as the columns value. if (ExpectSymbol('/', true)) { - nsCSSValue lineNames; - if (ParseGridLineNames(lineNames) == CSSParseResult::Error || - !ParseGridTrackListWithFirstLineNames(value, lineNames)) { - return false; - } - } else { - value.SetNoneValue(); // absent means 'none' + return ParseGridTrackList(eCSSProperty_grid_template_columns); } + value.SetNoneValue(); // absent means 'none' AppendValue(eCSSProperty_grid_template_columns, value); return true; }