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

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

Issue 1410223004: Parse animation-name in CSSPropertyParser with CSSParserTokens (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@anim2
Patch Set: Created 5 years, 2 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
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/css/parser/LegacyCSSPropertyParser.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 6615856067c6916009039b2de0145d5b4c1f51bf..a2a4cceb257b2c1f646abb85a4ae1d4f96a7fe17 100644
--- a/third_party/WebKit/Source/core/css/parser/CSSPropertyParser.cpp
+++ b/third_party/WebKit/Source/core/css/parser/CSSPropertyParser.cpp
@@ -999,6 +999,25 @@ static PassRefPtrWillBeRawPtr<CSSValue> consumeZoom(CSSParserTokenRange& range,
return zoom.release();
}
+static PassRefPtrWillBeRawPtr<CSSValue> consumeAnimationName(CSSParserTokenRange& range, const CSSParserContext& context, bool allowQuotedName)
+{
+ if (range.peek().id() == CSSValueNone)
+ return consumeIdent(range);
+
+ if (allowQuotedName && range.peek().type() == StringToken) {
+ // Legacy support for strings in prefixed animations.
+ if (context.useCounter())
+ context.useCounter()->count(UseCounter::QuotedAnimationName);
+
+ const CSSParserToken& token = range.consumeIncludingWhitespace();
+ if (token.valueEqualsIgnoringCase("none"))
+ return cssValuePool().createIdentifierValue(CSSValueNone);
+ return CSSCustomIdentValue::create(token.value());
+ }
+
+ return consumeCustomIdent(range);
+}
+
static PassRefPtrWillBeRawPtr<CSSValue> consumeSteps(CSSParserTokenRange& range)
{
ASSERT(range.peek().functionId() == CSSValueSteps);
@@ -1076,7 +1095,7 @@ static PassRefPtrWillBeRawPtr<CSSValue> consumeAnimationTimingFunction(CSSParser
return nullptr;
}
-static PassRefPtrWillBeRawPtr<CSSValue> consumeAnimationValue(CSSPropertyID property, CSSParserTokenRange& range)
+static PassRefPtrWillBeRawPtr<CSSValue> consumeAnimationValue(CSSPropertyID property, CSSParserTokenRange& range, const CSSParserContext& context, bool useLegacyParsing)
{
switch (property) {
case CSSPropertyAnimationDelay:
@@ -1085,6 +1104,8 @@ static PassRefPtrWillBeRawPtr<CSSValue> consumeAnimationValue(CSSPropertyID prop
case CSSPropertyAnimationDuration:
case CSSPropertyTransitionDuration:
return consumeTime(range, ValueRangeNonNegative);
+ case CSSPropertyAnimationName:
+ return consumeAnimationName(range, context, useLegacyParsing);
case CSSPropertyAnimationTimingFunction:
case CSSPropertyTransitionTimingFunction:
return consumeAnimationTimingFunction(range);
@@ -1094,11 +1115,11 @@ static PassRefPtrWillBeRawPtr<CSSValue> consumeAnimationValue(CSSPropertyID prop
}
}
-static PassRefPtrWillBeRawPtr<CSSValueList> consumeAnimationPropertyList(CSSPropertyID property, CSSParserTokenRange& range)
+static PassRefPtrWillBeRawPtr<CSSValueList> consumeAnimationPropertyList(CSSPropertyID property, CSSParserTokenRange& range, const CSSParserContext& context, bool useLegacyParsing)
{
RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createCommaSeparated();
do {
- RefPtrWillBeRawPtr<CSSValue> value = consumeAnimationValue(property, range);
+ RefPtrWillBeRawPtr<CSSValue> value = consumeAnimationValue(property, range, context, useLegacyParsing);
if (!value)
return nullptr;
list->append(value.release());
@@ -1107,10 +1128,11 @@ static PassRefPtrWillBeRawPtr<CSSValueList> consumeAnimationPropertyList(CSSProp
return list.release();
}
-PassRefPtrWillBeRawPtr<CSSValue> CSSPropertyParser::parseSingleValue(CSSPropertyID propId)
+PassRefPtrWillBeRawPtr<CSSValue> CSSPropertyParser::parseSingleValue(CSSPropertyID unresolvedProperty)
{
+ CSSPropertyID property = resolveCSSPropertyID(unresolvedProperty);
m_range.consumeWhitespace();
- switch (propId) {
+ switch (property) {
case CSSPropertyWillChange:
return consumeWillChange(m_range);
case CSSPropertyPage:
@@ -1145,7 +1167,7 @@ PassRefPtrWillBeRawPtr<CSSValue> CSSPropertyParser::parseSingleValue(CSSProperty
return consumeLength(m_range, m_context.mode(), ValueRangeNonNegative);
case CSSPropertyCounterIncrement:
case CSSPropertyCounterReset:
- return consumeCounter(m_range, m_context.mode(), propId == CSSPropertyCounterIncrement ? 1 : 0);
+ return consumeCounter(m_range, m_context.mode(), property == CSSPropertyCounterIncrement ? 1 : 0);
case CSSPropertySize:
return consumeSize(m_range, m_context.mode());
case CSSPropertyTextIndent:
@@ -1191,9 +1213,10 @@ PassRefPtrWillBeRawPtr<CSSValue> CSSPropertyParser::parseSingleValue(CSSProperty
case CSSPropertyTransitionDelay:
case CSSPropertyAnimationDuration:
case CSSPropertyTransitionDuration:
+ case CSSPropertyAnimationName:
case CSSPropertyAnimationTimingFunction:
case CSSPropertyTransitionTimingFunction:
- return consumeAnimationPropertyList(propId, m_range);
+ return consumeAnimationPropertyList(property, m_range, m_context, unresolvedProperty == CSSPropertyAliasWebkitAnimationName);
default:
return nullptr;
}
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/css/parser/LegacyCSSPropertyParser.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698