Index: content/public/android/java/src/org/chromium/content/browser/ContentViewCore.java |
diff --git a/content/public/android/java/src/org/chromium/content/browser/ContentViewCore.java b/content/public/android/java/src/org/chromium/content/browser/ContentViewCore.java |
index 681ed5a981b61aca5d575f8369d3bbfd0ee657e0..6961e2f8306b88eae1140897569ec20a6b3b8a92 100644 |
--- a/content/public/android/java/src/org/chromium/content/browser/ContentViewCore.java |
+++ b/content/public/android/java/src/org/chromium/content/browser/ContentViewCore.java |
@@ -323,6 +323,9 @@ public class ContentViewCore |
// because the OSK was just brought up. |
private final Rect mFocusPreOSKViewportRect = new Rect(); |
+ // Whether Keyboard state has been changed (hidden/shown) |
+ private boolean mIsKeyboardStateChanged = false; |
+ |
// On tap this will store the x, y coordinates of the touch. |
private int mLastTapX; |
private int mLastTapY; |
@@ -573,6 +576,7 @@ public class ContentViewCore |
// always be called, crbug.com/294908. |
getContainerView().getWindowVisibleDisplayFrame( |
mFocusPreOSKViewportRect); |
+ mIsKeyboardStateChanged = true; |
} else if (hasFocus() && resultCode == |
InputMethodManager.RESULT_UNCHANGED_SHOWN) { |
// If the OSK was already there, focus the form immediately. |
@@ -1601,10 +1605,14 @@ public class ContentViewCore |
} |
cancelRequestToScrollFocusedEditableNodeIntoView(); |
} |
+ mIsKeyboardStateChanged = false; |
} |
} |
private void cancelRequestToScrollFocusedEditableNodeIntoView() { |
+ // Ignore if onTouchEvent triggerred this call after IME state is updated |
+ if (mIsKeyboardStateChanged == true) return; |
+ |
// Zero-ing the rect will prevent |updateAfterSizeChanged()| from |
// issuing the delayed form focus event. |
mFocusPreOSKViewportRect.setEmpty(); |