| Index: Source/core/platform/animation/TimingFunction.h
|
| diff --git a/Source/core/platform/animation/TimingFunction.h b/Source/core/platform/animation/TimingFunction.h
|
| index c0c478cfa15cb182f375c7dd71229d6aea38bf40..829c62a4c17afb8028ebf86caf6a70c08d9e25d2 100644
|
| --- a/Source/core/platform/animation/TimingFunction.h
|
| +++ b/Source/core/platform/animation/TimingFunction.h
|
| @@ -54,6 +54,8 @@ public:
|
| virtual bool operator==(const TimingFunction& other) const = 0;
|
| virtual bool operator!=(const TimingFunction& other) const { return !operator==(other); }
|
|
|
| + virtual PassRefPtr<TimingFunction> reverse() const = 0;
|
| +
|
| protected:
|
| TimingFunction(Type type)
|
| : m_type(type)
|
| @@ -85,6 +87,11 @@ public:
|
| return other.type() == LinearFunction;
|
| }
|
|
|
| + virtual PassRefPtr<TimingFunction> reverse() const
|
| + {
|
| + return const_cast<LinearTimingFunction*>(this);
|
| + }
|
| +
|
| private:
|
| LinearTimingFunction()
|
| : TimingFunction(LinearFunction)
|
| @@ -184,6 +191,26 @@ public:
|
|
|
| SubType subType() const { return m_subType; }
|
|
|
| + virtual PassRefPtr<TimingFunction> reverse() const
|
| + {
|
| + switch (m_subType) {
|
| + case Ease:
|
| + return const_cast<CubicBezierTimingFunction*>(this);
|
| + case EaseIn:
|
| + return preset(EaseOut);
|
| + case EaseOut:
|
| + return preset(EaseIn);
|
| + case EaseInOut:
|
| + return const_cast<CubicBezierTimingFunction*>(this);
|
| + case Custom:
|
| + // Flip the timing function in x. We also have to flip it in y to
|
| + // maintain the invariant that it runs from (0, 0) to (1, 1).
|
| + return create(1 - m_x2, 1 - m_y2, 1 - m_x1, 1 - m_y1);
|
| + default:
|
| + ASSERT_NOT_REACHED();
|
| + }
|
| + }
|
| +
|
| private:
|
| explicit CubicBezierTimingFunction(SubType subType, double x1, double y1, double x2, double y2)
|
| : TimingFunction(CubicBezierFunction)
|
| @@ -269,6 +296,21 @@ public:
|
|
|
| SubType subType() const { return m_subType; }
|
|
|
| + virtual PassRefPtr<TimingFunction> reverse() const
|
| + {
|
| + switch (m_subType) {
|
| + case Start:
|
| + return preset(End);
|
| + case End:
|
| + return preset(Start);
|
| + case Custom:
|
| + return create(m_steps, !m_stepAtStart);
|
| + default:
|
| + ASSERT_NOT_REACHED();
|
| + return 0;
|
| + }
|
| + }
|
| +
|
| private:
|
| StepsTimingFunction(SubType subType, int steps, bool stepAtStart)
|
| : TimingFunction(StepsFunction)
|
| @@ -329,6 +371,17 @@ public:
|
| return true;
|
| }
|
|
|
| + virtual PassRefPtr<TimingFunction> reverse() const
|
| + {
|
| + RefPtr<ChainedTimingFunction> reversed = create();
|
| + for (size_t i = 0; i < m_segments.size(); i++) {
|
| + size_t index = m_segments.size() - i - 1;
|
| +
|
| + reversed->appendSegment(1 - m_segments[index].m_min, m_segments[index].m_timingFunction->reverse().get());
|
| + }
|
| + return reversed;
|
| + }
|
| +
|
| private:
|
| class Segment {
|
| public:
|
|
|