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 fec9a497236d9d93f5b8453eb8943fb6cbf832e3..5ab717b1f5f1a900e425c07686e555f5469a7b50 100644 |
| --- a/third_party/WebKit/Source/core/css/parser/CSSPropertyParser.cpp |
| +++ b/third_party/WebKit/Source/core/css/parser/CSSPropertyParser.cpp |
| @@ -1777,6 +1777,31 @@ static PassRefPtrWillBeRawPtr<CSSValue> consumeTextDecorationLine(CSSParserToken |
| return list.release(); |
| } |
| +// none | strict | [ layout || style || paint ] |
| +static PassRefPtrWillBeRawPtr<CSSValue> consumeContain(CSSParserTokenRange& range) |
| +{ |
| + CSSValueID id = range.peek().id(); |
| + if (id == CSSValueNone) |
| + return consumeIdent(range); |
| + |
| + RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSpaceSeparated(); |
|
Timothy Loh
2015/12/03 05:23:45
Can we just handle strict separately? e.g.
if (id
|
| + RefPtrWillBeRawPtr<CSSPrimitiveValue> ident = nullptr; |
| + bool isStrict = id == CSSValueStrict; |
| + while ((ident = consumeIdent<CSSValuePaint, CSSValueLayout, CSSValueStyle, CSSValueStrict>(range))) { |
| + if (list->hasValue(ident.get())) |
| + return nullptr; |
| + if ((list->length() && ident->getValueID() == CSSValueStrict) |
| + || (isStrict && ident->getValueID() != CSSValueStrict)) { |
| + return nullptr; |
| + } |
| + list->append(ident.release()); |
| + } |
| + |
| + if (!list->length()) |
| + return nullptr; |
| + return list.release(); |
| +} |
| + |
| static PassRefPtrWillBeRawPtr<CSSValue> consumeMotionPath(CSSParserTokenRange& range) |
| { |
| CSSValueID id = range.peek().id(); |
| @@ -2353,6 +2378,8 @@ PassRefPtrWillBeRawPtr<CSSValue> CSSPropertyParser::parseSingleValue(CSSProperty |
| case CSSPropertyRx: |
| case CSSPropertyRy: |
| return consumeLengthOrPercent(m_range, SVGAttributeMode, ValueRangeAll, UnitlessQuirk::Forbid); |
| + case CSSPropertyContain: |
| + return consumeContain(m_range); |
| default: |
| return nullptr; |
| } |