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); |