Index: Source/core/css/CSSParser-in.cpp |
diff --git a/Source/core/css/CSSParser-in.cpp b/Source/core/css/CSSParser-in.cpp |
index 6bd898c69166b374e681b4142276e71149a11ed1..83a7dfdb4591db977053a39fbedff82a05bac0ef 100644 |
--- a/Source/core/css/CSSParser-in.cpp |
+++ b/Source/core/css/CSSParser-in.cpp |
@@ -4764,6 +4764,26 @@ bool CSSParser::parseSingleGridAreaLonghand(RefPtr<CSSValue>& property) |
return true; |
} |
+static inline bool isOpenParenthesisOperator(CSSParserValue* value) |
+{ |
+ return value->unit == CSSParserValue::Operator && value->iValue == '('; |
+} |
+ |
+void CSSParser::parseGridLineNames(CSSParserValueList* parserValueList, CSSValueList& valueList) |
+{ |
+ ASSERT(isOpenParenthesisOperator(parserValueList->current())); |
+ parserValueList->next(); // skip '(' |
+ |
+ while (parserValueList->current() && parserValueList->current()->unit == CSSPrimitiveValue::CSS_IDENT) { |
+ RefPtr<CSSPrimitiveValue> name = createPrimitiveStringValue(parserValueList->current()); |
+ valueList.append(name); |
+ parserValueList->next(); |
+ } |
+ |
+ ASSERT(parserValueList->current()->unit == CSSParserValue::Operator && parserValueList->current()->iValue == ')'); |
+ parserValueList->next(); // skip ')' |
+} |
+ |
bool CSSParser::parseGridTrackList(CSSPropertyID propId, bool important) |
{ |
ASSERT(RuntimeEnabledFeatures::cssGridLayoutEnabled()); |
@@ -4778,12 +4798,10 @@ bool CSSParser::parseGridTrackList(CSSPropertyID propId, bool important) |
} |
RefPtr<CSSValueList> values = CSSValueList::createSpaceSeparated(); |
- // Handle leading <string>*. |
- while (m_valueList->current() && m_valueList->current()->unit == CSSPrimitiveValue::CSS_STRING) { |
- RefPtr<CSSPrimitiveValue> name = createPrimitiveStringValue(m_valueList->current()); |
- values->append(name); |
- m_valueList->next(); |
- } |
+ // Handle leading <ident>*. |
+ value = m_valueList->current(); |
+ if (value && isOpenParenthesisOperator(value)) |
+ parseGridLineNames(m_valueList.get(), *values); |
bool seenTrackSizeOrRepeatFunction = false; |
while (CSSParserValue* currentValue = m_valueList->current()) { |
@@ -4798,13 +4816,10 @@ bool CSSParser::parseGridTrackList(CSSPropertyID propId, bool important) |
values->append(value); |
seenTrackSizeOrRepeatFunction = true; |
} |
- |
- // This will handle the trailing <string>* in the grammar. |
- while (m_valueList->current() && m_valueList->current()->unit == CSSPrimitiveValue::CSS_STRING) { |
- RefPtr<CSSPrimitiveValue> name = createPrimitiveStringValue(m_valueList->current()); |
- values->append(name); |
- m_valueList->next(); |
- } |
+ // This will handle the trailing <ident>* in the grammar. |
+ value = m_valueList->current(); |
+ if (value && isOpenParenthesisOperator(value)) |
+ parseGridLineNames(m_valueList.get(), *values); |
} |
// We should have found a <track-size> or else it is not a valid <track-list> |
@@ -4827,12 +4842,10 @@ bool CSSParser::parseGridTrackRepeatFunction(CSSValueList& list) |
arguments->next(); // Skip the repetition count. |
arguments->next(); // Skip the comma. |
- // Handle leading <string>*. |
- while (arguments->current() && arguments->current()->unit == CSSPrimitiveValue::CSS_STRING) { |
- RefPtr<CSSPrimitiveValue> name = createPrimitiveStringValue(arguments->current()); |
- repeatedValues->append(name); |
- arguments->next(); |
- } |
+ // Handle leading <ident>*. |
+ CSSParserValue* currentValue = arguments->current(); |
+ if (currentValue && isOpenParenthesisOperator(currentValue)) |
+ parseGridLineNames(arguments, *repeatedValues); |
while (CSSParserValue* argumentValue = arguments->current()) { |
RefPtr<CSSValue> trackSize = parseGridTrackSize(*arguments); |
@@ -4841,12 +4854,10 @@ bool CSSParser::parseGridTrackRepeatFunction(CSSValueList& list) |
repeatedValues->append(trackSize); |
- // This takes care of any trailing <string>* in the grammar. |
- while (arguments->current() && arguments->current()->unit == CSSPrimitiveValue::CSS_STRING) { |
- RefPtr<CSSPrimitiveValue> name = createPrimitiveStringValue(arguments->current()); |
- repeatedValues->append(name); |
- arguments->next(); |
- } |
+ // This takes care of any trailing <ident>* in the grammar. |
+ currentValue = arguments->current(); |
+ if (currentValue && isOpenParenthesisOperator(currentValue)) |
+ parseGridLineNames(arguments, *repeatedValues); |
} |
for (size_t i = 0; i < repetitions; ++i) { |