Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(166)

Unified Diff: third_party/WebKit/Source/core/css/parser/LegacyCSSPropertyParser.cpp

Issue 1485973005: Add CSS support for Containment (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add test Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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

Powered by Google App Engine
This is Rietveld 408576698