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

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: Patch for landing v2 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
« no previous file with comments | « Source/core/css/CSSParser.h ('k') | Source/core/css/CSSParserValues.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..40a4979cbf9f4abff7bdbcd061ea4f2c9b79b012 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();
+ while (CSSParserValue* identValue = identList->current()) {
+ ASSERT(identValue->unit == CSSPrimitiveValue::CSS_IDENT);
+ RefPtr<CSSPrimitiveValue> lineName = createPrimitiveStringValue(identValue);
+ lineNames->append(lineName.release());
+ identList->next();
+ }
+ 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) {
« no previous file with comments | « Source/core/css/CSSParser.h ('k') | Source/core/css/CSSParserValues.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698