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

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

Issue 2804623002: [css-align] Implement place-self alignment shorthand (Closed)
Patch Set: Added a regression test. 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 92489f32f86e5c49678f9d4b27be8b1afe59a259..19d6e7221ccd8d77e814bd327435312b7f3cbe94 100644
--- a/third_party/WebKit/Source/core/css/parser/CSSPropertyParser.cpp
+++ b/third_party/WebKit/Source/core/css/parser/CSSPropertyParser.cpp
@@ -3302,7 +3302,7 @@ bool CSSPropertyParser::consumePlaceContentShorthand(bool important) {
bool CSSPropertyParser::consumePlaceItemsShorthand(bool important) {
DCHECK(RuntimeEnabledFeatures::cssGridLayoutEnabled());
- DCHECK_EQ(shorthandForProperty(CSSPropertyPlaceContent).length(),
+ DCHECK_EQ(shorthandForProperty(CSSPropertyPlaceItems).length(),
static_cast<unsigned>(2));
// align-items property does not allow the 'auto' value.
@@ -3330,6 +3330,32 @@ bool CSSPropertyParser::consumePlaceItemsShorthand(bool important) {
return true;
}
+bool CSSPropertyParser::consumePlaceSelfShorthand(bool important) {
+ DCHECK(RuntimeEnabledFeatures::cssGridLayoutEnabled());
+ DCHECK_EQ(shorthandForProperty(CSSPropertyPlaceSelf).length(),
+ static_cast<unsigned>(2));
+
+ CSSValue* alignSelfValue =
+ CSSPropertyAlignmentUtils::consumeSimplifiedItemPosition(m_range);
+ if (!alignSelfValue)
+ return false;
+ CSSValue* justifySelfValue =
+ m_range.atEnd()
+ ? alignSelfValue
+ : CSSPropertyAlignmentUtils::consumeSimplifiedItemPosition(m_range);
+ if (!justifySelfValue)
+ return false;
+
+ if (!m_range.atEnd())
+ return false;
+
+ addProperty(CSSPropertyAlignSelf, CSSPropertyPlaceSelf, *alignSelfValue,
+ important);
+ addProperty(CSSPropertyJustifySelf, CSSPropertyPlaceSelf, *justifySelfValue,
+ important);
+ return true;
+}
+
bool CSSPropertyParser::parseShorthand(CSSPropertyID unresolvedProperty,
bool important) {
CSSPropertyID property = resolveCSSPropertyID(unresolvedProperty);
@@ -3593,6 +3619,8 @@ bool CSSPropertyParser::parseShorthand(CSSPropertyID unresolvedProperty,
return consumePlaceContentShorthand(important);
case CSSPropertyPlaceItems:
return consumePlaceItemsShorthand(important);
+ case CSSPropertyPlaceSelf:
+ return consumePlaceSelfShorthand(important);
default:
return false;
}
« no previous file with comments | « third_party/WebKit/Source/core/css/parser/CSSPropertyParser.h ('k') | third_party/WebKit/Source/core/frame/UseCounter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698