summaryrefslogtreecommitdiffstats
path: root/WebKit/android/nav
diff options
context:
space:
mode:
authorLeon Scroggins <scroggo@google.com>2009-12-09 15:59:35 -0800
committerAndroid Git Automerger <android-git-automerger@android.com>2009-12-09 15:59:35 -0800
commit58a731c8a7beeda67d174e8a325594bc81e80a0f (patch)
tree9478d0c03229c925a12467ff64065334c7294d51 /WebKit/android/nav
parentedc7ae3e39462862f5a598cae20fdec379270ee7 (diff)
parentbf16ddc110ef3fde2cfa1ae43ab31d993377981d (diff)
downloadexternal_webkit-58a731c8a7beeda67d174e8a325594bc81e80a0f.zip
external_webkit-58a731c8a7beeda67d174e8a325594bc81e80a0f.tar.gz
external_webkit-58a731c8a7beeda67d174e8a325594bc81e80a0f.tar.bz2
am bf16ddc1: Pass a message to move the focus when user hits "Next".
Merge commit 'bf16ddc110ef3fde2cfa1ae43ab31d993377981d' into eclair-mr2-plus-aosp * commit 'bf16ddc110ef3fde2cfa1ae43ab31d993377981d': Pass a message to move the focus when user hits "Next".
Diffstat (limited to 'WebKit/android/nav')
-rw-r--r--WebKit/android/nav/WebView.cpp22
1 files changed, 18 insertions, 4 deletions
diff --git a/WebKit/android/nav/WebView.cpp b/WebKit/android/nav/WebView.cpp
index 938d93c..3232a74 100644
--- a/WebKit/android/nav/WebView.cpp
+++ b/WebKit/android/nav/WebView.cpp
@@ -100,6 +100,7 @@ struct JavaGlue {
jmethodID m_clearTextEntry;
jmethodID m_overrideLoading;
jmethodID m_scrollBy;
+ jmethodID m_sendMoveFocus;
jmethodID m_sendMoveMouse;
jmethodID m_sendMoveMouseIfLatest;
jmethodID m_sendMotionUp;
@@ -129,6 +130,7 @@ WebView(JNIEnv* env, jobject javaWebView, int viewImpl)
m_javaGlue.m_scrollBy = GetJMethod(env, clazz, "setContentScrollBy", "(IIZ)Z");
m_javaGlue.m_clearTextEntry = GetJMethod(env, clazz, "clearTextEntry", "()V");
m_javaGlue.m_overrideLoading = GetJMethod(env, clazz, "overrideLoading", "(Ljava/lang/String;)V");
+ m_javaGlue.m_sendMoveFocus = GetJMethod(env, clazz, "sendMoveFocus", "(II)V");
m_javaGlue.m_sendMoveMouse = GetJMethod(env, clazz, "sendMoveMouse", "(IIII)V");
m_javaGlue.m_sendMoveMouseIfLatest = GetJMethod(env, clazz, "sendMoveMouseIfLatest", "(Z)V");
m_javaGlue.m_sendMotionUp = GetJMethod(env, clazz, "sendMotionUp", "(IIIII)V");
@@ -1098,6 +1100,20 @@ void getSelectionCaret(SkPath* path)
path->rLineTo(-dist, -dist);
}
+void sendMoveFocus(WebCore::Frame* framePtr, WebCore::Node* nodePtr)
+{
+ DBG_NAV_LOGD("framePtr=%p nodePtr=%p x=%d y=%d", framePtr, nodePtr, x, y);
+ 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_sendMoveFocus, (jint) framePtr,
+ (jint) nodePtr);
+ checkException(env);
+}
+
void sendMoveMouse(WebCore::Frame* framePtr, WebCore::Node* nodePtr, int x, int y)
{
DBG_NAV_LOGD("framePtr=%p nodePtr=%p x=%d y=%d", framePtr, nodePtr, x, y);
@@ -1954,10 +1970,8 @@ static void nativeMoveCursorToNextTextInput(JNIEnv *env, jobject obj)
view->updateCursorBounds(root, frame, next);
root->setCursor(const_cast<CachedFrame*>(frame),
const_cast<CachedNode*>(next));
- WebCore::IntPoint pos;
- root->getSimulatedMousePosition(&pos);
- view->sendMoveMouse(static_cast<WebCore::Frame*>(frame->framePointer()),
- static_cast<WebCore::Node*>(next->nodePointer()), pos.x(), pos.y());
+ view->sendMoveFocus(static_cast<WebCore::Frame*>(frame->framePointer()),
+ static_cast<WebCore::Node*>(next->nodePointer()));
view->scrollRectOnScreen(bounds.x(), bounds.y(), bounds.right(),
bounds.bottom());
view->getWebViewCore()->m_moveGeneration++;