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..53085fcbd7ad21e7245d954f69c562b5f4583f98 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); |
} |
} |
@@ -1633,9 +1626,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 +1655,26 @@ 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; |
+ |
+ // 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(); |
+ SetNeedsRedraw(); |
+ active_tree_->set_needs_update_draw_properties(); |
+ SetFullRootLayerDamage(); |
+} |
+ |
+void LayerTreeHostImpl::SetTopControlsShrinkBlinkSize(bool shrink) { |
aelias_OOO_until_Jul13
2014/11/21 04:19:21
I don't see any calls to this method in this patch
aelias_OOO_until_Jul13
2014/11/21 04:19:21
I don't see any calls to this method in this patch
David Trainor- moved to gerrit
2014/11/22 00:35:30
Good call. Removed.
|
+ if (active_tree_->top_controls_shrink_blink_size() == shrink) |
return; |
- active_tree_->set_top_controls_layout_height(height); |
+ active_tree_->set_top_controls_shrink_blink_size(shrink); |
UpdateViewportContainerSizes(); |
SetFullRootLayerDamage(); |
} |
@@ -1741,6 +1753,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()); |
@@ -1777,6 +1790,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 +2257,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) { |