| Index: Source/core/animation/CompositorAnimations.cpp
|
| diff --git a/Source/core/animation/CompositorAnimations.cpp b/Source/core/animation/CompositorAnimations.cpp
|
| index dc20926eec9ee3614b1447d9c012ed0df4b6855e..4b8cec57914782f0794f3abfee3903ad10c1937b 100644
|
| --- a/Source/core/animation/CompositorAnimations.cpp
|
| +++ b/Source/core/animation/CompositorAnimations.cpp
|
| @@ -58,87 +58,17 @@ namespace WebCore {
|
|
|
| namespace {
|
|
|
| -void getKeyframeValuesForProperty(const KeyframeEffectModel* effect, CSSPropertyID id, double scale, bool reverse, KeyframeVector& values)
|
| +void getKeyframeValuesForProperty(const KeyframeEffectModel* effect, CSSPropertyID id, double scale, KeyframeVector& values)
|
| {
|
| ASSERT(values.isEmpty());
|
| const KeyframeVector& group = effect->getPropertySpecificKeyframes(id);
|
|
|
| - if (reverse) {
|
| - for (size_t i = group.size(); i--;) {
|
| - double offset = (1 - group[i]->offset()) * scale;
|
| - values.append(group[i]->cloneWithOffset(offset));
|
| - }
|
| - } else {
|
| - for (size_t i = 0; i < group.size(); ++i) {
|
| - double offset = group[i]->offset() * scale;
|
| - values.append(group[i]->cloneWithOffset(offset));
|
| - }
|
| - }
|
| -}
|
| -
|
| -}
|
| -
|
| -// -----------------------------------------------------------------------
|
| -// TimingFunctionReverser methods
|
| -// -----------------------------------------------------------------------
|
| -
|
| -PassRefPtr<TimingFunction> CompositorAnimationsTimingFunctionReverser::reverse(const LinearTimingFunction* timefunc)
|
| -{
|
| - return const_cast<LinearTimingFunction*>(timefunc);
|
| -}
|
| -
|
| -PassRefPtr<TimingFunction> CompositorAnimationsTimingFunctionReverser::reverse(const CubicBezierTimingFunction* timefunc)
|
| -{
|
| - switch (timefunc->subType()) {
|
| - case CubicBezierTimingFunction::EaseIn:
|
| - return CubicBezierTimingFunction::preset(CubicBezierTimingFunction::EaseOut);
|
| - case CubicBezierTimingFunction::EaseOut:
|
| - return CubicBezierTimingFunction::preset(CubicBezierTimingFunction::EaseIn);
|
| - case CubicBezierTimingFunction::EaseInOut:
|
| - return const_cast<CubicBezierTimingFunction*>(timefunc);
|
| - case CubicBezierTimingFunction::Ease: // Ease is not symmetrical
|
| - case CubicBezierTimingFunction::Custom:
|
| - return CubicBezierTimingFunction::create(1 - timefunc->x2(), 1 - timefunc->y2(), 1 - timefunc->x1(), 1 - timefunc->y1());
|
| - default:
|
| - ASSERT_NOT_REACHED();
|
| - return PassRefPtr<TimingFunction>();
|
| + for (size_t i = 0; i < group.size(); ++i) {
|
| + double offset = group[i]->offset() * scale;
|
| + values.append(group[i]->cloneWithOffset(offset));
|
| }
|
| }
|
|
|
| -PassRefPtr<TimingFunction> CompositorAnimationsTimingFunctionReverser::reverse(const ChainedTimingFunction* timefunc)
|
| -{
|
| - RefPtr<ChainedTimingFunction> reversed = ChainedTimingFunction::create();
|
| - for (size_t i = 0; i < timefunc->m_segments.size(); i++) {
|
| - size_t index = timefunc->m_segments.size() - i - 1;
|
| -
|
| - RefPtr<TimingFunction> rtf = reverse(timefunc->m_segments[index].m_timingFunction.get());
|
| - reversed->appendSegment(1 - timefunc->m_segments[index].m_min, rtf.get());
|
| - }
|
| - return reversed;
|
| -}
|
| -
|
| -PassRefPtr<TimingFunction> CompositorAnimationsTimingFunctionReverser::reverse(const TimingFunction* timefunc)
|
| -{
|
| - switch (timefunc->type()) {
|
| - case TimingFunction::LinearFunction: {
|
| - const LinearTimingFunction* linear = toLinearTimingFunction(timefunc);
|
| - return reverse(linear);
|
| - }
|
| - case TimingFunction::CubicBezierFunction: {
|
| - const CubicBezierTimingFunction* cubic = toCubicBezierTimingFunction(timefunc);
|
| - return reverse(cubic);
|
| - }
|
| - case TimingFunction::ChainedFunction: {
|
| - const ChainedTimingFunction* chained = toChainedTimingFunction(timefunc);
|
| - return reverse(chained);
|
| - }
|
| -
|
| - // Steps function can not be reversed.
|
| - case TimingFunction::StepsFunction:
|
| - default:
|
| - ASSERT_NOT_REACHED();
|
| - return PassRefPtr<TimingFunction>();
|
| - }
|
| }
|
|
|
| // -----------------------------------------------------------------------
|
| @@ -339,10 +269,7 @@ bool CompositorAnimationsImpl::convertTimingForCompositor(const Timing& timing,
|
| if (scaledStartDelay > 0 && scaledStartDelay > out.scaledDuration * timing.iterationCount)
|
| return false;
|
|
|
| - out.reverse = (timing.direction == Timing::PlaybackDirectionReverse
|
| - || timing.direction == Timing::PlaybackDirectionAlternateReverse);
|
| - out.alternate = (timing.direction == Timing::PlaybackDirectionAlternate
|
| - || timing.direction == Timing::PlaybackDirectionAlternateReverse);
|
| + out.direction = static_cast<CompositorTiming::Direction>(timing.direction);
|
|
|
| if (!std::isfinite(timing.iterationCount)) {
|
| out.adjustedIterationCount = -1;
|
| @@ -484,15 +411,12 @@ void CompositorAnimationsImpl::getAnimationOnCompositor(const Timing& timing, co
|
| ASSERT_UNUSED(timingValid, timingValid);
|
|
|
| RefPtr<TimingFunction> timingFunction = timing.timingFunction;
|
| - if (compositorTiming.reverse)
|
| - timingFunction = CompositorAnimationsTimingFunctionReverser::reverse(timingFunction.get());
|
| -
|
| PropertySet properties = effect.properties();
|
| ASSERT(!properties.isEmpty());
|
| for (PropertySet::iterator it = properties.begin(); it != properties.end(); ++it) {
|
|
|
| KeyframeVector values;
|
| - getKeyframeValuesForProperty(&effect, *it, compositorTiming.scaledDuration, compositorTiming.reverse, values);
|
| + getKeyframeValuesForProperty(&effect, *it, compositorTiming.scaledDuration, values);
|
|
|
| blink::WebAnimation::TargetProperty targetProperty;
|
| OwnPtr<blink::WebAnimationCurve> curve;
|
| @@ -529,7 +453,7 @@ void CompositorAnimationsImpl::getAnimationOnCompositor(const Timing& timing, co
|
|
|
| animation->setIterations(compositorTiming.adjustedIterationCount);
|
| animation->setTimeOffset(compositorTiming.scaledTimeOffset);
|
| - animation->setAlternatesDirection(compositorTiming.alternate);
|
| + animation->setDirection(static_cast<blink::WebAnimation::Direction>(compositorTiming.direction));
|
|
|
| animations.append(animation.release());
|
| }
|
|
|