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

Unified Diff: Source/core/css/CSSParser-in.cpp

Issue 17090005: [CSS Grid Layout] Implement 'justify-self' parsing (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Scrubbed and rebaselined patch 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/CSSPrimitiveValueMappings.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..add15c97ff775dc6ea4e3b756a001db937367830 100644
--- a/Source/core/css/CSSParser-in.cpp
+++ b/Source/core/css/CSSParser-in.cpp
@@ -2486,6 +2486,11 @@ bool CSSParser::parseValue(CSSPropertyID propId, bool important)
return false;
}
+ case CSSPropertyJustifySelf:
+ if (!RuntimeEnabledFeatures::cssGridLayoutEnabled())
+ return false;
+
+ return parseJustifySelf(propId, important);
case CSSPropertyGridAutoColumns:
case CSSPropertyGridAutoRows:
if (!RuntimeEnabledFeatures::cssGridLayoutEnabled())
@@ -5134,6 +5139,65 @@ bool CSSParser::parseClipShape(CSSPropertyID propId, bool important)
return false;
}
+static bool isItemPosition(CSSValueID id)
ojan 2013/11/25 21:24:08 This is a confusing name...how about...isJustifySe
Julien - ping for review 2013/11/26 00:08:24 This syntax is also used for justify-items / align
+{
+ return id == CSSValueStart || id == CSSValueEnd || id == CSSValueCenter
+ || id == CSSValueSelfStart || id == CSSValueSelfEnd || id == CSSValueFlexStart
+ || id == CSSValueFlexEnd || id == CSSValueLeft || id == CSSValueRight;
+}
+
+bool CSSParser::parseJustifySelf(CSSPropertyID propId, bool important)
+{
+ // auto | baseline | stretch | [<item-position> && <overflow-position>? ]
+ // <item-position> = center | start | end | self-start | self-end | flex-start | flex-end | left | right;
+ // <overflow-position> = true | safe
+
+ CSSParserValue* value = m_valueList->current();
+
+ if (value->id == CSSValueAuto || value->id == CSSValueBaseline || value->id == CSSValueStretch) {
+ if (m_valueList->next())
+ return false;
+
+ addProperty(propId, cssValuePool().createIdentifierValue(value->id), important);
+ return true;
+ }
+
+ RefPtr<CSSPrimitiveValue> position = 0;
+ RefPtr<CSSPrimitiveValue> overflowAlignmentKeyword = 0;
+ if (isItemPosition(value->id)) {
+ position = cssValuePool().createIdentifierValue(value->id);
+ value = m_valueList->next();
+ if (value) {
+ if (value->id == CSSValueTrue || value->id == CSSValueSafe)
+ overflowAlignmentKeyword = cssValuePool().createIdentifierValue(value->id);
+ else
+ return false;
+ }
+ } else if (value->id == CSSValueTrue || value->id == CSSValueSafe) {
+ overflowAlignmentKeyword = cssValuePool().createIdentifierValue(value->id);
+ value = m_valueList->next();
+ if (value) {
+ if (isItemPosition(value->id))
+ position = cssValuePool().createIdentifierValue(value->id);
+ else
+ return false;
+ }
+ } else {
+ return false;
+ }
+
+ if (m_valueList->next())
+ return false;
+
+ ASSERT(position);
+ if (overflowAlignmentKeyword)
+ addProperty(propId, createPrimitiveValuePair(position, overflowAlignmentKeyword), important);
+ else
+ addProperty(propId, position.release(), important);
+
+ return true;
+}
+
PassRefPtr<CSSBasicShape> CSSParser::parseBasicShapeRectangle(CSSParserValueList* args)
{
ASSERT(args);
« no previous file with comments | « Source/core/css/CSSParser.h ('k') | Source/core/css/CSSPrimitiveValueMappings.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698