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

Unified Diff: cc/trees/layer_tree_host_impl.cc

Issue 565673003: Properly initialize top controls content offset on LayerTreeHost. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed up unit tests 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
« no previous file with comments | « cc/trees/layer_tree_host.cc ('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 2278a4ac23330a062951732300ed9ce145b70cb4..26e0690b81d48bfc8d2bf3d855bb27c9729a9fb2 100644
--- a/cc/trees/layer_tree_host_impl.cc
+++ b/cc/trees/layer_tree_host_impl.cc
@@ -273,6 +273,11 @@ LayerTreeHostImpl::LayerTreeHostImpl(
SetDebugState(settings.initial_debug_state);
+ // LTHI always has an active tree.
+ active_tree_ = LayerTreeImpl::create(this);
+ TRACE_EVENT_OBJECT_CREATED_WITH_ID(
+ TRACE_DISABLED_BY_DEFAULT("cc.debug"), "cc::LayerTreeHostImpl", id_);
+
if (settings.calculate_top_controls_position) {
top_controls_manager_ =
TopControlsManager::Create(this,
@@ -280,13 +285,6 @@ LayerTreeHostImpl::LayerTreeHostImpl(
settings.top_controls_show_threshold,
settings.top_controls_hide_threshold);
}
-
- SetDebugState(settings.initial_debug_state);
-
- // LTHI always has an active tree.
- active_tree_ = LayerTreeImpl::create(this);
- TRACE_EVENT_OBJECT_CREATED_WITH_ID(
- TRACE_DISABLED_BY_DEFAULT("cc.debug"), "cc::LayerTreeHostImpl", id_);
}
LayerTreeHostImpl::~LayerTreeHostImpl() {
@@ -1694,8 +1692,7 @@ void LayerTreeHostImpl::UpdateInnerViewportContainerSize() {
if (top_controls_manager_) {
container_layer->SetBoundsDelta(
gfx::Vector2dF(0, active_tree_->top_controls_layout_height() -
- active_tree_->total_top_controls_top_offset() -
- top_controls_manager_->controls_height()));
+ active_tree_->total_top_controls_content_offset()));
}
}
@@ -1821,7 +1818,8 @@ void LayerTreeHostImpl::ActivateSyncTree() {
if (top_controls_manager_) {
top_controls_manager_->SetControlsTopOffset(
- active_tree_->total_top_controls_top_offset());
+ active_tree_->total_top_controls_content_offset() -
+ top_controls_manager_->top_controls_height());
}
UpdateInnerViewportContainerSize();
@@ -2230,12 +2228,14 @@ void LayerTreeHostImpl::DidChangeTopControlsPosition() {
}
void LayerTreeHostImpl::SetControlsTopOffset(float offset) {
- active_tree_->set_top_controls_delta(
- offset - active_tree_->top_controls_top_offset());
+ float current_top_offset = active_tree_->top_controls_content_offset() -
+ top_controls_manager_->top_controls_height();
+ active_tree_->set_top_controls_delta(offset - current_top_offset);
}
float LayerTreeHostImpl::ControlsTopOffset() const {
- return active_tree_->total_top_controls_top_offset();
+ return active_tree_->total_top_controls_content_offset() -
+ top_controls_manager_->top_controls_height();
}
void LayerTreeHostImpl::BindToClient(InputHandlerClient* client) {
« no previous file with comments | « cc/trees/layer_tree_host.cc ('k') | cc/trees/layer_tree_host_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698