From f18c539344655c8d39e3412a0985f7e42193eb52 Mon Sep 17 00:00:00 2001 From: Cary Clark Date: Thu, 24 Sep 2009 16:25:25 -0400 Subject: [PATCH] set the selection after sending a click Webkit expects the currently focused text input to have a set selection before it can receive key events for insertion. Coincidentally, we always set the selection except when using the 'next' button on the IME to switch between text fields. The selection has to be set after the text field receives focus, so add a setSelection() message after the click() message is sent in passToJavaScript(). fixes http://b/issue?id=2087546 --- core/java/android/webkit/WebView.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/core/java/android/webkit/WebView.java b/core/java/android/webkit/WebView.java index 31caa72b4342e..6ac1f0798665e 100644 --- a/core/java/android/webkit/WebView.java +++ b/core/java/android/webkit/WebView.java @@ -4766,6 +4766,9 @@ public class WebView extends AbsoluteLayout /* package */ void passToJavaScript(String currentText, KeyEvent event) { if (nativeCursorWantsKeyEvents() && !nativeCursorMatchesFocus()) { mWebViewCore.sendMessage(EventHub.CLICK); + int select = nativeFocusCandidateIsTextField() ? + nativeFocusCandidateMaxLength() : 0; + setSelection(select, select); } WebViewCore.JSKeyData arg = new WebViewCore.JSKeyData(); arg.mEvent = event;