Chromium Code Reviews| Index: cc/layer_tree_host_impl.cc |
| diff --git a/cc/layer_tree_host_impl.cc b/cc/layer_tree_host_impl.cc |
| index 55f6452ded8bc55344b72f71dc08478de00335a7..f91f2a9a1890ca2e73bae2c0e7aab2731c63a287 100644 |
| --- a/cc/layer_tree_host_impl.cc |
| +++ b/cc/layer_tree_host_impl.cc |
| @@ -1724,4 +1724,31 @@ void LayerTreeHostImpl::animateScrollbarsRecursive(LayerImpl* layer, base::TimeT |
| animateScrollbarsRecursive(layer->children()[i], time); |
| } |
| +// static |
| +LayerImpl* LayerTreeHostImpl::getNonCompositedContentRootLayerRecursive(LayerImpl* layer) |
| +{ |
| + DCHECK(layer); |
|
enne (OOO)
2013/01/03 23:55:30
The root layer could be null. I think it'd be bet
Leandro GraciĆ” Gil
2013/01/04 00:41:23
Done.
|
| + |
| + if (layer->drawsContent()) |
| + return layer; |
| + |
| + for (LayerImpl::LayerList::const_iterator it = layer->children().begin(); |
| + it != layer->children().end(); ++it) { |
| + LayerImpl* nccr = getNonCompositedContentRootLayerRecursive(*it); |
| + if (nccr) |
| + return nccr; |
| + } |
| + |
| + return NULL; |
| +} |
| + |
| +scoped_refptr<PicturePileImpl> LayerTreeHostImpl::capturePicturePile() |
| +{ |
| + // Non-composited content root is the first drawable picture layer we find |
| + // in a depth-first exploration from the root. |
| + LayerTreeImpl* tree = pendingTree() ? pendingTree() : activeTree(); |
| + const LayerImpl* layer = getNonCompositedContentRootLayerRecursive(tree->RootLayer()); |
| + return layer ? layer->GetPicturePileClone() : scoped_refptr<PicturePileImpl>(); |
| +} |
| + |
| } // namespace cc |