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

Unified Diff: cc/trees/layer_tree_host_impl.cc

Issue 2113483002: Make RootScroller set the outer viewport scroll layer in the compositor (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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_impl.cc
diff --git a/cc/trees/layer_tree_host_impl.cc b/cc/trees/layer_tree_host_impl.cc
index 53020f0522d00a13ce9c9cc55e55929cfe1c0380..e4d77f5b15b9d5768389de7dfc37e6f3983a94b0 100644
--- a/cc/trees/layer_tree_host_impl.cc
+++ b/cc/trees/layer_tree_host_impl.cc
@@ -82,6 +82,7 @@
#include "cc/trees/layer_tree_host.h"
#include "cc/trees/layer_tree_host_common.h"
#include "cc/trees/layer_tree_impl.h"
+#include "cc/trees/root_scroller_controller.h"
#include "cc/trees/single_thread_proxy.h"
#include "cc/trees/tree_synchronizer.h"
#include "gpu/GLES2/gl2extchromium.h"
@@ -266,6 +267,7 @@ LayerTreeHostImpl::LayerTreeHostImpl(
TopControlsManager::Create(this,
settings.top_controls_show_threshold,
settings.top_controls_hide_threshold);
+ root_scroller_controller_ = RootScrollerController::Create();
}
LayerTreeHostImpl::~LayerTreeHostImpl() {
@@ -2032,6 +2034,9 @@ void LayerTreeHostImpl::ActivateSyncTree() {
active_tree_->UpdatePropertyTreesForBoundsDelta();
UpdateViewportContainerSizes();
+ root_scroller_controller_->SetRootScrollerLayer(
+ active_tree_->RootScrollerLayer());
+
active_tree_->DidBecomeActive();
client_->RenewTreePriority();
// If we have any picture layers, then by activating we also modified tile
@@ -3049,10 +3054,18 @@ void LayerTreeHostImpl::DistributeScrollDelta(ScrollState* scroll_state) {
// Skip the outer viewport scroll layer so that we try to scroll the
// viewport only once. i.e. The inner viewport layer represents the
// viewport.
- if (!scroll_node->data.scrollable ||
- scroll_node->data.is_outer_viewport_scroll_layer)
- continue;
- current_scroll_chain.push_front(scroll_node);
+ if (scroll_node->data.scrollable &&
+ !scroll_node->data.is_outer_viewport_scroll_layer)
+ current_scroll_chain.push_front(scroll_node);
+
+ // TODO(bokan): We should modify the scroll tree to be built to take
+ // account of the root scroller.
+ // If we're reached the root scroller, don't keep chaining.
+ LayerImpl* root_scroller_layer =
+ root_scroller_controller()->GetRootScrollerLayer();
+ if (root_scroller_layer &&
+ scroll_node->owner_id == root_scroller_layer->id())
+ break;
}
}
scroll_state->set_scroll_chain_and_layer_tree(current_scroll_chain,

Powered by Google App Engine
This is Rietveld 408576698