Bug 1365161 - Ensure dynamic toolbar static snapshot visibility stays in sync with the real toolbar chrome r=botond,jchen

There were two issues that prevented the static snapshot toolbar and
real chrome toolbar from staying in sync.

1) When a page would resize such as when going fullscreen, if the
root content document was not scrollable, the animator would not receive
root composition page size updates. The page resize is used by the
animator to hide the static snapshot, so it would remain visible while
the real chrome toolbar would be hidden.

2) Certain places in UI java code would toggle the chrome state directly
instead of going through the animator to change the state.

MozReview-Commit-ID: DCQgRFS0UAO
This commit is contained in:
Randall Barker
2017-05-17 15:18:04 -07:00
parent 2453436c47
commit e61f01164e
5 changed files with 74 additions and 64 deletions

View File

@@ -945,23 +945,24 @@ AsyncCompositionManager::ApplyAsyncContentTransformToTree(Layer *aLayer,
if (*aOutFoundRoot) {
mRootScrollableId = metrics.GetScrollId();
Compositor* compositor = mLayerManager->GetCompositor();
if (mIsFirstPaint) {
if (CompositorBridgeParent* bridge = compositor->GetCompositorBridgeParent()) {
AndroidDynamicToolbarAnimator* animator = bridge->GetAPZCTreeManager()->GetAndroidDynamicToolbarAnimator();
MOZ_ASSERT(animator);
if (CompositorBridgeParent* bridge = compositor->GetCompositorBridgeParent()) {
AndroidDynamicToolbarAnimator* animator = bridge->GetAPZCTreeManager()->GetAndroidDynamicToolbarAnimator();
MOZ_ASSERT(animator);
if (mIsFirstPaint) {
animator->UpdateRootFrameMetrics(metrics);
animator->FirstPaint();
mIsFirstPaint = false;
}
}
if (mLayersUpdated) {
if (CompositorBridgeParent* bridge = compositor->GetCompositorBridgeParent()) {
AndroidDynamicToolbarAnimator* animator = bridge->GetAPZCTreeManager()->GetAndroidDynamicToolbarAnimator();
MOZ_ASSERT(animator);
if (mLayersUpdated) {
animator->NotifyLayersUpdated();
mLayersUpdated = false;
}
// If this is not actually the root content then the animator is not getting updated in AsyncPanZoomController::NotifyLayersUpdated
// because the root content document is not scrollable. So update it here so it knows if the root composition size has changed.
if (!metrics.IsRootContent()) {
animator->MaybeUpdateCompositionSizeAndRootFrameMetrics(metrics);
}
mLayersUpdated = false;
}
mIsFirstPaint = false;
fixedLayerMargins = mFixedLayerMargins;
}
}