From 5846115845c59006cf87bd81103e1414ee7da85d Mon Sep 17 00:00:00 2001 From: Dorel Luca Date: Thu, 26 Apr 2018 05:07:47 +0300 Subject: [PATCH] Backed out 2 changesets (bug 1456679) for Reftests failure. CLOSED TREE Backed out changeset c40209504a45 (bug 1456679) Backed out changeset 351ae90cc6a0 (bug 1456679) --- gfx/layers/AnimationHelper.cpp | 8 ++----- gfx/layers/AnimationHelper.h | 7 +------ gfx/layers/ipc/WebRenderMessages.ipdlh | 2 ++ gfx/layers/wr/WebRenderBridgeParent.cpp | 28 +++++++++++++++---------- gfx/layers/wr/WebRenderBridgeParent.h | 6 ++---- layout/painting/nsDisplayList.cpp | 11 ++++++++-- 6 files changed, 33 insertions(+), 29 deletions(-) diff --git a/gfx/layers/AnimationHelper.cpp b/gfx/layers/AnimationHelper.cpp index 90ee0040db88..fda9500a27d8 100644 --- a/gfx/layers/AnimationHelper.cpp +++ b/gfx/layers/AnimationHelper.cpp @@ -546,16 +546,15 @@ AnimationHelper::GetNextCompositorAnimationsId() return nextId; } -bool +void AnimationHelper::SampleAnimations(CompositorAnimationStorage* aStorage, TimeStamp aTime) { MOZ_ASSERT(aStorage); - bool isAnimating = false; // Do nothing if there are no compositor animations if (!aStorage->AnimationsCount()) { - return isAnimating; + return; } //Sample the animations in CompositorAnimationStorage @@ -566,7 +565,6 @@ AnimationHelper::SampleAnimations(CompositorAnimationStorage* aStorage, continue; } - isAnimating = true; RefPtr animationValue; InfallibleTArray animationData; AnimationHelper::SetAnimations(*animations, @@ -628,8 +626,6 @@ AnimationHelper::SampleAnimations(CompositorAnimationStorage* aStorage, MOZ_ASSERT_UNREACHABLE("Unhandled animated property"); } } - - return isAnimating; } } // namespace layers diff --git a/gfx/layers/AnimationHelper.h b/gfx/layers/AnimationHelper.h index 410208d9ef9d..f5f410b60e37 100644 --- a/gfx/layers/AnimationHelper.h +++ b/gfx/layers/AnimationHelper.h @@ -248,13 +248,8 @@ public: * Sample animation based a given time stamp |aTime| and the animation * data inside CompositorAnimationStorage |aStorage|. The animated values * after sampling will be stored in CompositorAnimationStorage as well. - * - * Returns true if there is any animation. - * Note that even if there are only in-delay phase animations (i.e. not - * visually effective), this function returns true to ensure we composite - * again on the next tick. */ - static bool + static void SampleAnimations(CompositorAnimationStorage* aStorage, TimeStamp aTime); }; diff --git a/gfx/layers/ipc/WebRenderMessages.ipdlh b/gfx/layers/ipc/WebRenderMessages.ipdlh index a374f564c554..f119d89882d2 100644 --- a/gfx/layers/ipc/WebRenderMessages.ipdlh +++ b/gfx/layers/ipc/WebRenderMessages.ipdlh @@ -53,6 +53,8 @@ struct OpAddExternalImage { struct OpAddCompositorAnimations { CompositorAnimations data; + OptionalTransform transform; + OptionalOpacity opacity; }; struct OpAddPipelineIdForCompositable { diff --git a/gfx/layers/wr/WebRenderBridgeParent.cpp b/gfx/layers/wr/WebRenderBridgeParent.cpp index 1d3f60ce4aa3..777b1c91f7d4 100644 --- a/gfx/layers/wr/WebRenderBridgeParent.cpp +++ b/gfx/layers/wr/WebRenderBridgeParent.cpp @@ -776,6 +776,15 @@ WebRenderBridgeParent::ProcessWebRenderParentCommands(const InfallibleTArraySetAnimations(data.id(), data.animations()); mActiveAnimations.insert(data.id()); + // Store the default opacity + if (op.opacity().type() == OptionalOpacity::Tfloat) { + mAnimStorage->SetAnimatedValue(data.id(), op.opacity().get_float()); + } + // Store the default transform + if (op.transform().type() == OptionalTransform::TMatrix4x4) { + Matrix4x4 transform(Move(op.transform().get_Matrix4x4())); + mAnimStorage->SetAnimatedValue(data.id(), Move(transform)); + } } break; } @@ -1167,7 +1176,7 @@ WebRenderBridgeParent::ActorDestroy(ActorDestroyReason aWhy) Destroy(); } -bool +void WebRenderBridgeParent::AdvanceAnimations() { if (CompositorBridgeParent* cbp = GetRootCompositorBridgeParent()) { @@ -1178,15 +1187,15 @@ WebRenderBridgeParent::AdvanceAnimations() // refresh mode, on the testing mode animations on the compositor are // synchronously composed, so we don't need to worry about the time gap // between the main thread and compositor thread. - return AnimationHelper::SampleAnimations(mAnimStorage, *testingTimeStamp); + AnimationHelper::SampleAnimations(mAnimStorage, *testingTimeStamp); + return; } } TimeStamp lastComposeTime = mCompositorScheduler->GetLastComposeTime(); // if we have already mPreviousTimeStamp, use it since on the compositor the // time in the previous tick is more closer to the main-thread tick time. - const bool isAnimating = - AnimationHelper::SampleAnimations(mAnimStorage, + AnimationHelper::SampleAnimations(mAnimStorage, !mPreviousFrameTimeStamp.IsNull() ? mPreviousFrameTimeStamp : lastComposeTime); @@ -1196,15 +1205,13 @@ WebRenderBridgeParent::AdvanceAnimations() // started animations. mPreviousFrameTimeStamp = mAnimStorage->AnimatedValueCount() ? lastComposeTime : TimeStamp(); - - return isAnimating; } -bool +void WebRenderBridgeParent::SampleAnimations(nsTArray& aOpacityArray, nsTArray& aTransformArray) { - const bool isAnimating = AdvanceAnimations(); + AdvanceAnimations(); // return the animated data if has if (mAnimStorage->AnimatedValueCount()) { @@ -1220,8 +1227,6 @@ WebRenderBridgeParent::SampleAnimations(nsTArray& aOpacit } } } - - return isAnimating; } void @@ -1268,7 +1273,8 @@ WebRenderBridgeParent::CompositeToTarget(gfx::DrawTarget* aTarget, const gfx::In nsTArray opacityArray; nsTArray transformArray; - if (SampleAnimations(opacityArray, transformArray)) { + SampleAnimations(opacityArray, transformArray); + if (!transformArray.IsEmpty() || !opacityArray.IsEmpty()) { ScheduleGenerateFrame(); } // We do this even if the arrays are empty, because it will clear out any diff --git a/gfx/layers/wr/WebRenderBridgeParent.h b/gfx/layers/wr/WebRenderBridgeParent.h index 5d68f62a68d4..0930ef53b31e 100644 --- a/gfx/layers/wr/WebRenderBridgeParent.h +++ b/gfx/layers/wr/WebRenderBridgeParent.h @@ -214,10 +214,8 @@ private: bool ShouldParentObserveEpoch(); mozilla::ipc::IPCResult HandleShutdown(); - // Returns true if there is any animation (including animations in delay - // phase). - bool AdvanceAnimations(); - bool SampleAnimations(nsTArray& aOpacityArray, + void AdvanceAnimations(); + void SampleAnimations(nsTArray& aOpacityArray, nsTArray& aTransformArray); CompositorBridgeParent* GetRootCompositorBridgeParent() const; diff --git a/layout/painting/nsDisplayList.cpp b/layout/painting/nsDisplayList.cpp index 142da47a6721..878cbcd7e800 100644 --- a/layout/painting/nsDisplayList.cpp +++ b/layout/painting/nsDisplayList.cpp @@ -6701,12 +6701,14 @@ nsDisplayOpacity::CreateWebRenderCommands(mozilla::wr::DisplayListBuilder& aBuil if (!animationInfo.GetAnimations().IsEmpty()) { opacityForSC = nullptr; + OptionalOpacity opacityForCompositor = mOpacity; prop.id = animationsId; prop.effect_type = wr::WrAnimationType::Opacity; OpAddCompositorAnimations - anim(CompositorAnimations(animationInfo.GetAnimations(), animationsId)); + anim(CompositorAnimations(animationInfo.GetAnimations(), animationsId), + void_t(), opacityForCompositor); aManager->WrBridge()->AddWebRenderParentCommand(anim); aManager->AddActiveCompositorAnimationId(animationsId); } else if (animationsId) { @@ -8552,8 +8554,13 @@ nsDisplayTransform::CreateWebRenderCommands(mozilla::wr::DisplayListBuilder& aBu prop.id = animationsId; prop.effect_type = wr::WrAnimationType::Transform; + // Pass default transform to compositor in case gecko fails to + // get animated value after animation sampling. + OptionalTransform transformForCompositor = newTransformMatrix; + OpAddCompositorAnimations - anim(CompositorAnimations(animationInfo.GetAnimations(), animationsId)); + anim(CompositorAnimations(animationInfo.GetAnimations(), animationsId), + transformForCompositor, void_t()); aManager->WrBridge()->AddWebRenderParentCommand(anim); aManager->AddActiveCompositorAnimationId(animationsId); } else if (animationsId) {