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

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

Issue 1410343002: Parse {animation,transition}-{delay,duration} in CSSPropertyParser with CSSParserTokens (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@anim1
Patch Set: address review comments 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 5dbf4e6d87aefe058dabc3ab9243da210c1822c9..6615856067c6916009039b2de0145d5b4c1f51bf 100644
--- a/third_party/WebKit/Source/core/css/parser/CSSPropertyParser.cpp
+++ b/third_party/WebKit/Source/core/css/parser/CSSPropertyParser.cpp
@@ -339,6 +339,25 @@ static PassRefPtrWillBeRawPtr<CSSPrimitiveValue> consumeAngle(CSSParserTokenRang
return nullptr;
}
+static PassRefPtrWillBeRawPtr<CSSPrimitiveValue> consumeTime(CSSParserTokenRange& range, ValueRange valueRange)
+{
+ const CSSParserToken& token = range.peek();
+ if (token.type() == DimensionToken) {
+ if (valueRange == ValueRangeNonNegative && token.numericValue() < 0)
+ return nullptr;
+ CSSPrimitiveValue::UnitType unit = token.unitType();
+ if (unit == CSSPrimitiveValue::UnitType::Milliseconds || unit == CSSPrimitiveValue::UnitType::Seconds)
+ return cssValuePool().createValue(range.consumeIncludingWhitespace().numericValue(), token.unitType());
+ return nullptr;
+ }
+ CalcParser calcParser(range, valueRange);
+ if (const CSSCalcValue* calculation = calcParser.value()) {
+ if (calculation->category() == CalcTime)
+ return calcParser.consumeValue();
+ }
+ return nullptr;
+}
+
static inline bool isCSSWideKeyword(const CSSValueID& id)
{
return id == CSSValueInitial || id == CSSValueInherit || id == CSSValueUnset || id == CSSValueDefault;
@@ -1060,6 +1079,12 @@ static PassRefPtrWillBeRawPtr<CSSValue> consumeAnimationTimingFunction(CSSParser
static PassRefPtrWillBeRawPtr<CSSValue> consumeAnimationValue(CSSPropertyID property, CSSParserTokenRange& range)
{
switch (property) {
+ case CSSPropertyAnimationDelay:
+ case CSSPropertyTransitionDelay:
+ return consumeTime(range, ValueRangeAll);
+ case CSSPropertyAnimationDuration:
+ case CSSPropertyTransitionDuration:
+ return consumeTime(range, ValueRangeNonNegative);
case CSSPropertyAnimationTimingFunction:
case CSSPropertyTransitionTimingFunction:
return consumeAnimationTimingFunction(range);
@@ -1162,6 +1187,10 @@ PassRefPtrWillBeRawPtr<CSSValue> CSSPropertyParser::parseSingleValue(CSSProperty
return consumeColumnSpan(m_range, m_context.mode());
case CSSPropertyZoom:
return consumeZoom(m_range, m_context);
+ case CSSPropertyAnimationDelay:
+ case CSSPropertyTransitionDelay:
+ case CSSPropertyAnimationDuration:
+ case CSSPropertyTransitionDuration:
case CSSPropertyAnimationTimingFunction:
case CSSPropertyTransitionTimingFunction:
return consumeAnimationPropertyList(propId, m_range);
« 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