diff options
Diffstat (limited to 'WebKit')
| -rw-r--r-- | WebKit/android/WebCoreSupport/ChromeClientAndroid.cpp | 19 | ||||
| -rw-r--r-- | WebKit/android/WebCoreSupport/ChromeClientAndroid.h | 4 | ||||
| -rw-r--r-- | WebKit/android/jni/WebCoreFrameBridge.cpp | 17 |
3 files changed, 23 insertions, 17 deletions
diff --git a/WebKit/android/WebCoreSupport/ChromeClientAndroid.cpp b/WebKit/android/WebCoreSupport/ChromeClientAndroid.cpp index 30ac36c..af74638 100644 --- a/WebKit/android/WebCoreSupport/ChromeClientAndroid.cpp +++ b/WebKit/android/WebCoreSupport/ChromeClientAndroid.cpp @@ -46,6 +46,7 @@ #include "WebViewCore.h" #include "WindowFeatures.h" #include "Settings.h" +#include "UserGestureIndicator.h" #include <wtf/text/CString.h> namespace android { @@ -123,18 +124,16 @@ float ChromeClientAndroid::scaleFactor() return m_webFrame->density(); } -#ifdef ANDROID_USER_GESTURE -void ChromeClientAndroid::focus(bool userGesture) { +void ChromeClientAndroid::focus() +{ + ASSERT(m_webFrame); +#ifdef ANDROID_USER_GESTURE_CHECK + bool isUserGesture = UserGestureIndicator::processingUserGesture(); #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; + bool isUserGesture = true; #endif - ASSERT(m_webFrame); - // Ask the application to focus this WebView. - if (userGesture) + // Ask the application to focus this WebView if the action is intiated by the user + if (isUserGesture) m_webFrame->requestFocus(); } void ChromeClientAndroid::unfocus() { notImplemented(); } diff --git a/WebKit/android/WebCoreSupport/ChromeClientAndroid.h b/WebKit/android/WebCoreSupport/ChromeClientAndroid.h index a1f097c..b3b9335 100644 --- a/WebKit/android/WebCoreSupport/ChromeClientAndroid.h +++ b/WebKit/android/WebCoreSupport/ChromeClientAndroid.h @@ -59,11 +59,7 @@ 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); diff --git a/WebKit/android/jni/WebCoreFrameBridge.cpp b/WebKit/android/jni/WebCoreFrameBridge.cpp index bfd4b62..7324173 100644 --- a/WebKit/android/jni/WebCoreFrameBridge.cpp +++ b/WebKit/android/jni/WebCoreFrameBridge.cpp @@ -75,6 +75,7 @@ #include "Settings.h" #include "StringBuilder.h" #include "SubstituteData.h" +#include "UserGestureIndicator.h" #include "WebCoreJni.h" #include "WebCoreResourceLoader.h" #include "WebHistory.h" @@ -481,11 +482,16 @@ WebFrame::startLoadingResource(WebCore::ResourceHandle* loader, jstring jPasswordString = loaderInternal->m_pass.isEmpty() ? NULL : env->NewString(loaderInternal->m_pass.characters(), loaderInternal->m_pass.length()); +#ifdef ANDROID_USER_GESTURE_CHECK + bool isUserGesture = UserGestureIndicator::processingUserGesture(); +#else + bool isUserGesture = true; +#endif jobject jLoadListener = env->CallObjectMethod(obj.get(), mJavaFrame->mStartLoadingResource, (int)loader, jUrlStr, jMethodStr, jHeaderMap, jPostDataStr, formdata ? formdata->identifier(): 0, - cacheMode, mainResource, request.getUserGesture(), + cacheMode, mainResource, isUserGesture, synchronous, jUsernameString, jPasswordString); env->DeleteLocalRef(jUrlStr); @@ -750,8 +756,13 @@ WebFrame::canHandleRequest(const WebCore::ResourceRequest& request) if (equalIgnoringCase(request.httpMethod(), "POST")) return true; WebCore::KURL requestUrl = request.url(); - if (!mUserInitiatedClick && !request.getUserGesture() && - (requestUrl.protocolIs("http") || requestUrl.protocolIs("https") || +#ifdef ANDROID_USER_GESTURE_CHECK + bool isUserGesture = UserGestureIndicator::processingUserGesture(); +#else + bool isUserGesture = true; +#endif + if (!mUserInitiatedClick && !isUserGesture && + (requestUrl.protocolIs("http") || requestUrl.protocolIs("https") || requestUrl.protocolIs("file") || requestUrl.protocolIs("about") || WebCore::protocolIsJavaScript(requestUrl.string()))) return true; |
