OSDN Git Service

merge in ics-release history after reset to master
authorThe Android Automerger <android-build@android.com>
Wed, 27 Jul 2011 13:48:58 +0000 (06:48 -0700)
committerThe Android Automerger <android-build@android.com>
Wed, 27 Jul 2011 13:48:58 +0000 (06:48 -0700)
Source/WebCore/html/HTMLBodyElement.cpp
Source/WebKit/android/nav/WebView.cpp

index 0c93c95..421e28e 100644 (file)
@@ -204,7 +204,7 @@ void HTMLBodyElement::insertedIntoDocument()
     if (settings) {
         String host = document()->baseURI().host().lower();
         if (settings->viewportWidth() == -1 && (host.startsWith("m.") || host.startsWith("mobile.")
-                || host.startsWith("wap.") || host.contains(".m.") || host.contains(".mobile." || host.contains(".wap.")))) {
+                || host.startsWith("wap.") || host.contains(".m.") || host.contains(".mobile.") || host.contains(".wap."))) {
             // fit mobile sites directly in the screen
             document()->processViewport("width=device-width");
         }
index 7057a54..6a95d33 100644 (file)
@@ -1587,6 +1587,15 @@ class GLDrawFunctor : Functor {
     jint extras;
 };
 
+static jobject createJavaRect(JNIEnv* env, int x, int y, int right, int bottom)
+{
+    jclass rectClass = env->FindClass("android/graphics/Rect");
+    jmethodID init = env->GetMethodID(rectClass, "<init>", "(IIII)V");
+    jobject rect = env->NewObject(rectClass, init, x, y, right, bottom);
+    env->DeleteLocalRef(rectClass);
+    return rect;
+}
+
 /*
  * Native JNI methods
  */
@@ -1600,12 +1609,8 @@ static jobject nativeCacheHitNodeBounds(JNIEnv *env, jobject obj)
 {
     WebCore::IntRect bounds = GET_NATIVE_VIEW(env, obj)
         ->m_cacheHitNode->originalAbsoluteBounds();
-    jclass rectClass = env->FindClass("android/graphics/Rect");
-    jmethodID init = env->GetMethodID(rectClass, "<init>", "(IIII)V");
-    jobject rect = env->NewObject(rectClass, init, bounds.x(),
-        bounds.y(), bounds.maxX(), bounds.maxY());
-    env->DeleteLocalRef(rectClass);
-    return rect;
+    return createJavaRect(env, bounds.x(), bounds.y(),
+                          bounds.maxX(), bounds.maxY());
 }
 
 static int nativeCacheHitNodePointer(JNIEnv *env, jobject obj)
@@ -1735,12 +1740,8 @@ static jobject nativeCursorNodeBounds(JNIEnv *env, jobject obj)
     const CachedNode* node = getCursorNode(env, obj, &frame);
     WebCore::IntRect bounds = node ? node->bounds(frame)
         : WebCore::IntRect(0, 0, 0, 0);
-    jclass rectClass = env->FindClass("android/graphics/Rect");
-    jmethodID init = env->GetMethodID(rectClass, "<init>", "(IIII)V");
-    jobject rect = env->NewObject(rectClass, init, bounds.x(),
-        bounds.y(), bounds.maxX(), bounds.maxY());
-    env->DeleteLocalRef(rectClass);
-    return rect;
+    return createJavaRect(env, bounds.x(), bounds.y(),
+                          bounds.maxX(), bounds.maxY());
 }
 
 static jint nativeCursorNodePointer(JNIEnv *env, jobject obj)
@@ -1966,22 +1967,16 @@ static jobject nativeFocusCandidateName(JNIEnv *env, jobject obj)
     return wtfStringToJstring(env, name);
 }
 
-static jobject createJavaRect(JNIEnv* env, int x, int y, int right, int bottom)
-{
-    jclass rectClass = env->FindClass("android/graphics/Rect");
-    jmethodID init = env->GetMethodID(rectClass, "<init>", "(IIII)V");
-    jobject rect = env->NewObject(rectClass, init, x, y, right, bottom);
-    env->DeleteLocalRef(rectClass);
-    return rect;
-}
-
 static jobject nativeFocusCandidateNodeBounds(JNIEnv *env, jobject obj)
 {
     const CachedFrame* frame;
     const CachedNode* node = getFocusCandidate(env, obj, &frame);
     WebCore::IntRect bounds = node ? node->bounds(frame)
         : WebCore::IntRect(0, 0, 0, 0);
-    return createJavaRect(env, bounds.x(), bounds.y(), bounds.maxX(), bounds.maxY());
+    // Inset the rect by 1 unit, so that the focus candidate's border can still
+    // be seen behind it.
+    return createJavaRect(env, bounds.x() + 1, bounds.y() + 1,
+                          bounds.maxX() - 1, bounds.maxY() - 1);
 }
 
 static jobject nativeFocusCandidatePaddingRect(JNIEnv *env, jobject obj)
@@ -2046,12 +2041,8 @@ static jobject nativeFocusNodeBounds(JNIEnv *env, jobject obj)
     const CachedNode* node = getFocusNode(env, obj, &frame);
     WebCore::IntRect bounds = node ? node->bounds(frame)
         : WebCore::IntRect(0, 0, 0, 0);
-    jclass rectClass = env->FindClass("android/graphics/Rect");
-    jmethodID init = env->GetMethodID(rectClass, "<init>", "(IIII)V");
-    jobject rect = env->NewObject(rectClass, init, bounds.x(),
-        bounds.y(), bounds.maxX(), bounds.maxY());
-    env->DeleteLocalRef(rectClass);
-    return rect;
+    return createJavaRect(env, bounds.x(), bounds.y(),
+                          bounds.maxX(), bounds.maxY());
 }
 
 static jint nativeFocusNodePointer(JNIEnv *env, jobject obj)