summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLeon Scroggins <scroggo@google.com>2010-02-23 15:15:16 -0500
committerLeon Scroggins <scroggo@google.com>2010-02-23 16:38:46 -0500
commite3844eeb349b9aa9437be6c43b0e1ecc151f6bd1 (patch)
tree839ffaa2e7221d81d6794cd8ee7c8c8799e8de32
parente575d3dff5b06cb5a4aae0fa0626f884297eb15d (diff)
downloadframeworks_base-e3844eeb349b9aa9437be6c43b0e1ecc151f6bd1.zip
frameworks_base-e3844eeb349b9aa9437be6c43b0e1ecc151f6bd1.tar.gz
frameworks_base-e3844eeb349b9aa9437be6c43b0e1ecc151f6bd1.tar.bz2
Focus the IME on WebView when no textfield is in focus.
This is to fix a particular case where the navigation cache does not recognize that a textfield is now in focus. A message was sent from the WebCore thread telling us to open the IME on the textfield. Open it with the WebView as the served view. Fix for http://b/issue?id=2457459
-rw-r--r--core/java/android/webkit/WebView.java34
1 files changed, 21 insertions, 13 deletions
diff --git a/core/java/android/webkit/WebView.java b/core/java/android/webkit/WebView.java
index adae0cb..067241a 100644
--- a/core/java/android/webkit/WebView.java
+++ b/core/java/android/webkit/WebView.java
@@ -3351,23 +3351,31 @@ public class WebView extends AbsoluteLayout
InputMethodManager imm = (InputMethodManager)
getContext().getSystemService(Context.INPUT_METHOD_SERVICE);
+ // bring it back to the default scale so that user can enter text
+ boolean zoom = mActualScale < mDefaultScale;
+ if (zoom) {
+ mInZoomOverview = false;
+ mZoomCenterX = mLastTouchX;
+ mZoomCenterY = mLastTouchY;
+ // do not change text wrap scale so that there is no reflow
+ setNewZoomScale(mDefaultScale, false, false);
+ }
if (isTextView) {
rebuildWebTextView();
- if (!inEditingMode()) return;
- imm.showSoftInput(mWebTextView, 0);
- // bring it back to the default scale so that user can enter text
- if (mActualScale < mDefaultScale) {
- mInZoomOverview = false;
- mZoomCenterX = mLastTouchX;
- mZoomCenterY = mLastTouchY;
- // do not change text wrap scale so that there is no reflow
- setNewZoomScale(mDefaultScale, false, false);
- didUpdateTextViewBounds(true);
+ if (inEditingMode()) {
+ imm.showSoftInput(mWebTextView, 0);
+ if (zoom) {
+ didUpdateTextViewBounds(true);
+ }
+ return;
}
}
- else { // used by plugins
- imm.showSoftInput(this, 0);
- }
+ // Used by plugins.
+ // Also used if the navigation cache is out of date, and
+ // does not recognize that a textfield is in focus. In that
+ // case, use WebView as the targeted view.
+ // see http://b/issue?id=2457459
+ imm.showSoftInput(this, 0);
}
// Called by WebKit to instruct the UI to hide the keyboard