Bug 1358781 - Android Dynamic Toolbar v3 keep the controller toolbar height in sync with the compositor toolbar height while animating r=kats
Android Dynamic Toolbar v3 toolbar height between controller
and compostior threads would get out sync during animation. Added code
to insure they stay in sync while the compositor thread is updating the
toolbar height during an animation. Also, when the controller thread was
canceling an animation, the compositor thread was not checking that it
was still animating before unlocking the toolbar.
MozReview-Commit-ID: 1TSfaRD0lMj
--- a/gfx/layers/apz/src/AndroidDynamicToolbarAnimator.cpp
+++ b/gfx/layers/apz/src/AndroidDynamicToolbarAnimator.cpp
@@ -325,16 +325,18 @@ AndroidDynamicToolbarAnimator::UpdateAni
AsyncCompositionManager* manager = parent->GetCompositionManager(nullptr);
if (manager) {
manager->SetFixedLayerMarginsBottom(GetFixedLayerMarginsBottom());
}
}
if (!continueAnimating) {
NotifyControllerAnimationStopped(mCompositorToolbarHeight);
+ } else {
+ UpdateControllerToolbarHeight(mCompositorToolbarHeight);
}
return continueAnimating;
}
void
AndroidDynamicToolbarAnimator::FirstPaint()
{
@@ -731,17 +733,20 @@ void
AndroidDynamicToolbarAnimator::StopCompositorAnimation()
{
if (!CompositorThreadHolder::IsInCompositorThread()) {
mControllerState = eAnimationStopPending;
CompositorThreadHolder::Loop()->PostTask(NewRunnableMethod(this, &AndroidDynamicToolbarAnimator::StopCompositorAnimation));
return;
}
- mToolbarState = eToolbarUnlocked;
+ if (mToolbarState == eToolbarAnimating) {
+ mToolbarState = eToolbarUnlocked;
+ }
+
NotifyControllerAnimationStopped(mCompositorToolbarHeight);
}
void
AndroidDynamicToolbarAnimator::NotifyControllerAnimationStopped(ScreenIntCoord aHeight)
{
if (!APZThreadUtils::IsControllerThread()) {
APZThreadUtils::RunOnControllerThread(NewRunnableMethod<ScreenIntCoord>(this, &AndroidDynamicToolbarAnimator::NotifyControllerAnimationStopped, aHeight));