diff options
| author | Leon Scroggins <scroggo@google.com> | 2011-02-01 10:30:42 -0800 |
|---|---|---|
| committer | Android (Google) Code Review <android-gerrit@google.com> | 2011-02-01 10:30:42 -0800 |
| commit | df1481cda639836d5d7a99ec839d50e59c942b8f (patch) | |
| tree | fb49f56dd5b4c2eb2a43854b1127bbf904fd01ff /core/java/android/webkit | |
| parent | 65a6c48235628848b9f8df15be66fa4e0be4500e (diff) | |
| parent | fe77eb6140541a4bfb5932cad8b8c5ac11732dfd (diff) | |
| download | frameworks_base-df1481cda639836d5d7a99ec839d50e59c942b8f.zip frameworks_base-df1481cda639836d5d7a99ec839d50e59c942b8f.tar.gz frameworks_base-df1481cda639836d5d7a99ec839d50e59c942b8f.tar.bz2 | |
Merge "Only scroll if the IME is open in certain cases."
Diffstat (limited to 'core/java/android/webkit')
| -rw-r--r-- | core/java/android/webkit/WebView.java | 10 | ||||
| -rw-r--r-- | core/java/android/webkit/WebViewCore.java | 5 |
2 files changed, 13 insertions, 2 deletions
diff --git a/core/java/android/webkit/WebView.java b/core/java/android/webkit/WebView.java index fcfcc03..9b3a56b 100644 --- a/core/java/android/webkit/WebView.java +++ b/core/java/android/webkit/WebView.java @@ -7144,6 +7144,16 @@ public class WebView extends AbsoluteLayout setContentScrollTo(msg.arg1, msg.arg2); break; case SCROLL_TO_MSG_ID: + if (((Boolean) msg.obj).booleanValue()) { + // This scroll is intended to bring the textfield into + // view, but is only necessary if the IME is showing + InputMethodManager imm = InputMethodManager.peekInstance(); + if (imm == null || !imm.isAcceptingText() + || (!imm.isActive(WebView.this) && (!inEditingMode() + || !imm.isActive(mWebTextView)))) { + break; + } + } if (setContentScrollTo(msg.arg1, msg.arg2)) { // if we can't scroll to the exact position due to pin, // send a message to WebCore to re-scroll when we get a diff --git a/core/java/android/webkit/WebViewCore.java b/core/java/android/webkit/WebViewCore.java index b949a41..5bdf408 100644 --- a/core/java/android/webkit/WebViewCore.java +++ b/core/java/android/webkit/WebViewCore.java @@ -2120,7 +2120,7 @@ final class WebViewCore { } // called by JNI - private void contentScrollTo(int x, int y) { + private void contentScrollTo(int x, int y, boolean onlyIfImeIsShowing) { if (!mBrowserFrame.firstLayoutDone()) { /* * WebKit restore state will be called before didFirstLayout(), @@ -2133,7 +2133,8 @@ final class WebViewCore { } if (mWebView != null) { Message msg = Message.obtain(mWebView.mPrivateHandler, - WebView.SCROLL_TO_MSG_ID, x, y); + WebView.SCROLL_TO_MSG_ID, x, y, + Boolean.valueOf(onlyIfImeIsShowing)); if (mDrawIsScheduled) { mEventHub.sendMessage(Message.obtain(null, EventHub.MESSAGE_RELAY, msg)); |
