Bug 1223658 - Part 3: Consider fillMode in compositor thread as well. r?birtles
We need to consider fill mode in compositor thread as well as other properties
because pulling the animation back from the compositor thread is sometimes
delayed due to the main thread busyness. In such situations, if there is
another animation running on the main thread on the same element, users can
easily notice a gap between both of animations.
MozReview-Commit-ID: 1i7YTWboira
--- a/gfx/layers/composite/AsyncCompositionManager.cpp
+++ b/gfx/layers/composite/AsyncCompositionManager.cpp
@@ -675,21 +675,17 @@ SampleAnimations(Layer* aLayer, TimeStam
(aPoint - animation.startTime()).MultDouble(animation.playbackRate());
TimingParams timing;
timing.mDuration.emplace(animation.duration());
timing.mDelay = animation.delay();
timing.mIterations = animation.iterations();
timing.mIterationStart = animation.iterationStart();
timing.mDirection =
static_cast<dom::PlaybackDirection>(animation.direction());
- // Animations typically only run on the compositor during their active
- // interval but if we end up sampling them outside that range (for
- // example, while they are waiting to be removed) we currently just
- // assume that we should fill.
- timing.mFill = dom::FillMode::Both;
+ timing.mFill = static_cast<dom::FillMode>(animation.fillMode());
timing.mFunction =
AnimationUtils::TimingFunctionToComputedTimingFunction(
animation.easingFunction());
ComputedTiming computedTiming =
dom::AnimationEffectReadOnly::GetComputedTimingAt(
Nullable<TimeDuration>(elapsedDuration), timing,
animation.playbackRate());
--- a/gfx/layers/ipc/LayersMessages.ipdlh
+++ b/gfx/layers/ipc/LayersMessages.ipdlh
@@ -192,16 +192,18 @@ struct Animation {
AnimationSegment[] segments;
// Number of times to repeat the animation, including positive infinity.
// Values <= 0 mean the animation will not play (although events are still
// dispatched on the main thread).
float iterations;
float iterationStart;
// This uses the NS_STYLE_ANIMATION_DIRECTION_* constants.
uint8_t direction;
+ // This uses dom::FillMode.
+ uint8_t fillMode;
nsCSSPropertyID property;
AnimationData data;
float playbackRate;
// This is used in the transformed progress calculation.
TimingFunction easingFunction;
uint8_t iterationComposite;
};
--- a/layout/base/nsDisplayList.cpp
+++ b/layout/base/nsDisplayList.cpp
@@ -426,16 +426,17 @@ AddAnimationForProperty(nsIFrame* aFrame
ToTimeStamp(startTime.Value());
animation->initialCurrentTime() = aAnimation->GetCurrentTime().Value()
- timing.mDelay;
animation->delay() = timing.mDelay;
animation->duration() = computedTiming.mDuration;
animation->iterations() = computedTiming.mIterations;
animation->iterationStart() = computedTiming.mIterationStart;
animation->direction() = static_cast<uint8_t>(timing.mDirection);
+ animation->fillMode() = static_cast<uint8_t>(timing.mFill);
animation->property() = aProperty.mProperty;
animation->playbackRate() = aAnimation->PlaybackRate();
animation->data() = aData;
animation->easingFunction() = ToTimingFunction(timing.mFunction);
animation->iterationComposite() =
static_cast<uint8_t>(aAnimation->GetEffect()->
AsKeyframeEffect()->IterationComposite());