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

Unified Diff: third_party/WebKit/Source/platform/animation/TimingFunction.h

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/platform/animation/TimingFunction.h
diff --git a/third_party/WebKit/Source/platform/animation/TimingFunction.h b/third_party/WebKit/Source/platform/animation/TimingFunction.h
index 5e52324506f6eeb0acb54b007600d66d420882d6..55758d6762e915e6bf85380024a5c3ab4600e394 100644
--- a/third_party/WebKit/Source/platform/animation/TimingFunction.h
+++ b/third_party/WebKit/Source/platform/animation/TimingFunction.h
@@ -222,6 +222,30 @@ class PLATFORM_EXPORT StepsTimingFunction final : public TimingFunction {
std::unique_ptr<cc::StepsTimingFunction> steps_;
};
+class PLATFORM_EXPORT FramesTimingFunction final : public TimingFunction {
+ public:
+ static PassRefPtr<FramesTimingFunction> Create(int frames) {
+ return AdoptRef(new FramesTimingFunction(frames));
+ }
+
+ ~FramesTimingFunction() override {}
+
+ // TimingFunction implementation.
+ String ToString() const override;
+ double Evaluate(double fraction, double) const override;
+ void Range(double* min_value, double* max_value) const override;
+ std::unique_ptr<cc::TimingFunction> CloneToCC() const override;
+
+ int NumberOfFrames() const { return frames_->frames(); }
+
+ private:
+ FramesTimingFunction(int frames)
+ : TimingFunction(Type::FRAMES),
+ frames_(cc::FramesTimingFunction::Create(frames)) {}
+
+ std::unique_ptr<cc::FramesTimingFunction> frames_;
+};
+
PLATFORM_EXPORT PassRefPtr<TimingFunction> CreateCompositorTimingFunctionFromCC(
const cc::TimingFunction*);
@@ -231,6 +255,8 @@ PLATFORM_EXPORT bool operator==(const CubicBezierTimingFunction&,
const TimingFunction&);
PLATFORM_EXPORT bool operator==(const StepsTimingFunction&,
const TimingFunction&);
+PLATFORM_EXPORT bool operator==(const FramesTimingFunction&,
+ const TimingFunction&);
PLATFORM_EXPORT bool operator==(const TimingFunction&, const TimingFunction&);
PLATFORM_EXPORT bool operator!=(const TimingFunction&, const TimingFunction&);
@@ -243,6 +269,7 @@ PLATFORM_EXPORT bool operator!=(const TimingFunction&, const TimingFunction&);
DEFINE_TIMING_FUNCTION_TYPE_CASTS(Linear, LINEAR);
DEFINE_TIMING_FUNCTION_TYPE_CASTS(CubicBezier, CUBIC_BEZIER);
DEFINE_TIMING_FUNCTION_TYPE_CASTS(Steps, STEPS);
+DEFINE_TIMING_FUNCTION_TYPE_CASTS(Frames, FRAMES);
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698