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 e49dcfec0392399e8d24aaba917436b782615605..11fb4a41ba86828c4f66d1f4570d036bbecd1561 100644 |
--- a/cc/trees/layer_tree_host_impl.cc |
+++ b/cc/trees/layer_tree_host_impl.cc |
@@ -259,15 +259,8 @@ 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); |
- |
- // TODO(bokan): This is a quick fix. The browser should lock the top |
- // controls to shown on creation but this appears not to work. Tracked |
- // in crbug.com/417680. |
- // Initialize with top controls showing. |
- SetControlsTopOffset(0.f); |
} |
} |
@@ -1676,9 +1669,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; |
@@ -1701,15 +1698,6 @@ void LayerTreeHostImpl::UpdateViewportContainerSizes() { |
anchor.ResetViewportToAnchoredPosition(); |
} |
-void LayerTreeHostImpl::SetTopControlsLayoutHeight(float height) { |
- if (active_tree_->top_controls_layout_height() == height) |
- return; |
- |
- active_tree_->set_top_controls_layout_height(height); |
- UpdateViewportContainerSizes(); |
- SetFullRootLayerDamage(); |
-} |
- |
void LayerTreeHostImpl::SynchronouslyInitializeAllTiles() { |
// Only valid for the single-threaded non-scheduled/synchronous case |
// using the zero copy raster worker pool. |
@@ -1784,6 +1772,7 @@ void LayerTreeHostImpl::CreatePendingTree() { |
pending_tree_->set_top_controls_delta( |
active_tree_->top_controls_delta() - |
active_tree_->sent_top_controls_delta()); |
+ pending_tree_->set_top_controls_height(active_tree_->top_controls_height()); |
client_->OnCanDrawStateChanged(CanDraw()); |
TRACE_EVENT_ASYNC_BEGIN0("cc", "PendingTree:waiting", pending_tree_.get()); |
@@ -1820,9 +1809,11 @@ 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()); |
+ active_tree_->top_controls_height()); |
} |
UpdateViewportContainerSizes(); |
@@ -2282,13 +2273,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) { |