Chromium Code Reviews| Index: third_party/WebKit/Source/core/css/parser/LegacyCSSPropertyParser.cpp |
| diff --git a/third_party/WebKit/Source/core/css/parser/LegacyCSSPropertyParser.cpp b/third_party/WebKit/Source/core/css/parser/LegacyCSSPropertyParser.cpp |
| index c9696bbf685f2afeac617853ba89e96cfacc7576..a95bf09db6758bd62ce7b60115cb7dccb4084d8e 100644 |
| --- a/third_party/WebKit/Source/core/css/parser/LegacyCSSPropertyParser.cpp |
| +++ b/third_party/WebKit/Source/core/css/parser/LegacyCSSPropertyParser.cpp |
| @@ -1122,6 +1122,11 @@ bool CSSPropertyParser::parseValue(CSSPropertyID unresolvedProperty, bool import |
| parsedValue = parsePosition(m_valueList); |
| break; |
| + // none | strict | [ layout || style || paint ] |
| + case CSSPropertyContain: |
| + parsedValue = parseContain(); |
| + break; |
| + |
| default: |
| // If you crash here, it's because you added a css property and are not handling it |
| // in either this switch statement or the one in CSSPropertyParser::parseSingleValue. |
| @@ -1467,6 +1472,39 @@ PassRefPtrWillBeRawPtr<CSSValue> CSSPropertyParser::parseScrollSnapCoordinate() |
| return parsePositionList(m_valueList); |
| } |
| +// none | strict | [ layout || style || paint ] |
| +PassRefPtrWillBeRawPtr<CSSValue> CSSPropertyParser::parseContain() |
|
Timothy Loh
2015/12/02 02:49:47
This parsing code is wrong (accepts "strict layout
leviw_travelin_and_unemployed
2015/12/03 00:01:59
Changed and moved.
|
| +{ |
| + CSSParserValue* value = m_valueList->current(); |
| + if (value->id == CSSValueNone) { |
| + m_valueList->next(); |
| + return cssValuePool().createIdentifierValue(value->id); |
| + } |
| + |
| + RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSpaceSeparated(); |
| + bool isValid = true; |
| + while (isValid && value) { |
| + switch (value->id) { |
| + case CSSValuePaint: |
| + case CSSValueLayout: |
| + case CSSValueStyle: |
| + case CSSValueStrict: |
| + list->append(cssValuePool().createIdentifierValue(value->id)); |
| + break; |
| + default: |
| + isValid = false; |
| + break; |
| + } |
| + if (isValid) |
| + value = m_valueList->next(); |
| + } |
| + |
| + // Values are either valid or in shorthand scope. |
| + if (list->length()) |
| + return list.release(); |
| + return nullptr; |
| +} |
| + |
| // [ <string> | <uri> | <counter> | attr(X) | open-quote | close-quote | no-open-quote | no-close-quote ]+ | inherit |
| // in CSS 2.1 this got somewhat reduced: |
| // [ <string> | attr(X) | open-quote | close-quote | no-open-quote | no-close-quote ]+ | inherit |