diff options
author | 2011-02-01 11:05:22 -0500 | |
---|---|---|
committer | 2011-02-02 15:05:30 -0500 | |
commit | e89d6418bee849880eca3bc232d1579e6f6813e4 (patch) | |
tree | ef10b267e79489ecb7220b6cf6464b6926bb9e05 | |
parent | 2c507b92c242951e4fb2e807431c10d73e4bf778 (diff) |
DO NOT MERGE. Only scroll if the IME is open in certain cases.
Bug:3411564
Requires a change in external/webkit.
Already submitted to master.
Change-Id: Id5b8765bde4070f04fce0743c56a038f88e816ec
-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 f91ae9f15736..fa99eae99146 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 b949a4165f6e..5bdf4087bb07 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)); |