summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLeon Scroggins <scroggo@google.com>2010-03-18 10:20:41 -0700
committerAndroid (Google) Code Review <android-gerrit@google.com>2010-03-18 10:20:41 -0700
commit929b8b6c0a2c34098698d593df275ba8f4d50c39 (patch)
treea0270d15916667a80170dc7c53a0b9ffd3ebc628
parent8ca7016a7bc5df003543e9cf8c3bfe68dec7bde4 (diff)
parentf558550c02488858a9e8c968f9074bba1f81f1d4 (diff)
downloadexternal_webkit-929b8b6c0a2c34098698d593df275ba8f4d50c39.zip
external_webkit-929b8b6c0a2c34098698d593df275ba8f4d50c39.tar.gz
external_webkit-929b8b6c0a2c34098698d593df275ba8f4d50c39.tar.bz2
Merge "Pass selection data along with message to open the keyboard."
-rw-r--r--WebKit/android/jni/WebViewCore.cpp34
-rw-r--r--WebKit/android/jni/WebViewCore.h3
-rw-r--r--WebKit/android/plugins/ANPWindowInterface.cpp2
3 files changed, 31 insertions, 8 deletions
diff --git a/WebKit/android/jni/WebViewCore.cpp b/WebKit/android/jni/WebViewCore.cpp
index 8556dd8..529f1d6 100644
--- a/WebKit/android/jni/WebViewCore.cpp
+++ b/WebKit/android/jni/WebViewCore.cpp
@@ -214,6 +214,7 @@ struct WebViewCore::JavaGlue {
jmethodID m_restoreScreenWidthScale;
jmethodID m_needTouchEvents;
jmethodID m_requestKeyboard;
+ jmethodID m_requestKeyboardWithSelection;
jmethodID m_exceededDatabaseQuota;
jmethodID m_reachedMaxAppCacheSize;
jmethodID m_populateVisitedLinks;
@@ -302,7 +303,8 @@ WebViewCore::WebViewCore(JNIEnv* env, jobject javaWebViewCore, WebCore::Frame* m
m_javaGlue->m_restoreScale = GetJMethod(env, clazz, "restoreScale", "(I)V");
m_javaGlue->m_restoreScreenWidthScale = GetJMethod(env, clazz, "restoreScreenWidthScale", "(I)V");
m_javaGlue->m_needTouchEvents = GetJMethod(env, clazz, "needTouchEvents", "(Z)V");
- m_javaGlue->m_requestKeyboard = GetJMethod(env, clazz, "requestKeyboard", "(ZZ)V");
+ m_javaGlue->m_requestKeyboard = GetJMethod(env, clazz, "requestKeyboard", "(Z)V");
+ m_javaGlue->m_requestKeyboardWithSelection = GetJMethod(env, clazz, "requestKeyboardWithSelection", "(IIII)V");
m_javaGlue->m_exceededDatabaseQuota = GetJMethod(env, clazz, "exceededDatabaseQuota", "(Ljava/lang/String;Ljava/lang/String;JJ)V");
m_javaGlue->m_reachedMaxAppCacheSize = GetJMethod(env, clazz, "reachedMaxAppCacheSize", "(J)V");
m_javaGlue->m_populateVisitedLinks = GetJMethod(env, clazz, "populateVisitedLinks", "()V");
@@ -1047,14 +1049,27 @@ void WebViewCore::needTouchEvents(bool need)
#endif
}
-void WebViewCore::requestKeyboard(bool showKeyboard, bool isTextView)
+void WebViewCore::requestKeyboardWithSelection(const WebCore::Node* node,
+ int selStart, int selEnd)
{
- DBG_NAV_LOGD("showKeyboard=%d", 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_requestKeyboardWithSelection,
+ reinterpret_cast<int>(node), selStart, selEnd, m_textGeneration);
+ checkException(env);
+}
+
+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,
- isTextView);
+ env->CallVoidMethod(m_javaGlue->object(env).get(),
+ m_javaGlue->m_requestKeyboard, showKeyboard);
checkException(env);
}
@@ -2150,7 +2165,14 @@ bool WebViewCore::handleMouseClick(WebCore::Frame* framePtr, WebCore::Node* node
bool ime = !(static_cast<WebCore::HTMLInputElement*>(focusNode))
->readOnly();
setFocusControllerActive(framePtr, ime);
- requestKeyboard(ime, true);
+ if (ime) {
+ RenderTextControl* rtc
+ = static_cast<RenderTextControl*> (renderer);
+ requestKeyboardWithSelection(focusNode, rtc->selectionStart(),
+ rtc->selectionEnd());
+ } else {
+ requestKeyboard(false);
+ }
}
}
return handled;
diff --git a/WebKit/android/jni/WebViewCore.h b/WebKit/android/jni/WebViewCore.h
index 0ec8bed..abe0d8d 100644
--- a/WebKit/android/jni/WebViewCore.h
+++ b/WebKit/android/jni/WebViewCore.h
@@ -388,8 +388,9 @@ namespace android {
// Notify the Java side whether it needs to pass down the touch events
void needTouchEvents(bool);
+ void requestKeyboardWithSelection(const WebCore::Node*, int selStart, int selEnd);
// Notify the Java side that webkit is requesting a keyboard
- void requestKeyboard(bool showKeyboard, bool isTextView);
+ void requestKeyboard(bool showKeyboard);
// Generates a class loader that contains classes from the plugin's apk
jclass getPluginClass(const WebCore::String& libName, const char* className);
diff --git a/WebKit/android/plugins/ANPWindowInterface.cpp b/WebKit/android/plugins/ANPWindowInterface.cpp
index 0a31ed3..f086b44 100644
--- a/WebKit/android/plugins/ANPWindowInterface.cpp
+++ b/WebKit/android/plugins/ANPWindowInterface.cpp
@@ -50,7 +50,7 @@ static void anp_showKeyboard(NPP instance, bool value) {
PluginView* pluginView = pluginViewForInstance(instance);
PluginWidgetAndroid* pluginWidget = pluginView->platformPluginWidget();
if(pluginWidget->hasFocus())
- pluginWidget->webViewCore()->requestKeyboard(value, false);
+ pluginWidget->webViewCore()->requestKeyboard(value);
}
static void anp_requestFullScreen(NPP instance) {