summaryrefslogtreecommitdiffstats
path: root/WebKit
diff options
context:
space:
mode:
authorLeon Scroggins <scroggo@google.com>2010-01-08 16:22:09 -0500
committerLeon Scroggins <scroggo@google.com>2010-01-11 09:24:33 -0500
commitd485d47cbb03ae8cbe9d96bc54a5cb83ee80570e (patch)
tree5e934f3a8b209c85386bc62826de0fe9249a0066 /WebKit
parentee0e4a35152a822ebac039808db1a4c33f02f7ee (diff)
downloadexternal_webkit-d485d47cbb03ae8cbe9d96bc54a5cb83ee80570e.zip
external_webkit-d485d47cbb03ae8cbe9d96bc54a5cb83ee80570e.tar.gz
external_webkit-d485d47cbb03ae8cbe9d96bc54a5cb83ee80570e.tar.bz2
Bring up the IME after receiving a response from webkit.
Fix for http://b/issue?id=2361658 Requires a change to frameworks/base.
Diffstat (limited to 'WebKit')
-rw-r--r--WebKit/android/jni/WebViewCore.cpp15
-rw-r--r--WebKit/android/jni/WebViewCore.h2
-rw-r--r--WebKit/android/nav/CacheBuilder.cpp2
-rw-r--r--WebKit/android/nav/CachedInput.cpp1
-rw-r--r--WebKit/android/nav/CachedInput.h3
-rw-r--r--WebKit/android/nav/WebView.cpp36
-rw-r--r--WebKit/android/plugins/ANPWindowInterface.cpp2
7 files changed, 13 insertions, 48 deletions
diff --git a/WebKit/android/jni/WebViewCore.cpp b/WebKit/android/jni/WebViewCore.cpp
index ee1f880..85b00e6 100644
--- a/WebKit/android/jni/WebViewCore.cpp
+++ b/WebKit/android/jni/WebViewCore.cpp
@@ -294,7 +294,7 @@ 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", "(Z)V");
+ m_javaGlue->m_requestKeyboard = GetJMethod(env, clazz, "requestKeyboard", "(ZZ)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");
@@ -1049,7 +1049,7 @@ void WebViewCore::needTouchEvents(bool need)
#endif
}
-void WebViewCore::requestKeyboard(bool showKeyboard)
+void WebViewCore::requestKeyboard(bool showKeyboard, bool isTextView)
{
DBG_NAV_LOGD("showKeyboard=%d", showKeyboard);
LOG_ASSERT(m_javaGlue->m_obj, "A Java widget was not associated with this view bridge!");
@@ -1060,7 +1060,8 @@ void WebViewCore::requestKeyboard(bool showKeyboard)
// can be gone. Check before using it.
if (!obj.get())
return;
- env->CallVoidMethod(obj.get(), m_javaGlue->m_requestKeyboard, showKeyboard);
+ env->CallVoidMethod(obj.get(), m_javaGlue->m_requestKeyboard, showKeyboard,
+ isTextView);
checkException(env);
}
@@ -2294,8 +2295,12 @@ bool WebViewCore::handleMouseClick(WebCore::Frame* framePtr, WebCore::Node* node
m_mousePos.y(), focusNode, handled ? "true" : "false");
if (focusNode) {
WebCore::RenderObject* renderer = focusNode->renderer();
- if (renderer && (renderer->isTextField() || renderer->isTextArea()))
- setFocusControllerActive(true);
+ if (renderer && (renderer->isTextField() || renderer->isTextArea())) {
+ bool ime = !(static_cast<WebCore::HTMLInputElement*>(focusNode))
+ ->readOnly();
+ setFocusControllerActive(ime);
+ requestKeyboard(ime, true);
+ }
}
return handled;
}
diff --git a/WebKit/android/jni/WebViewCore.h b/WebKit/android/jni/WebViewCore.h
index 912b8e6..9c9c510 100644
--- a/WebKit/android/jni/WebViewCore.h
+++ b/WebKit/android/jni/WebViewCore.h
@@ -379,7 +379,7 @@ namespace android {
void needTouchEvents(bool);
// Notify the Java side that webkit is requesting a keyboard
- void requestKeyboard(bool);
+ void requestKeyboard(bool showKeyboard, bool isTextView);
// 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/nav/CacheBuilder.cpp b/WebKit/android/nav/CacheBuilder.cpp
index c4c25db..784c3aa 100644
--- a/WebKit/android/nav/CacheBuilder.cpp
+++ b/WebKit/android/nav/CacheBuilder.cpp
@@ -1106,7 +1106,6 @@ void CacheBuilder::BuildFrame(Frame* root, Frame* frame,
cachedInput.init();
cachedInput.setFormPointer(input->form());
cachedInput.setIsTextField(true);
- cachedInput.setIsReadOnly(input->readOnly());
exported = input->value().threadsafeCopy();
cachedInput.setMaxLength(input->maxLength());
cachedInput.setInputType(inputType);
@@ -1122,7 +1121,6 @@ void CacheBuilder::BuildFrame(Frame* root, Frame* frame,
type = TEXT_INPUT_CACHEDNODETYPE;
HTMLTextAreaElement* area = static_cast<HTMLTextAreaElement*>(node);
cachedInput.setFormPointer(area->form());
- cachedInput.setIsReadOnly(area->readOnly());
// Although technically it is not an HTMLInputElement, and therefore
// has no InputType, this one is the most appropriate.
cachedInput.setInputType(HTMLInputElement::TEXT);
diff --git a/WebKit/android/nav/CachedInput.cpp b/WebKit/android/nav/CachedInput.cpp
index d7b96e3..924bbca 100644
--- a/WebKit/android/nav/CachedInput.cpp
+++ b/WebKit/android/nav/CachedInput.cpp
@@ -59,7 +59,6 @@ void CachedInput::Debug::print() const
DUMP_NAV_LOGD("// int mMaxLength=%d;\n", b->mMaxLength);
DUMP_NAV_LOGD("// int mTextSize=%d;\n", b->mTextSize);
DUMP_NAV_LOGD("// int mInputType=%d;\n", b->mInputType);
- DEBUG_PRINT_BOOL(mIsReadOnly);
DEBUG_PRINT_BOOL(mIsRtlText);
DEBUG_PRINT_BOOL(mIsTextField);
}
diff --git a/WebKit/android/nav/CachedInput.h b/WebKit/android/nav/CachedInput.h
index f3cf1fe..42cadf1 100644
--- a/WebKit/android/nav/CachedInput.h
+++ b/WebKit/android/nav/CachedInput.h
@@ -44,14 +44,12 @@ public:
mName = WebCore::String();
}
WebCore::HTMLInputElement::InputType inputType() const { return mInputType; }
- bool isReadOnly() const { return mIsReadOnly; }
bool isRtlText() const { return mIsRtlText; }
bool isTextField() const { return mIsTextField; }
int maxLength() const { return mMaxLength; };
const WebCore::String& name() const { return mName; }
void setFormPointer(void* form) { mForm = form; }
void setInputType(WebCore::HTMLInputElement::InputType type) { mInputType = type; }
- void setIsReadOnly(bool isReadOnly) { mIsReadOnly = isReadOnly; }
void setIsRtlText(bool isRtlText) { mIsRtlText = isRtlText; }
void setIsTextField(bool isTextField) { mIsTextField = isTextField; }
void setMaxLength(int maxLength) { mMaxLength = maxLength; }
@@ -64,7 +62,6 @@ private:
int mMaxLength;
int mTextSize;
WebCore::HTMLInputElement::InputType mInputType;
- bool mIsReadOnly : 1;
bool mIsRtlText : 1;
bool mIsTextField : 1;
#if DUMP_NAV_CACHE
diff --git a/WebKit/android/nav/WebView.cpp b/WebKit/android/nav/WebView.cpp
index 1267647..e379a63 100644
--- a/WebKit/android/nav/WebView.cpp
+++ b/WebKit/android/nav/WebView.cpp
@@ -111,7 +111,6 @@ struct JavaGlue {
jmethodID m_getScaledMaxYScroll;
jmethodID m_getVisibleRect;
jmethodID m_rebuildWebTextView;
- jmethodID m_displaySoftKeyboard;
jmethodID m_viewInvalidate;
jmethodID m_viewInvalidateRect;
jmethodID m_postInvalidateDelayed;
@@ -141,7 +140,6 @@ 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", "(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,
@@ -980,12 +978,7 @@ bool motionUp(int x, int y, int slop)
(WebCore::Node*) result->nodePointer(), rx, ry);
}
viewInvalidate();
- if (result->isTextInput()) {
- bool isReadOnly = frame->textInput(result)->isReadOnly();
- rebuildWebTextView();
- if (!isReadOnly)
- displaySoftKeyboard(true);
- } else {
+ if (!result->isTextInput()) {
clearTextEntry();
setFollowedLink(true);
if (syntheticLink)
@@ -1307,19 +1300,6 @@ void rebuildWebTextView()
checkException(env);
}
-void displaySoftKeyboard(bool isTextView)
-{
- JNIEnv* env = JSC::Bindings::getJNIEnv();
- AutoJObject obj = m_javaGlue.object(env);
- // if it is called during or after DESTROY is handled, the real object of
- // WebView can be gone. Check before using it.
- if (!obj.get())
- return;
- env->CallVoidMethod(obj.get(),
- m_javaGlue.m_displaySoftKeyboard, isTextView);
- checkException(env);
-}
-
void viewInvalidate()
{
JNIEnv* env = JSC::Bindings::getJNIEnv();
@@ -1554,18 +1534,6 @@ static bool nativeCursorIsAnchor(JNIEnv *env, jobject obj)
return node ? node->isAnchor() : false;
}
-static bool nativeCursorIsReadOnly(JNIEnv *env, jobject obj)
-{
- const CachedFrame* frame;
- const CachedNode* node = getCursorNode(env, obj, &frame);
- if (!node)
- return false;
- const CachedInput* input = frame->textInput(node);
- if (!input)
- return false;
- return input->isReadOnly();
-}
-
static bool nativeCursorIsTextInput(JNIEnv *env, jobject obj)
{
const CachedNode* node = getCursorNode(env, obj);
@@ -2205,8 +2173,6 @@ static JNINativeMethod gJavaWebViewMethods[] = {
(void*) nativeCursorIntersects },
{ "nativeCursorIsAnchor", "()Z",
(void*) nativeCursorIsAnchor },
- { "nativeCursorIsReadOnly", "()Z",
- (void*) nativeCursorIsReadOnly },
{ "nativeCursorIsTextInput", "()Z",
(void*) nativeCursorIsTextInput },
{ "nativeCursorPosition", "()Landroid/graphics/Point;",
diff --git a/WebKit/android/plugins/ANPWindowInterface.cpp b/WebKit/android/plugins/ANPWindowInterface.cpp
index f3304a9..06afab1 100644
--- a/WebKit/android/plugins/ANPWindowInterface.cpp
+++ b/WebKit/android/plugins/ANPWindowInterface.cpp
@@ -49,7 +49,7 @@ static void anp_clearVisibleRects(NPP instance) {
static void anp_showKeyboard(NPP instance, bool value) {
PluginView* pluginView = pluginViewForInstance(instance);
PluginWidgetAndroid* pluginWidget = pluginView->platformPluginWidget();
- pluginWidget->webViewCore()->requestKeyboard(value);
+ pluginWidget->webViewCore()->requestKeyboard(value, false);
}
static void anp_requestFullScreen(NPP instance) {