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

Unified Diff: Source/core/css/parser/BisonCSSParser-in.cpp

Issue 167603002: Implement 'will-change' parsing (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 10 months 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: Source/core/css/parser/BisonCSSParser-in.cpp
diff --git a/Source/core/css/parser/BisonCSSParser-in.cpp b/Source/core/css/parser/BisonCSSParser-in.cpp
index 2e4b14c4e4fb33708affa1cc53954c1ad8a75cad..2aa701d4d1637fc47b4ec9b2d8a1c2c08789a567 100644
--- a/Source/core/css/parser/BisonCSSParser-in.cpp
+++ b/Source/core/css/parser/BisonCSSParser-in.cpp
@@ -2464,6 +2464,10 @@ bool BisonCSSParser::parseValue(CSSPropertyID propId, bool important)
case CSSPropertyWebkitColumnWidth: // auto | <length>
parsedValue = parseColumnWidth();
break;
+ case CSSPropertyWillChange:
+ if (!RuntimeEnabledFeatures::cssWillChangeEnabled())
+ return false;
+ return parseWillChange(important);
// End of CSS3 properties
// Apple specific properties. These will never be standardized and are purely to
@@ -8365,6 +8369,62 @@ PassRefPtr<CSSValue> BisonCSSParser::parseImageSet(CSSParserValueList* valueList
return imageSet.release();
}
+bool BisonCSSParser::parseWillChange(bool important)
+{
+ ASSERT(RuntimeEnabledFeatures::cssWillChangeEnabled());
+
+ RefPtrWillBeRawPtr<CSSValueList> values = CSSValueList::createCommaSeparated();
+ if (m_valueList->current()->id == CSSValueAuto) {
+ if (m_valueList->next())
+ return false;
+ }
+
+ CSSParserValue* currentValue;
+ bool expectComma = false;
+
+ // Every comma-separated list of CSS_IDENTs is a valid will-change value,
+ // unless the list includes an explicitly disallowed CSS_IDENT.
+ while ((currentValue = m_valueList->current())) {
+ if (expectComma) {
+ if (!isComma(currentValue))
+ return false;
+ expectComma = false;
+ m_valueList->next();
+ continue;
+ }
+
+ if (currentValue->unit != CSSPrimitiveValue::CSS_IDENT)
+ return false;
+
+ if (CSSPropertyID property = cssPropertyID(currentValue->string)) {
+ if (property == CSSPropertyWillChange)
+ return false;
+ values->append(cssValuePool().createIdentifierValue(property));
+ } else {
+ switch (currentValue->id) {
+ case CSSValueNone:
+ case CSSValueAll:
+ case CSSValueAuto:
+ case CSSValueDefault:
+ case CSSValueInitial:
+ case CSSValueInherit:
+ return false;
+ case CSSValueContents:
+ case CSSValueScrollPosition:
+ values->append(cssValuePool().createIdentifierValue(currentValue->id));
+ break;
+ default:
+ break;
+ }
+ }
+ expectComma = true;
+ m_valueList->next();
+ }
+
+ addProperty(CSSPropertyWillChange, values.release(), important);
+ return true;
+}
+
class TransformOperationInfo {
public:
TransformOperationInfo(const CSSParserString& name)

Powered by Google App Engine
This is Rietveld 408576698