Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(329)

Unified Diff: Source/core/css/CSSParser-in.cpp

Issue 23528004: [CSS Grid Layout] Update named grid lines syntax to the last version of the specs (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@named
Patch Set: Added empty track-name list test case Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: Source/core/css/CSSParser-in.cpp
diff --git a/Source/core/css/CSSParser-in.cpp b/Source/core/css/CSSParser-in.cpp
index 0eb6b090ef03304d54efc9b6f834f83220f072c7..a2c2217bb96b66171e54db61e4f2412f6f644722 100644
--- a/Source/core/css/CSSParser-in.cpp
+++ b/Source/core/css/CSSParser-in.cpp
@@ -4811,6 +4811,20 @@ bool CSSParser::parseSingleGridAreaLonghand(RefPtr<CSSValue>& property)
return true;
}
+void CSSParser::parseGridTrackNames(CSSParserValueList* parserValueList, CSSValueList& valueList)
+{
+ ASSERT(parserValueList->current() && parserValueList->current()->unit == CSSParserValue::ValueList);
+
+ CSSParserValueList* trackNames = parserValueList->current()->valueList;
+ while (trackNames->current() && trackNames->current()->unit == CSSPrimitiveValue::CSS_IDENT) {
+ RefPtr<CSSPrimitiveValue> name = createPrimitiveStringValue(trackNames->current());
+ valueList.append(name);
+ trackNames->next();
+ }
+
+ parserValueList->next();
+}
+
bool CSSParser::parseGridTrackList(CSSPropertyID propId, bool important)
{
ASSERT(RuntimeEnabledFeatures::cssGridLayoutEnabled());
@@ -4825,12 +4839,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 && value->unit == CSSParserValue::ValueList)
+ parseGridTrackNames(m_valueList.get(), *values);
bool seenTrackSizeOrRepeatFunction = false;
while (CSSParserValue* currentValue = m_valueList->current()) {
@@ -4845,13 +4857,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 && value->unit == CSSParserValue::ValueList)
+ parseGridTrackNames(m_valueList.get(), *values);
}
// We should have found a <track-size> or else it is not a valid <track-list>
@@ -4874,12 +4883,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 && currentValue->unit == CSSParserValue::ValueList)
+ parseGridTrackNames(arguments, *repeatedValues);
while (arguments->current()) {
RefPtr<CSSValue> trackSize = parseGridTrackSize(*arguments);
@@ -4888,12 +4895,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 && currentValue->unit == CSSParserValue::ValueList)
+ parseGridTrackNames(arguments, *repeatedValues);
}
for (size_t i = 0; i < repetitions; ++i) {

Powered by Google App Engine
This is Rietveld 408576698