Chromium Code Reviews| Index: Source/core/css/parser/CSSPropertyParser.cpp |
| diff --git a/Source/core/css/parser/CSSPropertyParser.cpp b/Source/core/css/parser/CSSPropertyParser.cpp |
| index 4c3d25149345a119e48b66d79f01144bdcbaeba9..e4e321fb6a269f6d8c3a2dd1cce68f98d3e0a67a 100644 |
| --- a/Source/core/css/parser/CSSPropertyParser.cpp |
| +++ b/Source/core/css/parser/CSSPropertyParser.cpp |
| @@ -1199,6 +1199,17 @@ bool CSSPropertyParser::parseValue(CSSPropertyID propId, bool important) |
| return false; |
| return parseItemPositionOverflowPosition(propId, important); |
| + |
| + case CSSPropertyJustifyItems: |
| + if (!RuntimeEnabledFeatures::cssGridLayoutEnabled()) |
| + return false; |
| + |
| + if (parseLegacyPosition(propId, important)) |
| + return true; |
| + |
| + m_valueList->setCurrentIndex(0); |
| + return parseItemPositionOverflowPosition(propId, important); |
| + |
| case CSSPropertyGridAutoColumns: |
| case CSSPropertyGridAutoRows: |
| if (!RuntimeEnabledFeatures::cssGridLayoutEnabled()) |
| @@ -4126,6 +4137,11 @@ PassRefPtrWillBeRawPtr<CSSBasicShape> CSSPropertyParser::parseBasicShapeInset(CS |
| return shape; |
| } |
| +static bool isBaselinePositionKeyword(CSSValueID id) |
| +{ |
| + return id == CSSValueBaseline || id == CSSValueLastBaseline; |
| +} |
| + |
| static bool isItemPositionKeyword(CSSValueID id) |
| { |
| return id == CSSValueStart || id == CSSValueEnd || id == CSSValueCenter |
| @@ -4133,15 +4149,42 @@ static bool isItemPositionKeyword(CSSValueID id) |
| || id == CSSValueFlexEnd || id == CSSValueLeft || id == CSSValueRight; |
| } |
| +bool CSSPropertyParser::parseLegacyPosition(CSSPropertyID propId, bool important) |
| +{ |
| + // [ legacy && [ left | right | center ] |
| + |
| + CSSParserValue* value = m_valueList->current(); |
| + if (!value) |
| + return false; |
| + |
| + if (value->id == CSSValueLegacy) { |
| + if (!(value = m_valueList->next())) |
|
Julien - ping for review
2014/06/26 17:37:20
Nit: I would split this into 2 lines for readabili
jfernandez
2014/06/26 22:36:05
Done.
|
| + return false; |
| + if (value->id != CSSValueCenter && value->id != CSSValueLeft && value->id != CSSValueRight) |
| + return false; |
| + } else if (value->id == CSSValueCenter || value->id == CSSValueLeft || value->id == CSSValueRight) { |
| + if (!m_valueList->next() || m_valueList->current()->id != CSSValueLegacy) |
| + return false; |
| + } else { |
| + return false; |
| + } |
| + |
| + addProperty(propId, createPrimitiveValuePair(cssValuePool().createIdentifierValue(CSSValueLegacy), cssValuePool().createIdentifierValue(value->id)), important); |
| + return !m_valueList->next(); |
| +} |
| + |
| bool CSSPropertyParser::parseItemPositionOverflowPosition(CSSPropertyID propId, bool important) |
| { |
| - // auto | baseline | stretch | [<item-position> && <overflow-position>? ] |
| + // auto | stretch | <baseline-position> | [<item-position> && <overflow-position>? ] |
| + // <baseline-position> = baseline | last-baseline; |
| // <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) |
| + return false; |
| - if (value->id == CSSValueAuto || value->id == CSSValueBaseline || value->id == CSSValueStretch) { |
| + if (value->id == CSSValueAuto || value->id == CSSValueStretch || isBaselinePositionKeyword(value->id)) { |
| if (m_valueList->next()) |
| return false; |