Chromium Code Reviews| 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 b47f79a5368717d900c779f3e64d61bbbe5332ea..01dc00cf6bc2758659331e4d2dfa2d5d78b7476b 100644 |
| --- a/third_party/WebKit/Source/core/css/parser/CSSPropertyParser.cpp |
| +++ b/third_party/WebKit/Source/core/css/parser/CSSPropertyParser.cpp |
| @@ -4562,6 +4562,56 @@ bool CSSPropertyParser::consumeGridShorthand(bool important) { |
| return true; |
| } |
| +static CSSValue* consumeSimplifiedContentPosition(CSSParserTokenRange& range) { |
| + CSSValueID id = range.peek().id(); |
| + if (identMatches<CSSValueNormal, CSSValueBaseline, CSSValueLastBaseline>( |
| + id)) { |
| + return CSSContentDistributionValue::create( |
| + CSSValueInvalid, range.consumeIncludingWhitespace().id(), |
| + CSSValueInvalid); |
| + } |
| + if (identMatches<CSSValueSpaceBetween, CSSValueSpaceAround, |
| + CSSValueSpaceEvenly, CSSValueStretch>(id)) { |
| + return CSSContentDistributionValue::create( |
| + range.consumeIncludingWhitespace().id(), CSSValueInvalid, |
| + CSSValueInvalid); |
| + } |
| + if (identMatches<CSSValueStart, CSSValueEnd, CSSValueCenter, |
| + CSSValueFlexStart, CSSValueFlexEnd, CSSValueLeft, |
| + CSSValueRight>(id)) { |
| + return CSSContentDistributionValue::create( |
|
Timothy Loh
2017/02/06 23:15:14
Is this supposed to be the same as the first if()
jfernandez
2017/02/10 00:31:20
Yes, we treat normal, baseline and last-baseline (
|
| + CSSValueInvalid, range.consumeIncludingWhitespace().id(), |
| + CSSValueInvalid); |
| + } |
| + return nullptr; |
| +} |
| + |
| +bool CSSPropertyParser::consumePlaceContentShorthand(bool important) { |
| + DCHECK(RuntimeEnabledFeatures::cssGridLayoutEnabled()); |
| + DCHECK_EQ(shorthandForProperty(CSSPropertyPlaceContent).length(), |
| + static_cast<unsigned>(2)); |
| + |
| + if (m_range.atEnd()) |
|
Timothy Loh
2017/02/06 23:15:14
I think this never happens or otherwise the next c
jfernandez
2017/02/10 00:31:20
Acknowledged.
|
| + return false; |
| + |
| + CSSValue* alignContentValue = consumeSimplifiedContentPosition(m_range); |
| + if (!alignContentValue) |
| + return false; |
| + CSSValue* justifyContentValue = |
| + m_range.atEnd() ? alignContentValue |
| + : consumeSimplifiedContentPosition(m_range); |
| + if (!justifyContentValue) |
| + return false; |
| + if (!m_range.atEnd()) |
| + return false; |
| + |
| + addProperty(CSSPropertyAlignContent, CSSPropertyPlaceContent, |
| + *alignContentValue, important); |
| + addProperty(CSSPropertyJustifyContent, CSSPropertyPlaceContent, |
| + *justifyContentValue, important); |
| + return true; |
| +} |
| + |
| bool CSSPropertyParser::parseShorthand(CSSPropertyID unresolvedProperty, |
| bool important) { |
| CSSPropertyID property = resolveCSSPropertyID(unresolvedProperty); |
| @@ -4796,6 +4846,8 @@ bool CSSPropertyParser::parseShorthand(CSSPropertyID unresolvedProperty, |
| return consumeGridTemplateShorthand(CSSPropertyGridTemplate, important); |
| case CSSPropertyGrid: |
| return consumeGridShorthand(important); |
| + case CSSPropertyPlaceContent: |
| + return consumePlaceContentShorthand(important); |
| default: |
| return false; |
| } |