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

Unified Diff: cc/trees/layer_tree_host.cc

Issue 901813002: Normalize top controls offset to (0, 1), Chromium-side. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 10 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 0f48cb205dda2d31116c2cc9ea61a9832e7302e9..e03e64fe7281be019e9266e52eefe08e1f185247 100644
--- a/cc/trees/layer_tree_host.cc
+++ b/cc/trees/layer_tree_host.cc
@@ -118,7 +118,7 @@ LayerTreeHost::LayerTreeHost(
debug_state_(settings.initial_debug_state),
top_controls_shrink_blink_size_(false),
top_controls_height_(0.f),
- top_controls_content_offset_(0.f),
+ top_controls_shown_ratio_(0.f),
device_scale_factor_(1.f),
visible_(true),
page_scale_factor_(1.f),
@@ -328,20 +328,10 @@ void LayerTreeHost::FinishCommitOnImplThread(LayerTreeHostImpl* host_impl) {
sync_tree->PassSwapPromises(&swap_promise_list_);
- // Track the change in top controls height to offset the top_controls_delta
- // properly. This is so that the top controls offset will be maintained
- // across height changes.
- float top_controls_height_delta =
- sync_tree->top_controls_height() - top_controls_height_;
-
sync_tree->set_top_controls_shrink_blink_size(
top_controls_shrink_blink_size_);
sync_tree->set_top_controls_height(top_controls_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() -
- top_controls_height_delta);
- sync_tree->set_sent_top_controls_delta(0.f);
+ sync_tree->PushTopControlsFromMainThread(top_controls_shown_ratio_);
host_impl->SetUseGpuRasterization(UseGpuRasterization());
host_impl->set_gpu_rasterization_status(GetGpuRasterizationStatus());
@@ -684,11 +674,11 @@ void LayerTreeHost::SetTopControlsHeight(float height) {
SetNeedsCommit();
}
-void LayerTreeHost::SetTopControlsContentOffset(float offset) {
- if (top_controls_content_offset_ == offset)
+void LayerTreeHost::SetTopControlsShownRatio(float ratio) {
+ if (top_controls_shown_ratio_ == ratio)
return;
- top_controls_content_offset_ = offset;
+ top_controls_shown_ratio_ = ratio;
SetNeedsCommit();
}

Powered by Google App Engine
This is Rietveld 408576698