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

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

Issue 2775143002: Implement frames() timing function (Closed)
Patch Set: Fix behaviour outside input range [0,1] Created 3 years, 8 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 eaab6a2eab3df1328813551186e7158ba6212f1c..22cd9c4a75522e022b33975cf031f3f2e2cd8de1 100644
--- a/third_party/WebKit/Source/core/css/parser/CSSPropertyParser.cpp
+++ b/third_party/WebKit/Source/core/css/parser/CSSPropertyParser.cpp
@@ -401,6 +401,26 @@ static CSSValue* ConsumeSteps(CSSParserTokenRange& range) {
return CSSStepsTimingFunctionValue::Create(steps->GetIntValue(), position);
}
+static CSSValue* ConsumeFrames(CSSParserTokenRange& range) {
+ DCHECK_EQ(range.Peek().FunctionId(), CSSValueFrames);
+ CSSParserTokenRange range_copy = range;
+ CSSParserTokenRange args = ConsumeFunction(range_copy);
+
+ CSSPrimitiveValue* frames = ConsumePositiveInteger(args);
+ if (!frames)
+ return nullptr;
+
+ int frames_int = frames->GetIntValue();
+ if (frames_int <= 1)
+ return nullptr;
+
+ if (!args.AtEnd())
+ return nullptr;
+
+ range = range_copy;
+ return CSSFramesTimingFunctionValue::Create(frames_int);
+}
+
static CSSValue* ConsumeCubicBezier(CSSParserTokenRange& range) {
DCHECK_EQ(range.Peek().FunctionId(), CSSValueCubicBezier);
CSSParserTokenRange range_copy = range;
@@ -430,6 +450,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