Index: cc/trees/layer_tree_host.cc |
diff --git a/cc/trees/layer_tree_host.cc b/cc/trees/layer_tree_host.cc |
index 515d42bdbea6e2d112127ea9cb2109f515481823..dce1d42e11d071384b5f9ee1dcaaa2b82446e791 100644 |
--- a/cc/trees/layer_tree_host.cc |
+++ b/cc/trees/layer_tree_host.cc |
@@ -107,6 +107,7 @@ LayerTreeHost::LayerTreeHost(LayerTreeHostClient* client, |
settings_(settings), |
debug_state_(settings.initial_debug_state), |
top_controls_layout_height_(0.f), |
+ top_controls_content_offset_(0.f), |
device_scale_factor_(1.f), |
visible_(true), |
page_scale_factor_(1.f), |
@@ -347,11 +348,23 @@ void LayerTreeHost::FinishCommitOnImplThread(LayerTreeHostImpl* host_impl) { |
sync_tree->PassSwapPromises(&swap_promise_list_); |
+ float top_controls_height = 0.f; |
+ |
+ if (host_impl->top_controls_manager()) |
+ top_controls_height = host_impl->top_controls_manager()->controls_height(); |
+ |
+ sync_tree->set_top_controls_layout_height(top_controls_layout_height_); |
+ sync_tree->set_top_controls_top_offset(top_controls_content_offset_ - |
+ top_controls_height); |
+ sync_tree->set_top_controls_delta( |
+ sync_tree->top_controls_delta() - |
+ sync_tree->sent_top_controls_delta()); |
+ sync_tree->set_sent_top_controls_delta(0.f); |
+ |
host_impl->SetUseGpuRasterization(UseGpuRasterization()); |
RecordGpuRasterizationHistogram(); |
host_impl->SetViewportSize(device_viewport_size_); |
- host_impl->SetTopControlsLayoutHeight(top_controls_layout_height_); |
host_impl->SetDeviceScaleFactor(device_scale_factor_); |
host_impl->SetDebugState(debug_state_); |
if (pending_page_scale_animation_) { |
@@ -627,12 +640,19 @@ void LayerTreeHost::SetViewportSize(const gfx::Size& device_viewport_size) { |
SetNeedsCommit(); |
} |
-void LayerTreeHost::SetTopControlsLayoutHeight( |
- float top_controls_layout_height) { |
- if (top_controls_layout_height_ == top_controls_layout_height) |
+void LayerTreeHost::SetTopControlsLayoutHeight(float height) { |
+ if (top_controls_layout_height_ == height) |
+ return; |
+ |
+ top_controls_layout_height_ = height; |
+ SetNeedsCommit(); |
+} |
+ |
+void LayerTreeHost::SetTopControlsContentOffset(float offset) { |
+ if (top_controls_content_offset_ == offset) |
return; |
- top_controls_layout_height_ = top_controls_layout_height; |
+ top_controls_content_offset_ = offset; |
SetNeedsCommit(); |
} |
@@ -1072,7 +1092,9 @@ void LayerTreeHost::ApplyScrollAndScale(ScrollAndScaleSet* info) { |
} |
if (!inner_viewport_scroll_delta.IsZero() || |
- !outer_viewport_scroll_delta.IsZero() || info->page_scale_delta != 1.f) { |
+ !outer_viewport_scroll_delta.IsZero() || |
+ info->page_scale_delta != 1.f || |
+ info->top_controls_delta) { |
// SetScrollOffsetFromImplSide above could have destroyed the tree, |
// so re-get this layer before doing anything to it. |
@@ -1091,9 +1113,10 @@ void LayerTreeHost::ApplyScrollAndScale(ScrollAndScaleSet* info) { |
} |
ApplyPageScaleDeltaFromImplSide(info->page_scale_delta); |
- client_->ApplyScrollAndScale( |
+ client_->ApplyViewportDeltas( |
inner_viewport_scroll_delta + outer_viewport_scroll_delta, |
- info->page_scale_delta); |
+ info->page_scale_delta, |
+ info->top_controls_delta); |
} |
} |