OSDN Git Service

Support for getting the background color
authorJohn Reck <jreck@google.com>
Tue, 14 Jun 2011 22:18:47 +0000 (15:18 -0700)
committerJohn Reck <jreck@google.com>
Tue, 14 Jun 2011 22:54:38 +0000 (15:54 -0700)
Change-Id: Ia8b0f97a5d50b3c16b8d59bb7af42899a614b676

Source/WebKit/android/nav/WebView.cpp

index 61bc159..236c07b 100644 (file)
@@ -2527,6 +2527,19 @@ static void nativeSetExpandedTileBounds(JNIEnv*, jobject, jboolean enabled)
     TilesManager::instance()->setExpandedTileBounds(enabled);
 }
 
+static int nativeGetBackgroundColor(JNIEnv* env, jobject obj)
+{
+    WebView* view = GET_NATIVE_VIEW(env, obj);
+    BaseLayerAndroid* baseLayer = view->getBaseLayer();
+    if (baseLayer) {
+        WebCore::Color color = baseLayer->getBackgroundColor();
+        if (color.isValid())
+            return SkColorSetARGB(color.alpha(), color.red(),
+                                  color.green(), color.blue());
+    }
+    return SK_ColorWHITE;
+}
+
 /*
  * JNI registration
  */
@@ -2709,6 +2722,8 @@ static JNINativeMethod gJavaWebViewMethods[] = {
         (void*) nativeScrollLayer },
     { "nativeSetExpandedTileBounds", "(Z)V",
         (void*) nativeSetExpandedTileBounds },
+    { "nativeGetBackgroundColor", "()I",
+        (void*) nativeGetBackgroundColor },
 };
 
 int registerWebView(JNIEnv* env)