Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(286)

Unified Diff: cc/trees/layer_tree_host.cc

Issue 511253003: Made Blink aware of top controls offset (Chromium-side) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added top_controls_content_offset Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: cc/trees/layer_tree_host.cc
diff --git a/cc/trees/layer_tree_host.cc b/cc/trees/layer_tree_host.cc
index fc99e9e92229c86a9cdddb3ce16ed3cc11387ed8..f64dfef00e8042077474c959b99cb7ec20386255 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,17 @@ void LayerTreeHost::FinishCommitOnImplThread(LayerTreeHostImpl* host_impl) {
sync_tree->PassSwapPromises(&swap_promise_list_);
+ sync_tree->set_top_controls_layout_height(top_controls_layout_height_);
+ sync_tree->set_top_controls_content_offset(top_controls_content_offset_);
+ 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 +634,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 +1086,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 +1107,10 @@ void LayerTreeHost::ApplyScrollAndScale(ScrollAndScaleSet* info) {
}
ApplyPageScaleDeltaFromImplSide(info->page_scale_delta);
- client_->ApplyScrollAndScale(
+ client_->ApplyViewportProperties(
inner_viewport_scroll_delta + outer_viewport_scroll_delta,
- info->page_scale_delta);
+ info->page_scale_delta,
+ info->top_controls_delta);
}
}

Powered by Google App Engine
This is Rietveld 408576698