| Index: Source/platform/animation/TimingFunction.h
|
| diff --git a/Source/platform/animation/TimingFunction.h b/Source/platform/animation/TimingFunction.h
|
| index 1187ea92f69b811496dbed32c149117ef8fe0f16..f72b774d58b90c032766f856d7a7937bef07b650 100644
|
| --- a/Source/platform/animation/TimingFunction.h
|
| +++ b/Source/platform/animation/TimingFunction.h
|
| @@ -177,12 +177,19 @@ public:
|
| enum SubType {
|
| Start,
|
| End,
|
| + Middle,
|
| Custom
|
| };
|
|
|
| - static PassRefPtr<StepsTimingFunction> create(int steps, bool stepAtStart)
|
| + enum StepAtPosition {
|
| + StepAtStart,
|
| + StepAtMiddle,
|
| + StepAtEnd
|
| + };
|
| +
|
| + static PassRefPtr<StepsTimingFunction> create(int steps, StepAtPosition stepAtPosition)
|
| {
|
| - return adoptRef(new StepsTimingFunction(Custom, steps, stepAtStart));
|
| + return adoptRef(new StepsTimingFunction(Custom, steps, stepAtPosition));
|
| }
|
|
|
| static StepsTimingFunction* preset(SubType subType)
|
| @@ -190,12 +197,17 @@ public:
|
| switch (subType) {
|
| case Start:
|
| {
|
| - DEFINE_STATIC_REF(StepsTimingFunction, start, (adoptRef(new StepsTimingFunction(Start, 1, true))));
|
| + DEFINE_STATIC_REF(StepsTimingFunction, start, (adoptRef(new StepsTimingFunction(Start, 1, StepAtStart))));
|
| return start;
|
| }
|
| + case Middle:
|
| + {
|
| + DEFINE_STATIC_REF(StepsTimingFunction, middle, (adoptRef(new StepsTimingFunction(Middle, 1, StepAtMiddle))));
|
| + return middle;
|
| + }
|
| case End:
|
| {
|
| - DEFINE_STATIC_REF(StepsTimingFunction, end, (adoptRef(new StepsTimingFunction(End, 1, false))));
|
| + DEFINE_STATIC_REF(StepsTimingFunction, end, (adoptRef(new StepsTimingFunction(End, 1, StepAtEnd))));
|
| return end;
|
| }
|
| default:
|
| @@ -211,25 +223,48 @@ public:
|
| {
|
| ASSERT(RuntimeEnabledFeatures::webAnimationsCSSEnabled() || (fraction >= 0 && fraction <= 1));
|
| ASSERT_WITH_MESSAGE(!RuntimeEnabledFeatures::webAnimationsCSSEnabled() || (fraction >= 0 && fraction <= 1), "Web Animations not yet implemented: Timing function behavior outside the range [0, 1] is not yet specified");
|
| - return std::min(1.0, (floor(m_steps * fraction) + m_stepAtStart) / m_steps);
|
| + double startOffset = 0;
|
| + switch (m_stepAtPosition) {
|
| + case StepAtStart:
|
| + {
|
| + startOffset = 1;
|
| + break;
|
| + }
|
| + case StepAtMiddle:
|
| + {
|
| + startOffset = 0.5;
|
| + break;
|
| + }
|
| + case StepAtEnd:
|
| + {
|
| + startOffset = 0;
|
| + break;
|
| + }
|
| + default:
|
| + {
|
| + ASSERT_NOT_REACHED();
|
| + break;
|
| + }
|
| + }
|
| + return std::min(1.0, floor((m_steps * fraction) + startOffset) / m_steps);
|
| }
|
|
|
| int numberOfSteps() const { return m_steps; }
|
| - bool stepAtStart() const { return m_stepAtStart; }
|
| + StepAtPosition stepAtPosition() const { return m_stepAtPosition; }
|
|
|
| SubType subType() const { return m_subType; }
|
|
|
| private:
|
| - StepsTimingFunction(SubType subType, int steps, bool stepAtStart)
|
| + StepsTimingFunction(SubType subType, int steps, StepAtPosition stepAtPosition)
|
| : TimingFunction(StepsFunction)
|
| , m_steps(steps)
|
| - , m_stepAtStart(stepAtStart)
|
| + , m_stepAtPosition(stepAtPosition)
|
| , m_subType(subType)
|
| {
|
| }
|
|
|
| int m_steps;
|
| - bool m_stepAtStart;
|
| + StepAtPosition m_stepAtPosition;
|
| SubType m_subType;
|
| };
|
|
|
|
|