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

Unified Diff: Source/core/css/parser/CSSPropertyParser.cpp

Issue 333563003: [CSS Grid Layout] Update grid-auto-flow to the new syntax (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Small fix in add/removeChild to avoid dirtying the grid in stack Created 6 years, 6 months 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/parser/CSSPropertyParser.cpp
diff --git a/Source/core/css/parser/CSSPropertyParser.cpp b/Source/core/css/parser/CSSPropertyParser.cpp
index 0f64e8b04e4e68bc22e4b5e1229ac272f041f273..28cea5b83aa054e79b99f34ddbf95e77b4dbdda1 100644
--- a/Source/core/css/parser/CSSPropertyParser.cpp
+++ b/Source/core/css/parser/CSSPropertyParser.cpp
@@ -1197,6 +1197,11 @@ bool CSSPropertyParser::parseValue(CSSPropertyID propId, bool important)
return false;
return parseItemPositionOverflowPosition(propId, important);
+ case CSSPropertyGridAutoFlow:
+ if (!RuntimeEnabledFeatures::cssGridLayoutEnabled())
+ return false;
+ parsedValue = parseGridAutoFlow(*m_valueList);
+ break;
case CSSPropertyGridAutoColumns:
case CSSPropertyGridAutoRows:
if (!RuntimeEnabledFeatures::cssGridLayoutEnabled())
@@ -1570,7 +1575,6 @@ bool CSSPropertyParser::parseValue(CSSPropertyID propId, bool important)
case CSSPropertyJustifyContent:
case CSSPropertyFontKerning:
case CSSPropertyWebkitFontSmoothing:
- case CSSPropertyGridAutoFlow:
case CSSPropertyWebkitLineBreak:
case CSSPropertyWebkitMarginAfterCollapse:
case CSSPropertyWebkitMarginBeforeCollapse:
@@ -3553,15 +3557,13 @@ bool CSSPropertyParser::parseGridShorthand(bool important)
m_valueList->setCurrentIndex(0);
// 2- <grid-auto-flow> [ <grid-auto-columns> [ / <grid-auto-rows> ]? ]
- CSSValueID id = m_valueList->current()->id;
- if (id != CSSValueRow && id != CSSValueColumn && id != CSSValueNone)
+ if (!parseValue(CSSPropertyGridAutoFlow, important))
return false;
- RefPtrWillBeRawPtr<CSSValue> autoFlowValue = cssValuePool().createIdentifierValue(id);
RefPtrWillBeRawPtr<CSSValue> autoColumnsValue = nullptr;
RefPtrWillBeRawPtr<CSSValue> autoRowsValue = nullptr;
- if (m_valueList->next()) {
+ if (m_valueList->current()) {
autoColumnsValue = parseGridTrackSize(*m_valueList);
if (!autoColumnsValue)
return false;
@@ -3584,7 +3586,6 @@ bool CSSPropertyParser::parseGridShorthand(bool important)
if (!autoRowsValue)
autoRowsValue = autoColumnsValue;
- addProperty(CSSPropertyGridAutoFlow, autoFlowValue, important);
addProperty(CSSPropertyGridAutoColumns, autoColumnsValue, important);
addProperty(CSSPropertyGridAutoRows, autoRowsValue, important);
@@ -3904,6 +3905,50 @@ PassRefPtrWillBeRawPtr<CSSValue> CSSPropertyParser::parseGridTemplateAreas()
return CSSGridTemplateAreasValue::create(gridAreaMap, rowCount, columnCount);
}
+PassRefPtrWillBeRawPtr<CSSValue> CSSPropertyParser::parseGridAutoFlow(CSSParserValueList& list)
+{
+ // [ row | column ] && dense? | stack && [ row | column ]?
+ ASSERT(RuntimeEnabledFeatures::cssGridLayoutEnabled());
+
+ CSSParserValue* value = list.current();
+ if (!value)
+ return nullptr;
+
+ RefPtrWillBeRawPtr<CSSValueList> parsedValues = CSSValueList::createSpaceSeparated();
+
+ // First parameter.
+ CSSValueID firstId = value->id;
+ if (value->id != CSSValueRow && value->id != CSSValueColumn && value->id != CSSValueDense && value->id != CSSValueStack)
Julien - ping for review 2014/06/27 17:44:53 Nit: firstId->id !=
Manuel Rego 2014/06/27 22:43:51 Yeah, I changed value->id by firstId.
+ return nullptr;
+ parsedValues->append(cssValuePool().createIdentifierValue(value->id));
+
+ // Second parameter, if any.
+ value = list.next();
+ if (!value && firstId == CSSValueDense)
+ return nullptr;
+
+ if (value) {
+ switch (firstId) {
+ case CSSValueRow:
+ case CSSValueColumn:
+ if (value->id != CSSValueDense && value->id != CSSValueStack)
+ return parsedValues;
Julien - ping for review 2014/06/27 17:44:53 I assume this is needed for the 'grid' shorthand b
Manuel Rego 2014/06/27 22:43:51 I had one "column column" that was an invalid valu
+ break;
+ case CSSValueDense:
+ case CSSValueStack:
+ if (value->id != CSSValueRow && value->id != CSSValueColumn)
+ return parsedValues;
Julien - ping for review 2014/06/27 17:44:53 Same comment.
+ break;
+ default:
+ return parsedValues;
+ }
+ parsedValues->append(cssValuePool().createIdentifierValue(value->id));
+ list.next();
+ }
+
+ return parsedValues;
+}
+
PassRefPtrWillBeRawPtr<CSSValue> CSSPropertyParser::parseCounterContent(CSSParserValueList* args, bool counters)
{
unsigned numArgs = args->size();

Powered by Google App Engine
This is Rietveld 408576698