Bug 1363830 - use previous frame time when advancing animations, r?kats
MozReview-Commit-ID: CqKOguZXnF9
--- a/gfx/layers/wr/WebRenderBridgeParent.cpp
+++ b/gfx/layers/wr/WebRenderBridgeParent.cpp
@@ -1048,17 +1048,26 @@ WebRenderBridgeParent::ActorDestroy(Acto
void
WebRenderBridgeParent::AdvanceAnimations()
{
TimeStamp animTime = mCompositorScheduler->GetLastComposeTime();
if (CompositorBridgeParent* cbp = GetRootCompositorBridgeParent()) {
animTime = cbp->GetTestingTimeStamp().valueOr(animTime);
}
- AnimationHelper::SampleAnimations(mAnimStorage, animTime);
+
+ AnimationHelper::SampleAnimations(mAnimStorage,
+ !mPreviousFrameTimeStamp.IsNull() ?
+ mPreviousFrameTimeStamp : animTime);
+
+ // Reset the previous time stamp if we don't already have any running
+ // animations to avoid using the time which is far behind for newly
+ // started animations.
+ mPreviousFrameTimeStamp =
+ mAnimStorage->AnimatedValueCount() ? animTime : TimeStamp();
}
void
WebRenderBridgeParent::SampleAnimations(nsTArray<WrOpacityProperty>& aOpacityArray,
nsTArray<WrTransformProperty>& aTransformArray)
{
AdvanceAnimations();
--- a/gfx/layers/wr/WebRenderBridgeParent.h
+++ b/gfx/layers/wr/WebRenderBridgeParent.h
@@ -276,16 +276,17 @@ private:
std::unordered_set<uint64_t> mFontKeys;
// mActiveAnimations is used to avoid leaking animations when WebRenderBridgeParent is
// destroyed abnormally and Tab move between different windows.
std::unordered_set<uint64_t> mActiveAnimations;
nsDataHashtable<nsUint64HashKey, RefPtr<WebRenderImageHost>> mAsyncCompositables;
nsDataHashtable<nsUint64HashKey, RefPtr<WebRenderImageHost>> mExternalImageIds;
nsTArray<ImageCompositeNotificationInfo> mImageCompositeNotifications;
+ TimeStamp mPreviousFrameTimeStamp;
// These fields keep track of the latest layer observer epoch values in the child and the
// parent. mChildLayerObserverEpoch is the latest epoch value received from the child.
// mParentLayerObserverEpoch is the latest epoch value that we have told TabParent about
// (via ObserveLayerUpdate).
uint64_t mChildLayerObserverEpoch;
uint64_t mParentLayerObserverEpoch;
std::queue<PendingTransactionId> mPendingTransactionIds;