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

Unified Diff: cc/trees/layer_tree_host.cc

Issue 714003002: Allow changing top controls height (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased Created 6 years 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
« no previous file with comments | « cc/trees/layer_tree_host.h ('k') | cc/trees/layer_tree_host_impl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/trees/layer_tree_host.cc
diff --git a/cc/trees/layer_tree_host.cc b/cc/trees/layer_tree_host.cc
index c2fce2a6230b4c277c9dad1bea78c3ea613f8355..db12981b82e420ec92e64dd2f20f7b7bdda64f24 100644
--- a/cc/trees/layer_tree_host.cc
+++ b/cc/trees/layer_tree_host.cc
@@ -117,7 +117,8 @@ LayerTreeHost::LayerTreeHost(
num_failed_recreate_attempts_(0),
settings_(settings),
debug_state_(settings.initial_debug_state),
- top_controls_layout_height_(0.f),
+ top_controls_shrink_blink_size_(false),
+ top_controls_height_(0.f),
top_controls_content_offset_(0.f),
device_scale_factor_(1.f),
visible_(true),
@@ -370,10 +371,19 @@ void LayerTreeHost::FinishCommitOnImplThread(LayerTreeHostImpl* host_impl) {
sync_tree->PassSwapPromises(&swap_promise_list_);
- sync_tree->set_top_controls_layout_height(top_controls_layout_height_);
+ // 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());
+ sync_tree->sent_top_controls_delta() -
+ top_controls_height_delta);
sync_tree->set_sent_top_controls_delta(0.f);
host_impl->SetUseGpuRasterization(UseGpuRasterization());
@@ -657,11 +667,19 @@ void LayerTreeHost::SetViewportSize(const gfx::Size& device_viewport_size) {
SetNeedsCommit();
}
-void LayerTreeHost::SetTopControlsLayoutHeight(float height) {
- if (top_controls_layout_height_ == height)
+void LayerTreeHost::SetTopControlsShrinkBlinkSize(bool shrink) {
+ if (top_controls_shrink_blink_size_ == shrink)
+ return;
+
+ top_controls_shrink_blink_size_ = shrink;
+ SetNeedsCommit();
+}
+
+void LayerTreeHost::SetTopControlsHeight(float height) {
+ if (top_controls_height_ == height)
return;
- top_controls_layout_height_ = height;
+ top_controls_height_ = height;
SetNeedsCommit();
}
« no previous file with comments | « cc/trees/layer_tree_host.h ('k') | cc/trees/layer_tree_host_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698