| 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 fece72edd2281e0fe283e6a500a3d6b7b83785a0..96919c86c1db8699953fdc005f77f4fb1513b2dd 100644
|
| --- a/third_party/WebKit/Source/core/css/parser/CSSPropertyParser.cpp
|
| +++ b/third_party/WebKit/Source/core/css/parser/CSSPropertyParser.cpp
|
| @@ -3362,23 +3362,40 @@ bool CSSPropertyParser::consumeGridShorthand(bool important) {
|
| return true;
|
| }
|
|
|
| +static bool isContentPosition(CSSValueID id) {
|
| + return identMatches<CSSValueStart, CSSValueEnd, CSSValueCenter,
|
| + CSSValueFlexStart, CSSValueFlexEnd, CSSValueLeft,
|
| + CSSValueRight>(id);
|
| +}
|
| +
|
| +static bool isContentDistribution(CSSValueID id) {
|
| + return identMatches<CSSValueSpaceBetween, CSSValueSpaceAround,
|
| + CSSValueSpaceEvenly, CSSValueStretch>(id);
|
| +}
|
| +
|
| +static bool isBaselinePosition(CSSValueID id) {
|
| + return identMatches<CSSValueBaseline, CSSValueLastBaseline>(id);
|
| +}
|
| +
|
| +static bool isSelfPosition(CSSValueID id) {
|
| + return identMatches<CSSValueStart, CSSValueEnd, CSSValueCenter,
|
| + CSSValueSelfStart, CSSValueSelfEnd, CSSValueFlexStart,
|
| + CSSValueFlexEnd, CSSValueLeft, CSSValueRight>(id);
|
| +}
|
| +
|
| static CSSValue* consumeSimplifiedContentPosition(CSSParserTokenRange& range) {
|
| CSSValueID id = range.peek().id();
|
| - if (identMatches<CSSValueNormal, CSSValueBaseline, CSSValueLastBaseline>(
|
| - id)) {
|
| + if (identMatches<CSSValueNormal>(id) || isBaselinePosition(id)) {
|
| return CSSContentDistributionValue::create(
|
| CSSValueInvalid, range.consumeIncludingWhitespace().id(),
|
| CSSValueInvalid);
|
| }
|
| - if (identMatches<CSSValueSpaceBetween, CSSValueSpaceAround,
|
| - CSSValueSpaceEvenly, CSSValueStretch>(id)) {
|
| + if (isContentDistribution(id)) {
|
| return CSSContentDistributionValue::create(
|
| range.consumeIncludingWhitespace().id(), CSSValueInvalid,
|
| CSSValueInvalid);
|
| }
|
| - if (identMatches<CSSValueStart, CSSValueEnd, CSSValueCenter,
|
| - CSSValueFlexStart, CSSValueFlexEnd, CSSValueLeft,
|
| - CSSValueRight>(id)) {
|
| + if (isContentPosition(id)) {
|
| return CSSContentDistributionValue::create(
|
| CSSValueInvalid, range.consumeIncludingWhitespace().id(),
|
| CSSValueInvalid);
|
| @@ -3409,6 +3426,42 @@ bool CSSPropertyParser::consumePlaceContentShorthand(bool important) {
|
| return true;
|
| }
|
|
|
| +static CSSValue* consumeSimplifiedItemPosition(CSSParserTokenRange& range) {
|
| + CSSValueID id = range.peek().id();
|
| + if (identMatches<CSSValueAuto, CSSValueNormal, CSSValueStretch>(id) ||
|
| + isBaselinePosition(id) || isSelfPosition(id))
|
| + return consumeIdent(range);
|
| + return nullptr;
|
| +}
|
| +
|
| +bool CSSPropertyParser::consumePlaceItemsShorthand(bool important) {
|
| + DCHECK(RuntimeEnabledFeatures::cssGridLayoutEnabled());
|
| + DCHECK_EQ(shorthandForProperty(CSSPropertyPlaceContent).length(),
|
| + static_cast<unsigned>(2));
|
| +
|
| + // align-items property does not allow the 'auto' value.
|
| + if (identMatches<CSSValueAuto>(m_range.peek().id()))
|
| + return false;
|
| +
|
| + CSSValue* alignItemsValue = consumeSimplifiedItemPosition(m_range);
|
| + if (!alignItemsValue)
|
| + return false;
|
| + CSSValue* justifyItemsValue = m_range.atEnd()
|
| + ? alignItemsValue
|
| + : consumeSimplifiedItemPosition(m_range);
|
| + if (!justifyItemsValue)
|
| + return false;
|
| +
|
| + if (!m_range.atEnd())
|
| + return false;
|
| +
|
| + addProperty(CSSPropertyAlignItems, CSSPropertyPlaceItems, *alignItemsValue,
|
| + important);
|
| + addProperty(CSSPropertyJustifyItems, CSSPropertyPlaceItems,
|
| + *justifyItemsValue, important);
|
| + return true;
|
| +}
|
| +
|
| bool CSSPropertyParser::parseShorthand(CSSPropertyID unresolvedProperty,
|
| bool important) {
|
| CSSPropertyID property = resolveCSSPropertyID(unresolvedProperty);
|
| @@ -3670,6 +3723,8 @@ bool CSSPropertyParser::parseShorthand(CSSPropertyID unresolvedProperty,
|
| return consumeGridShorthand(important);
|
| case CSSPropertyPlaceContent:
|
| return consumePlaceContentShorthand(important);
|
| + case CSSPropertyPlaceItems:
|
| + return consumePlaceItemsShorthand(important);
|
| default:
|
| return false;
|
| }
|
|
|