From 47fabbfcbf99e5e3b73a6ee09059c77932ef1b7b Mon Sep 17 00:00:00 2001 From: Leon Scroggins Date: Tue, 8 Dec 2009 16:57:26 -0500 Subject: [PATCH] Pass a message to move the focus when user hits "Next". Directly move the focus rather than passing a click. Fixes http://b/issue?id=2292683 Requires a change to external/webkit --- core/java/android/webkit/WebTextView.java | 3 --- core/java/android/webkit/WebView.java | 6 ++++++ core/java/android/webkit/WebViewCore.java | 11 ++++++++++- 3 files changed, 16 insertions(+), 4 deletions(-) diff --git a/core/java/android/webkit/WebTextView.java b/core/java/android/webkit/WebTextView.java index 608c8a240b470..92da456467a65 100644 --- a/core/java/android/webkit/WebTextView.java +++ b/core/java/android/webkit/WebTextView.java @@ -325,9 +325,6 @@ import java.util.ArrayList; mWebView.setFocusControllerInactive(); mWebView.nativeMoveCursorToNextTextInput(); mOkayForFocusNotToMatch = true; - // Pass the click to set the focus to the textfield which will now - // have the cursor. - mWebView.centerKeyPressOnTextField(); // Preemptively rebuild the WebTextView, so that the action will // be set properly. mWebView.rebuildWebTextView(); diff --git a/core/java/android/webkit/WebView.java b/core/java/android/webkit/WebView.java index 7c79fd9a9f911..284d69217510f 100644 --- a/core/java/android/webkit/WebView.java +++ b/core/java/android/webkit/WebView.java @@ -5695,6 +5695,12 @@ public class WebView extends AbsoluteLayout new InvokeListBox(array, enabledArray, selection)); } + // called by JNI + private void sendMoveFocus(int frame, int node) { + mWebViewCore.sendMessage(EventHub.SET_MOVE_FOCUS, + new WebViewCore.CursorData(frame, node, 0, 0)); + } + // called by JNI private void sendMoveMouse(int frame, int node, int x, int y) { mWebViewCore.sendMessage(EventHub.SET_MOVE_MOUSE, diff --git a/core/java/android/webkit/WebViewCore.java b/core/java/android/webkit/WebViewCore.java index 5ded2405c7b48..c2c7da8b6c2d1 100644 --- a/core/java/android/webkit/WebViewCore.java +++ b/core/java/android/webkit/WebViewCore.java @@ -503,6 +503,7 @@ final class WebViewCore { private native void nativeSaveDocumentState(int frame); + private native void nativeMoveFocus(int framePtr, int nodePointer); private native void nativeMoveMouse(int framePtr, int x, int y); private native void nativeMoveMouseIfLatest(int moveGeneration, @@ -661,11 +662,13 @@ final class WebViewCore { CursorData() {} CursorData(int frame, int node, int x, int y) { mFrame = frame; + mNode = node; mX = x; mY = y; } int mMoveGeneration; int mFrame; + int mNode; int mX; int mY; } @@ -751,7 +754,7 @@ final class WebViewCore { "SINGLE_LISTBOX_CHOICE", // = 124; "MESSAGE_RELAY", // = 125; "SET_BACKGROUND_COLOR", // = 126; - "127", // = 127 + "SET_MOVE_FOCUS", // = 127 "SAVE_DOCUMENT_STATE", // = 128; "GET_SELECTION", // = 129; "WEBKIT_DRAW", // = 130; @@ -802,6 +805,7 @@ final class WebViewCore { static final int SINGLE_LISTBOX_CHOICE = 124; static final int MESSAGE_RELAY = 125; static final int SET_BACKGROUND_COLOR = 126; + static final int SET_MOVE_FOCUS = 127; static final int SAVE_DOCUMENT_STATE = 128; static final int GET_SELECTION = 129; static final int WEBKIT_DRAW = 130; @@ -1149,6 +1153,11 @@ final class WebViewCore { mBrowserFrame.documentAsText((Message) msg.obj); break; + case SET_MOVE_FOCUS: + CursorData focusData = (CursorData) msg.obj; + nativeMoveFocus(focusData.mFrame, focusData.mNode); + break; + case SET_MOVE_MOUSE: CursorData cursorData = (CursorData) msg.obj; nativeMoveMouse(cursorData.mFrame,