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

Unified Diff: cc/trees/layer_tree_host_impl.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_impl.h ('k') | cc/trees/layer_tree_host_impl_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 10b06854b8fb1f5367eb3c08021d2442493aaf66..864923a5f146212b275ab0f476c70e0ab987cd47 100644
--- a/cc/trees/layer_tree_host_impl.cc
+++ b/cc/trees/layer_tree_host_impl.cc
@@ -243,15 +243,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);
}
}
@@ -1660,9 +1653,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;
@@ -1685,15 +1682,6 @@ void LayerTreeHostImpl::UpdateViewportContainerSizes() {
anchor.ResetViewportToAnchoredPosition();
}
-void LayerTreeHostImpl::SetTopControlsLayoutHeight(float height) {
- if (active_tree_->top_controls_layout_height() == height)
- return;
-
- active_tree_->set_top_controls_layout_height(height);
- UpdateViewportContainerSizes();
- SetFullRootLayerDamage();
-}
-
void LayerTreeHostImpl::SynchronouslyInitializeAllTiles() {
// Only valid for the single-threaded non-scheduled/synchronous case
// using the zero copy raster worker pool.
@@ -1768,6 +1756,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());
@@ -1804,9 +1793,11 @@ 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());
+ active_tree_->top_controls_height());
}
UpdateViewportContainerSizes();
@@ -2270,13 +2261,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) {
« no previous file with comments | « cc/trees/layer_tree_host_impl.h ('k') | cc/trees/layer_tree_host_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698