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

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

Issue 1485973005: Add CSS support for Containment (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address Comments 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/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;
}

Powered by Google App Engine
This is Rietveld 408576698