Index: cc/trees/layer_tree_host_impl.cc |
diff --git a/cc/trees/layer_tree_host_impl.cc b/cc/trees/layer_tree_host_impl.cc |
index bb1be9856d093663f5533a2c4a6cff40c0a50cfd..7e6f94bb93aea106fb2c3c85f168e9d8a6af93d1 100644 |
--- a/cc/trees/layer_tree_host_impl.cc |
+++ b/cc/trees/layer_tree_host_impl.cc |
@@ -259,7 +259,6 @@ LayerTreeHostImpl::LayerTreeHostImpl( |
if (settings.calculate_top_controls_position) { |
top_controls_manager_ = |
TopControlsManager::Create(this, |
- settings.top_controls_height, |
settings.top_controls_show_threshold, |
settings.top_controls_hide_threshold); |
@@ -1633,9 +1632,13 @@ void LayerTreeHostImpl::UpdateViewportContainerSizes() { |
// Adjust the inner viewport by shrinking/expanding the container to account |
// for the change in top controls height since the last Resize from Blink. |
+ float top_controls_layout_height = |
+ active_tree_->top_controls_shrink_blink_size() |
+ ? active_tree_->top_controls_height() |
+ : 0.f; |
inner_container->SetBoundsDelta( |
- gfx::Vector2dF(0, active_tree_->top_controls_layout_height() - |
- active_tree_->total_top_controls_content_offset())); |
+ gfx::Vector2dF(0, top_controls_layout_height - |
+ active_tree_->total_top_controls_content_offset())); |
if (!outer_container || outer_container->BoundsForScrolling().IsEmpty()) |
return; |
@@ -1658,11 +1661,24 @@ void LayerTreeHostImpl::UpdateViewportContainerSizes() { |
anchor.ResetViewportToAnchoredPosition(); |
} |
-void LayerTreeHostImpl::SetTopControlsLayoutHeight(float height) { |
- if (active_tree_->top_controls_layout_height() == height) |
+void LayerTreeHostImpl::SetTopControlsHeight(float height) { |
+ if (active_tree_->top_controls_height() == height) |
return; |
- active_tree_->set_top_controls_layout_height(height); |
+ // Adjust the delta to maintain the current top controls offset. |
+ active_tree_->set_top_controls_delta(active_tree_->top_controls_delta() - |
+ active_tree_->top_controls_height() + |
+ height); |
+ active_tree_->set_top_controls_height(height); |
+ UpdateViewportContainerSizes(); |
+ SetFullRootLayerDamage(); |
+} |
+ |
+void LayerTreeHostImpl::SetTopControlsShrinkBlinkSize(bool shrink) { |
+ if (active_tree_->top_controls_shrink_blink_size() == shrink) |
+ return; |
+ |
+ active_tree_->set_top_controls_shrink_blink_size(shrink); |
UpdateViewportContainerSizes(); |
SetFullRootLayerDamage(); |
} |
@@ -1777,6 +1793,8 @@ void LayerTreeHostImpl::ActivateSyncTree() { |
root_layer_scroll_offset_delegate_); |
if (top_controls_manager_) { |
+ top_controls_manager_->SetTopControlsHeight( |
+ active_tree_->top_controls_height()); |
top_controls_manager_->SetControlsTopOffset( |
active_tree_->total_top_controls_content_offset() - |
top_controls_manager_->top_controls_height()); |
@@ -2242,13 +2260,13 @@ void LayerTreeHostImpl::DidChangeTopControlsPosition() { |
void LayerTreeHostImpl::SetControlsTopOffset(float offset) { |
float current_top_offset = active_tree_->top_controls_content_offset() - |
- top_controls_manager_->top_controls_height(); |
+ active_tree_->top_controls_height(); |
active_tree_->set_top_controls_delta(offset - current_top_offset); |
} |
float LayerTreeHostImpl::ControlsTopOffset() const { |
return active_tree_->total_top_controls_content_offset() - |
- top_controls_manager_->top_controls_height(); |
+ active_tree_->top_controls_height(); |
} |
void LayerTreeHostImpl::BindToClient(InputHandlerClient* client) { |