Index: Source/core/css/CSSParser.cpp |
diff --git a/Source/core/css/CSSParser.cpp b/Source/core/css/CSSParser.cpp |
index 7fc56703e0ac30392f93629a398a3faab28a06d3..6c82615a4866997f73af890955689698c48c2408 100644 |
--- a/Source/core/css/CSSParser.cpp |
+++ b/Source/core/css/CSSParser.cpp |
@@ -4595,24 +4595,34 @@ bool CSSParser::parseGridTrackList(CSSPropertyID propId, bool important) |
} |
RefPtr<CSSValueList> values = CSSValueList::createSpaceSeparated(); |
- size_t currentLineNumber = 0; |
+ // 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(); |
+ } |
+ |
+ bool seenTrackSize = false; |
while (m_valueList->current()) { |
+ RefPtr<CSSPrimitiveValue> primitiveValue = parseGridTrackSize(); |
+ if (!primitiveValue) |
+ return false; |
+ |
+ seenTrackSize = true; |
+ values->append(primitiveValue.release()); |
+ |
+ // 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 allows trailing <string>* per the specification. |
- if (!m_valueList->current()) |
- break; |
- |
- RefPtr<CSSPrimitiveValue> primitiveValue = parseGridTrackSize(); |
- if (!primitiveValue) |
- return false; |
+ // We should have found a <track-size> or else it is not a valid <track-list> |
+ if (!seenTrackSize) |
+ return false; |
- values->append(primitiveValue.release()); |
- } |
addProperty(propId, values.release(), important); |
return true; |
} |