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

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

Issue 1813763003: Move the grid-area shorthand into CSSPropertyParser (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Patch for landing Created 4 years, 9 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: third_party/WebKit/Source/core/css/parser/CSSPropertyParser.cpp
diff --git a/third_party/WebKit/Source/core/css/parser/CSSPropertyParser.cpp b/third_party/WebKit/Source/core/css/parser/CSSPropertyParser.cpp
index 3fd81406fd2c62285fd53822d4d9d94ebbcec537..ebad2a6608fa008650c88659a11d7dbbb2fcf582 100644
--- a/third_party/WebKit/Source/core/css/parser/CSSPropertyParser.cpp
+++ b/third_party/WebKit/Source/core/css/parser/CSSPropertyParser.cpp
@@ -4213,6 +4213,47 @@ bool CSSPropertyParser::consumeGridItemPositionShorthand(CSSPropertyID shorthand
return true;
}
+bool CSSPropertyParser::consumeGridAreaShorthand(bool important)
+{
+ ASSERT(RuntimeEnabledFeatures::cssGridLayoutEnabled());
+ ASSERT(gridAreaShorthand().length() == 4);
+ RefPtrWillBeRawPtr<CSSValue> rowStartValue = consumeGridLine(m_range);
+ if (!rowStartValue)
+ return false;
+ RefPtrWillBeRawPtr<CSSValue> columnStartValue = nullptr;
+ RefPtrWillBeRawPtr<CSSValue> rowEndValue = nullptr;
+ RefPtrWillBeRawPtr<CSSValue> columnEndValue = nullptr;
+ if (consumeSlashIncludingWhitespace(m_range)) {
+ columnStartValue = consumeGridLine(m_range);
+ if (!columnStartValue)
+ return false;
+ if (consumeSlashIncludingWhitespace(m_range)) {
+ rowEndValue = consumeGridLine(m_range);
+ if (!rowEndValue)
+ return false;
+ if (consumeSlashIncludingWhitespace(m_range)) {
+ columnEndValue = consumeGridLine(m_range);
+ if (!columnEndValue)
+ return false;
+ }
+ }
+ }
+ if (!m_range.atEnd())
+ return false;
+ if (!columnStartValue)
+ columnStartValue = rowStartValue->isCustomIdentValue() ? rowStartValue : cssValuePool().createIdentifierValue(CSSValueAuto);
+ if (!rowEndValue)
+ rowEndValue = rowStartValue->isCustomIdentValue() ? rowStartValue : cssValuePool().createIdentifierValue(CSSValueAuto);
+ if (!columnEndValue)
+ columnEndValue = columnStartValue->isCustomIdentValue() ? columnStartValue : cssValuePool().createIdentifierValue(CSSValueAuto);
+
+ addProperty(CSSPropertyGridRowStart, rowStartValue, important);
+ addProperty(CSSPropertyGridColumnStart, columnStartValue, important);
+ addProperty(CSSPropertyGridRowEnd, rowEndValue, important);
+ addProperty(CSSPropertyGridColumnEnd, columnEndValue, important);
+ return true;
+}
+
bool CSSPropertyParser::parseShorthand(CSSPropertyID unresolvedProperty, bool important)
{
CSSPropertyID property = resolveCSSPropertyID(unresolvedProperty);
@@ -4393,6 +4434,8 @@ bool CSSPropertyParser::parseShorthand(CSSPropertyID unresolvedProperty, bool im
case CSSPropertyGridColumn:
case CSSPropertyGridRow:
return consumeGridItemPositionShorthand(property, important);
+ case CSSPropertyGridArea:
+ return consumeGridAreaShorthand(important);
default:
m_currentShorthand = oldShorthand;
CSSParserValueList valueList(m_range);

Powered by Google App Engine
This is Rietveld 408576698