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

Unified Diff: cc/layer_tree_host_common.h

Issue 12407002: Align physical pixels of scrolled layers (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 10 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 | « no previous file | cc/layer_tree_host_common.cc » ('j') | cc/layer_tree_host_common.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/layer_tree_host_common.h
diff --git a/cc/layer_tree_host_common.h b/cc/layer_tree_host_common.h
index 8d8e5d9e64c98eaa2b170935d8e76f8f35375d02..0c998f4c513c5480ffb05eeba2df8648fc0fd34f 100644
--- a/cc/layer_tree_host_common.h
+++ b/cc/layer_tree_host_common.h
@@ -39,6 +39,11 @@ public:
// from the given root layer (including mask and replica layers).
template<typename LayerType> static LayerType* findLayerInSubtree(LayerType* rootLayer, int layerId);
+ // Content layers can be either directly scrollable or contained in an outer
+ // scrolling layer which applies the scroll transform. Given a content layer,
+ // this function returns the associated scroll layer if any.
+ template<typename LayerType> static LayerType* findScrollLayerForContentLayer(LayerType* layer);
+
static Layer* getChildAsRawPtr(const std::vector<scoped_refptr<Layer> >& children, size_t index)
{
return children[index].get();
@@ -113,6 +118,21 @@ void LayerTreeHostCommon::callFunctionForSubtree(LayerType* rootLayer)
callFunctionForSubtree<Function>(getChildAsRawPtr(rootLayer->children(), i));
}
+template<typename LayerType>
+LayerType* LayerTreeHostCommon::findScrollLayerForContentLayer(LayerType* layer)
+{
+ if (!layer)
+ return 0;
+
+ if (layer->scrollable())
+ return layer;
+
+ if (layer->drawsContent() && layer->parent() && layer->parent()->scrollable())
+ return layer->parent();
+
+ return 0;
+}
+
} // namespace cc
#endif // CC_LAYER_TREE_HOST_COMMON_H_
« no previous file with comments | « no previous file | cc/layer_tree_host_common.cc » ('j') | cc/layer_tree_host_common.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698