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

Unified Diff: cc/trees/layer_tree_host_common.h

Issue 22567004: Ignore should-scroll-on-main-thread if main frame is not scrollable (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 4 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.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/trees/layer_tree_host_common.h
diff --git a/cc/trees/layer_tree_host_common.h b/cc/trees/layer_tree_host_common.h
index 05affee8f31d58da72b20647ce06fc1736726711..19ca98841eddc8d774cd9c5bfe147e6064f2e445 100644
--- a/cc/trees/layer_tree_host_common.h
+++ b/cc/trees/layer_tree_host_common.h
@@ -118,6 +118,9 @@ class CC_EXPORT LayerTreeHostCommon {
template <typename LayerType>
static LayerType* FindLayerInSubtree(LayerType* root_layer, int layer_id);
+ template <typename LayerType>
+ static LayerType* FindFirstScrollableLayer(LayerType* root_layer);
+
static Layer* get_child_as_raw_ptr(
const LayerList& children,
size_t index) {
@@ -184,6 +187,24 @@ LayerType* LayerTreeHostCommon::FindLayerInSubtree(LayerType* root_layer,
}
template <typename LayerType>
+LayerType* LayerTreeHostCommon::FindFirstScrollableLayer(LayerType* layer) {
+ if (!layer)
+ return NULL;
+
+ if (layer->scrollable())
+ return layer;
+
+ for (size_t i = 0; i < layer->children().size(); ++i) {
+ LayerType* current = get_child_as_raw_ptr(layer->children(), i);
+ LayerType* found = FindFirstScrollableLayer(current);
+ if (found)
+ return found;
+ }
+
+ return NULL;
+}
+
+template <typename LayerType>
void LayerTreeHostCommon::CallFunctionForSubtree(
LayerType* root_layer,
const base::Callback<void(LayerType* layer)>& function) {
« no previous file with comments | « cc/trees/layer_tree_host.cc ('k') | cc/trees/layer_tree_host_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698