summaryrefslogtreecommitdiffstats
path: root/WebKit/android/WebCoreSupport
diff options
context:
space:
mode:
Diffstat (limited to 'WebKit/android/WebCoreSupport')
-rw-r--r--WebKit/android/WebCoreSupport/ChromeClientAndroid.cpp11
-rw-r--r--WebKit/android/WebCoreSupport/ChromeClientAndroid.h4
2 files changed, 14 insertions, 1 deletions
diff --git a/WebKit/android/WebCoreSupport/ChromeClientAndroid.cpp b/WebKit/android/WebCoreSupport/ChromeClientAndroid.cpp
index cfac25e..f441aa1 100644
--- a/WebKit/android/WebCoreSupport/ChromeClientAndroid.cpp
+++ b/WebKit/android/WebCoreSupport/ChromeClientAndroid.cpp
@@ -105,10 +105,19 @@ float ChromeClientAndroid::scaleFactor()
return 1.0f;
}
+#ifdef ANDROID_USER_GESTURE
+void ChromeClientAndroid::focus(bool userGesture) {
+#else
void ChromeClientAndroid::focus() {
+ // The old behavior was to always allow javascript to focus a window. If we
+ // turn off ANDROID_USER_GESTURE, go back to the old behavior by forcing
+ // userGesture to be true.
+ bool userGesture = true;
+#endif
ASSERT(m_webFrame);
// Ask the application to focus this WebView.
- m_webFrame->requestFocus();
+ if (userGesture)
+ m_webFrame->requestFocus();
}
void ChromeClientAndroid::unfocus() { notImplemented(); }
diff --git a/WebKit/android/WebCoreSupport/ChromeClientAndroid.h b/WebKit/android/WebCoreSupport/ChromeClientAndroid.h
index 7bd7088..5ed785a 100644
--- a/WebKit/android/WebCoreSupport/ChromeClientAndroid.h
+++ b/WebKit/android/WebCoreSupport/ChromeClientAndroid.h
@@ -53,7 +53,11 @@ namespace android {
virtual float scaleFactor();
+#ifdef ANDROID_USER_GESTURE
+ virtual void focus(bool userGesture);
+#else
virtual void focus();
+#endif
virtual void unfocus();
virtual bool canTakeFocus(FocusDirection);