Bug 1216842 - Part 7: Add easing function to laryer::Animation. r=cam

This commit is contained in:
Hiroyuki Ikezoe 2016-01-26 21:19:00 +01:00
parent 15210ae758
commit 4b31027fae
3 changed files with 7 additions and 0 deletions

View File

@ -23,6 +23,7 @@
#include "mozilla/layers/APZUtils.h" // for CompleteAsyncTransform
#include "mozilla/layers/Compositor.h" // for Compositor
#include "mozilla/layers/CompositorParent.h" // for CompositorParent, etc
#include "mozilla/layers/LayerAnimationUtils.h" // for TimingFunctionToComputedTimingFunction
#include "mozilla/layers/LayerMetricsWrapper.h" // for LayerMetricsWrapper
#include "nsCoord.h" // for NSAppUnitsToFloatPixels, etc
#include "nsDebug.h" // for NS_ASSERTION, etc
@ -595,6 +596,9 @@ SampleAnimations(Layer* aLayer, TimeStamp aPoint)
// example, while they are waiting to be removed) we currently just
// assume that we should fill.
timing.mFill = dom::FillMode::Both;
timing.mFunction =
AnimationUtils::TimingFunctionToComputedTimingFunction(
animation.easingFunction());
ComputedTiming computedTiming =
dom::KeyframeEffectReadOnly::GetComputedTimingAt(

View File

@ -200,6 +200,8 @@ struct Animation {
nsCSSProperty property;
AnimationData data;
float playbackRate;
// This is used in the transformed progress calculation.
TimingFunction easingFunction;
};
// Change a layer's attributes

View File

@ -401,6 +401,7 @@ AddAnimationForProperty(nsIFrame* aFrame, const AnimationProperty& aProperty,
animation->property() = aProperty.mProperty;
animation->playbackRate() = aAnimation->PlaybackRate();
animation->data() = aData;
animation->easingFunction() = ToTimingFunction(timing.mFunction);
for (uint32_t segIdx = 0; segIdx < aProperty.mSegments.Length(); segIdx++) {
const AnimationPropertySegment& segment = aProperty.mSegments[segIdx];