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

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

Issue 2737843003: [css-align] Implement place-items alignment shorthand (Closed)
Patch Set: More layout tests fixes. Created 3 years, 8 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 fc9cd344d825c5cbdb9e86fe2b5d34352f04abd6..010d851a6c6ed1e305db9a7d5d8e43dfd1f7e216 100644
--- a/third_party/WebKit/Source/core/css/parser/CSSPropertyParser.cpp
+++ b/third_party/WebKit/Source/core/css/parser/CSSPropertyParser.cpp
@@ -3304,6 +3304,36 @@ bool CSSPropertyParser::consumePlaceContentShorthand(bool important) {
return true;
}
+bool CSSPropertyParser::consumePlaceItemsShorthand(bool important) {
+ DCHECK(RuntimeEnabledFeatures::cssGridLayoutEnabled());
+ DCHECK_EQ(shorthandForProperty(CSSPropertyPlaceContent).length(),
+ static_cast<unsigned>(2));
+
+ // align-items property does not allow the 'auto' value.
+ if (identMatches<CSSValueAuto>(m_range.peek().id()))
+ return false;
+
+ CSSValue* alignItemsValue =
+ CSSPropertyAlignmentUtils::consumeSimplifiedItemPosition(m_range);
+ if (!alignItemsValue)
+ return false;
+ CSSValue* justifyItemsValue =
+ m_range.atEnd()
+ ? alignItemsValue
+ : CSSPropertyAlignmentUtils::consumeSimplifiedItemPosition(m_range);
+ if (!justifyItemsValue)
+ return false;
+
+ if (!m_range.atEnd())
+ return false;
+
+ addProperty(CSSPropertyAlignItems, CSSPropertyPlaceItems, *alignItemsValue,
+ important);
+ addProperty(CSSPropertyJustifyItems, CSSPropertyPlaceItems,
+ *justifyItemsValue, important);
+ return true;
+}
+
bool CSSPropertyParser::parseShorthand(CSSPropertyID unresolvedProperty,
bool important) {
CSSPropertyID property = resolveCSSPropertyID(unresolvedProperty);
@@ -3565,6 +3595,8 @@ bool CSSPropertyParser::parseShorthand(CSSPropertyID unresolvedProperty,
return consumeGridShorthand(important);
case CSSPropertyPlaceContent:
return consumePlaceContentShorthand(important);
+ case CSSPropertyPlaceItems:
+ return consumePlaceItemsShorthand(important);
default:
return false;
}

Powered by Google App Engine
This is Rietveld 408576698