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

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

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/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 5bad355eaeef240088660312c8289494046811a8..64302dcb9f2fde594ca7c532897ee7097ee51f77 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> m_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* minValue, double* maxValue) const override;
+ std::unique_ptr<cc::TimingFunction> cloneToCC() const override;
+
+ int numberOfFrames() const { return m_frames->frames(); }
+
+ private:
+ FramesTimingFunction(int frames)
+ : TimingFunction(Type::FRAMES),
+ m_frames(cc::FramesTimingFunction::Create(frames)) {}
+
+ std::unique_ptr<cc::FramesTimingFunction> m_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