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..29ecbbdabe2a2da1da334431342a06099da6bed3 100644 |
--- a/Source/core/css/CSSParser-in.cpp |
+++ b/Source/core/css/CSSParser-in.cpp |
@@ -41,6 +41,7 @@ |
#include "core/css/CSSFontFeatureValue.h" |
#include "core/css/CSSFunctionValue.h" |
#include "core/css/CSSGradientValue.h" |
+#include "core/css/CSSGridLineNamesValue.h" |
#include "core/css/CSSGridTemplateValue.h" |
#include "core/css/CSSImageSetValue.h" |
#include "core/css/CSSImageValue.h" |
@@ -4811,6 +4812,28 @@ bool CSSParser::parseSingleGridAreaLonghand(RefPtr<CSSValue>& property) |
return true; |
} |
+void CSSParser::parseGridLineNames(CSSParserValueList* parserValueList, CSSValueList& valueList) |
+{ |
+ ASSERT(parserValueList->current() && parserValueList->current()->unit == CSSParserValue::ValueList); |
+ |
+ CSSParserValueList* identList = parserValueList->current()->valueList; |
+ if (!identList->size()) { |
+ parserValueList->next(); |
+ return; |
+ } |
+ |
+ RefPtr<CSSGridLineNamesValue> lineNames = CSSGridLineNamesValue::create(); |
+ do { |
+ ASSERT(identList->current()->unit == CSSPrimitiveValue::CSS_IDENT); |
+ RefPtr<CSSPrimitiveValue> lineName = createPrimitiveStringValue(identList->current()); |
+ lineNames->append(lineName.release()); |
+ identList->next(); |
+ } while (identList->current()); |
Julien - ping for review
2013/11/21 22:50:35
I would still use a while here as it would easily
|
+ valueList.append(lineNames.release()); |
+ |
+ parserValueList->next(); |
+} |
+ |
bool CSSParser::parseGridTrackList(CSSPropertyID propId, bool important) |
{ |
ASSERT(RuntimeEnabledFeatures::cssGridLayoutEnabled()); |
@@ -4825,12 +4848,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) |
+ parseGridLineNames(m_valueList.get(), *values); |
bool seenTrackSizeOrRepeatFunction = false; |
while (CSSParserValue* currentValue = m_valueList->current()) { |
@@ -4845,13 +4866,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) |
+ parseGridLineNames(m_valueList.get(), *values); |
} |
// We should have found a <track-size> or else it is not a valid <track-list> |
@@ -4874,12 +4892,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) |
+ parseGridLineNames(arguments, *repeatedValues); |
while (arguments->current()) { |
RefPtr<CSSValue> trackSize = parseGridTrackSize(*arguments); |
@@ -4888,12 +4904,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) |
+ parseGridLineNames(arguments, *repeatedValues); |
} |
for (size_t i = 0; i < repetitions; ++i) { |