diff options
author | Derek Sollenberger <djsollen@google.com> | 2009-06-29 13:46:51 -0400 |
---|---|---|
committer | Derek Sollenberger <djsollen@google.com> | 2009-06-29 13:46:51 -0400 |
commit | 5c6846a9fb474dce40db8859579e0d6a3f802787 (patch) | |
tree | cec8e36b466f125f9c7ff364c140b8d71300e884 /WebKit | |
parent | 9ef86237529ed76780c62ff0e49c8a0a85a6562c (diff) | |
download | external_webkit-5c6846a9fb474dce40db8859579e0d6a3f802787.zip external_webkit-5c6846a9fb474dce40db8859579e0d6a3f802787.tar.gz external_webkit-5c6846a9fb474dce40db8859579e0d6a3f802787.tar.bz2 |
Adding support for plugins to request the keyboard.
Diffstat (limited to 'WebKit')
-rw-r--r-- | WebKit/android/jni/WebViewCore.cpp | 12 | ||||
-rw-r--r-- | WebKit/android/jni/WebViewCore.h | 3 | ||||
-rw-r--r-- | WebKit/android/nav/WebView.cpp | 8 | ||||
-rw-r--r-- | WebKit/android/plugins/ANPWindowInterface.cpp | 7 | ||||
-rw-r--r-- | WebKit/android/plugins/android_npapi.h | 6 |
5 files changed, 32 insertions, 4 deletions
diff --git a/WebKit/android/jni/WebViewCore.cpp b/WebKit/android/jni/WebViewCore.cpp index bce07ee..2564da5 100644 --- a/WebKit/android/jni/WebViewCore.cpp +++ b/WebKit/android/jni/WebViewCore.cpp @@ -167,6 +167,7 @@ struct WebViewCore::JavaGlue { jmethodID m_clearTextEntry; jmethodID m_restoreScale; jmethodID m_needTouchEvents; + jmethodID m_requestKeyboard; jmethodID m_exceededDatabaseQuota; jmethodID m_addMessageToConsole; AutoJObject object(JNIEnv* env) { @@ -231,6 +232,7 @@ WebViewCore::WebViewCore(JNIEnv* env, jobject javaWebViewCore, WebCore::Frame* m m_javaGlue->m_clearTextEntry = GetJMethod(env, clazz, "clearTextEntry", "()V"); m_javaGlue->m_restoreScale = GetJMethod(env, clazz, "restoreScale", "(I)V"); m_javaGlue->m_needTouchEvents = GetJMethod(env, clazz, "needTouchEvents", "(Z)V"); + m_javaGlue->m_requestKeyboard = GetJMethod(env, clazz, "requestKeyboard", "(Z)V"); m_javaGlue->m_exceededDatabaseQuota = GetJMethod(env, clazz, "exceededDatabaseQuota", "(Ljava/lang/String;Ljava/lang/String;J)V"); m_javaGlue->m_addMessageToConsole = GetJMethod(env, clazz, "addMessageToConsole", "(Ljava/lang/String;ILjava/lang/String;)V"); @@ -842,6 +844,16 @@ void WebViewCore::needTouchEvents(bool need) #endif } +void WebViewCore::requestKeyboard(bool showKeyboard) +{ + DEBUG_NAV_UI_LOGD("%s", __FUNCTION__); + LOG_ASSERT(m_javaGlue->m_obj, "A Java widget was not associated with this view bridge!"); + + JNIEnv* env = JSC::Bindings::getJNIEnv(); + env->CallVoidMethod(m_javaGlue->object(env).get(), m_javaGlue->m_requestKeyboard, showKeyboard); + checkException(env); +} + void WebViewCore::notifyProgressFinished() { DBG_NAV_LOG("call updateFrameCache"); diff --git a/WebKit/android/jni/WebViewCore.h b/WebKit/android/jni/WebViewCore.h index 7f38cce..86e6dca 100644 --- a/WebKit/android/jni/WebViewCore.h +++ b/WebKit/android/jni/WebViewCore.h @@ -300,6 +300,9 @@ namespace android { // Notify the Java side whether it needs to pass down the touch events void needTouchEvents(bool); + // Notify the Java side that webkit is requesting a keyboard + void requestKeyboard(bool); + // other public functions public: // reset the picture set to empty diff --git a/WebKit/android/nav/WebView.cpp b/WebKit/android/nav/WebView.cpp index 022ca6f..b220617 100644 --- a/WebKit/android/nav/WebView.cpp +++ b/WebKit/android/nav/WebView.cpp @@ -134,7 +134,7 @@ WebView(JNIEnv* env, jobject javaWebView, int viewImpl) m_javaGlue.m_getScaledMaxYScroll = GetJMethod(env, clazz, "getScaledMaxYScroll", "()I"); m_javaGlue.m_getVisibleRect = GetJMethod(env, clazz, "sendOurVisibleRect", "()Landroid/graphics/Rect;"); m_javaGlue.m_rebuildWebTextView = GetJMethod(env, clazz, "rebuildWebTextView", "()V"); - m_javaGlue.m_displaySoftKeyboard = GetJMethod(env, clazz, "displaySoftKeyboard", "()V"); + m_javaGlue.m_displaySoftKeyboard = GetJMethod(env, clazz, "displaySoftKeyboard", "(Z)V"); m_javaGlue.m_viewInvalidate = GetJMethod(env, clazz, "viewInvalidate", "()V"); m_javaGlue.m_viewInvalidateRect = GetJMethod(env, clazz, "viewInvalidate", "(IIII)V"); m_javaGlue.m_postInvalidateDelayed = GetJMethod(env, clazz, @@ -940,7 +940,7 @@ bool motionUp(int x, int y, int slop) viewInvalidate(); if (result->isTextField() || result->isTextArea()) { rebuildWebTextView(); - displaySoftKeyboard(); + displaySoftKeyboard(true); } else { setFollowedLink(true); if (type != NORMAL_CACHEDNODETYPE) @@ -1256,11 +1256,11 @@ void rebuildWebTextView() checkException(env); } -void displaySoftKeyboard() +void displaySoftKeyboard(bool isTextView) { JNIEnv* env = JSC::Bindings::getJNIEnv(); env->CallVoidMethod(m_javaGlue.object(env).get(), - m_javaGlue.m_displaySoftKeyboard); + m_javaGlue.m_displaySoftKeyboard, isTextView); checkException(env); } diff --git a/WebKit/android/plugins/ANPWindowInterface.cpp b/WebKit/android/plugins/ANPWindowInterface.cpp index 8258936..7773e6e 100644 --- a/WebKit/android/plugins/ANPWindowInterface.cpp +++ b/WebKit/android/plugins/ANPWindowInterface.cpp @@ -63,6 +63,12 @@ static void anp_scrollTo(NPP instance, int32_t x, int32_t y) { core->scrollTo(x,y,true); } +static void anp_showKeyboard(NPP instance, bool value) { + ScrollView* scrollView = pluginViewForInstance(instance)->parent(); + android::WebViewCore* core = android::WebViewCore::getWebViewCore(scrollView); + core->requestKeyboard(value); +} + /////////////////////////////////////////////////////////////////////////////// #define ASSIGN(obj, name) (obj)->name = anp_##name @@ -73,6 +79,7 @@ void ANPWindowInterfaceV0_Init(ANPInterface* value) { ASSIGN(i, lockRect); ASSIGN(i, lockRegion); ASSIGN(i, scrollTo); + ASSIGN(i, showKeyboard); ASSIGN(i, unlock); } diff --git a/WebKit/android/plugins/android_npapi.h b/WebKit/android/plugins/android_npapi.h index c11d448..daae138 100644 --- a/WebKit/android/plugins/android_npapi.h +++ b/WebKit/android/plugins/android_npapi.h @@ -614,6 +614,12 @@ struct ANPWindowInterfaceV0 : ANPInterface { closely aligned to the coordinates as possible. */ void (*scrollTo)(NPP instance, int32_t x, int32_t y); + /** Given a boolean value of true the device will be requested to provide + a keyboard. A value of false will result in a request to hide the + keyboard. Further, the on-screen keyboard will not be displayed if a + physical keyboard is active. + */ + void (*showKeyboard)(NPP instance, bool value); }; /////////////////////////////////////////////////////////////////////////////// |