summaryrefslogtreecommitdiffstats
path: root/cc/layer_tree_host_impl.cc
diff options
context:
space:
mode:
authorleandrogracia@chromium.org <leandrogracia@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-01-09 00:15:29 +0000
committerleandrogracia@chromium.org <leandrogracia@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-01-09 00:15:29 +0000
commitb9dcf43a024caa0d276da885dc457880db0c2d35 (patch)
tree21bc3571a4d9f0de965d94b390f44a09023953d8 /cc/layer_tree_host_impl.cc
parentb750dac8b02b2042db9f905ff6fed378fe80b9f7 (diff)
downloadchromium_src-b9dcf43a024caa0d276da885dc457880db0c2d35.zip
chromium_src-b9dcf43a024caa0d276da885dc457880db0c2d35.tar.gz
chromium_src-b9dcf43a024caa0d276da885dc457880db0c2d35.tar.bz2
Implement a method to access the non-composited content root layer picture pile.
This method is required to implement the CapturePicture API in Android WebView. BUG=167908 Review URL: https://chromiumcodereview.appspot.com/11731002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@175618 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'cc/layer_tree_host_impl.cc')
-rw-r--r--cc/layer_tree_host_impl.cc26
1 files changed, 26 insertions, 0 deletions
diff --git a/cc/layer_tree_host_impl.cc b/cc/layer_tree_host_impl.cc
index 9d42698..9c217b0 100644
--- a/cc/layer_tree_host_impl.cc
+++ b/cc/layer_tree_host_impl.cc
@@ -1709,4 +1709,30 @@ void LayerTreeHostImpl::animateScrollbarsRecursive(LayerImpl* layer, base::TimeT
animateScrollbarsRecursive(layer->children()[i], time);
}
+// static
+LayerImpl* LayerTreeHostImpl::getNonCompositedContentLayerRecursive(LayerImpl* layer)
+{
+ if (!layer)
+ return NULL;
+
+ if (layer->drawsContent())
+ return layer;
+
+ for (LayerImpl::LayerList::const_iterator it = layer->children().begin();
+ it != layer->children().end(); ++it) {
+ LayerImpl* nccr = getNonCompositedContentLayerRecursive(*it);
+ if (nccr)
+ return nccr;
+ }
+
+ return NULL;
+}
+
+skia::RefPtr<SkPicture> LayerTreeHostImpl::capturePicture()
+{
+ LayerTreeImpl* tree = pendingTree() ? pendingTree() : activeTree();
+ LayerImpl* layer = getNonCompositedContentLayerRecursive(tree->RootLayer());
+ return layer ? layer->getPicture() : skia::RefPtr<SkPicture>();
+}
+
} // namespace cc