| 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_
|
|
|