summaryrefslogtreecommitdiffstats
path: root/Source/WebKit/android/nav
diff options
context:
space:
mode:
authorJohn Reck <jreck@google.com>2012-06-14 09:59:53 -0700
committerJohn Reck <jreck@google.com>2012-06-14 13:13:24 -0700
commitcc6ffa0710f304fbcaa43953b0dc89e1d9b931a2 (patch)
treeb10a20ff67277955a2527c8775f608d983cc31c1 /Source/WebKit/android/nav
parent236f8ddfbd94fc6e0e49c13495c8fe82d3218bc8 (diff)
downloadexternal_webkit-cc6ffa0710f304fbcaa43953b0dc89e1d9b931a2.zip
external_webkit-cc6ffa0710f304fbcaa43953b0dc89e1d9b931a2.tar.gz
external_webkit-cc6ffa0710f304fbcaa43953b0dc89e1d9b931a2.tar.bz2
Show layer tree in hierarchyviewer
Change-Id: I2a53b157d40c630e7ca1361f8e0c8aca1d6e8a4e
Diffstat (limited to 'Source/WebKit/android/nav')
-rw-r--r--Source/WebKit/android/nav/WebView.cpp28
1 files changed, 27 insertions, 1 deletions
diff --git a/Source/WebKit/android/nav/WebView.cpp b/Source/WebKit/android/nav/WebView.cpp
index 8e88131..c708c25 100644
--- a/Source/WebKit/android/nav/WebView.cpp
+++ b/Source/WebKit/android/nav/WebView.cpp
@@ -32,6 +32,7 @@
#include "BaseLayerAndroid.h"
#include "BaseRenderer.h"
#include "DrawExtra.h"
+#include "DumpLayer.h"
#include "Frame.h"
#include "GLWebViewState.h"
#include "GraphicsJNI.h"
@@ -995,6 +996,28 @@ static void nativeCopyBaseContentToPicture(JNIEnv *env, jobject obj, jobject pic
GET_NATIVE_VIEW(env, obj)->copyBaseContentToPicture(picture);
}
+static jboolean nativeDumpLayerContentToPicture(JNIEnv *env, jobject obj, jint instance,
+ jstring jclassName, jint layerId, jobject pict)
+{
+ bool success = false;
+ SkPicture* picture = GraphicsJNI::getNativePicture(env, pict);
+ std::string classname = jstringToStdString(env, jclassName);
+ BaseLayerAndroid* baseLayer = reinterpret_cast<WebView*>(instance)->getBaseLayer();
+ LayerAndroid* layer = baseLayer->findById(layerId);
+ SkSafeRef(layer);
+ if (layer && layer->subclassName() == classname) {
+ LayerContent* content = layer->content();
+ if (content) {
+ SkCanvas* canvas = picture->beginRecording(content->width(), content->height());
+ content->draw(canvas);
+ picture->endRecording();
+ success = true;
+ }
+ }
+ SkSafeUnref(layer);
+ return success;
+}
+
static bool nativeHasContent(JNIEnv *env, jobject obj)
{
return GET_NATIVE_VIEW(env, obj)->hasContent();
@@ -1187,7 +1210,8 @@ static void nativeDumpDisplayTree(JNIEnv* env, jobject jwebview, jstring jurl)
if (baseLayer) {
FILE* file = fopen(LAYERS_TREE_LOG_FILE,"w");
if (file) {
- baseLayer->dumpLayers(file, 0);
+ WebCore::FileLayerDumper dumper(file);
+ baseLayer->dumpLayers(&dumper);
fclose(file);
}
}
@@ -1355,6 +1379,8 @@ static JNINativeMethod gJavaWebViewMethods[] = {
(void*) nativeGetBaseLayer },
{ "nativeCopyBaseContentToPicture", "(Landroid/graphics/Picture;)V",
(void*) nativeCopyBaseContentToPicture },
+ { "nativeDumpLayerContentToPicture", "(ILjava/lang/String;ILandroid/graphics/Picture;)Z",
+ (void*) nativeDumpLayerContentToPicture },
{ "nativeHasContent", "()Z",
(void*) nativeHasContent },
{ "nativeDiscardAllTextures", "()V",