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

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

Issue 2775143002: Implement frames() timing function (Closed)
Patch Set: Created 3 years, 9 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: 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 74aa3fbf21b20bbf860a9e9468f641f10c2c8a53..6571e77543dce23cab4dc15029f08e211aa9195c 100644
--- a/third_party/WebKit/Source/core/css/parser/CSSPropertyParser.cpp
+++ b/third_party/WebKit/Source/core/css/parser/CSSPropertyParser.cpp
@@ -384,7 +384,7 @@ static CSSValue* consumeTransitionProperty(CSSParserTokenRange& range) {
}
static CSSValue* consumeSteps(CSSParserTokenRange& range) {
- ASSERT(range.peek().functionId() == CSSValueSteps);
+ DCHECK_EQ(range.peek().functionId(), CSSValueSteps);
CSSParserTokenRange rangeCopy = range;
CSSParserTokenRange args = consumeFunction(rangeCopy);
@@ -419,8 +419,28 @@ static CSSValue* consumeSteps(CSSParserTokenRange& range) {
return CSSStepsTimingFunctionValue::create(steps->getIntValue(), position);
}
+static CSSValue* consumeFrames(CSSParserTokenRange& range) {
+ DCHECK_EQ(range.peek().functionId(), CSSValueFrames);
+ CSSParserTokenRange rangeCopy = range;
+ CSSParserTokenRange args = consumeFunction(rangeCopy);
+
+ CSSPrimitiveValue* frames = consumePositiveInteger(args);
+ if (!frames)
+ return nullptr;
+
+ int framesInt = frames->getIntValue();
+ if (framesInt <= 1)
+ return nullptr;
+
+ if (!args.atEnd())
+ return nullptr;
+
+ range = rangeCopy;
+ return CSSFramesTimingFunctionValue::create(framesInt);
+}
+
static CSSValue* consumeCubicBezier(CSSParserTokenRange& range) {
- ASSERT(range.peek().functionId() == CSSValueCubicBezier);
+ DCHECK_EQ(range.peek().functionId(), CSSValueCubicBezier);
CSSParserTokenRange rangeCopy = range;
CSSParserTokenRange args = consumeFunction(rangeCopy);
@@ -448,6 +468,8 @@ static CSSValue* consumeAnimationTimingFunction(CSSParserTokenRange& range) {
CSSValueID function = range.peek().functionId();
if (function == CSSValueSteps)
return consumeSteps(range);
+ if (function == CSSValueFrames)
+ return consumeFrames(range);
if (function == CSSValueCubicBezier)
return consumeCubicBezier(range);
return nullptr;

Powered by Google App Engine
This is Rietveld 408576698