| 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 cea213c0974eb4320c782560b6865addd29b3c33..412388a61d07074402004cac560d72aa590ff461 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
|
| @@ -391,12 +391,8 @@ public class ContentViewCore
|
|
|
| // Temporary notification to tell onSizeChanged to focus a form element,
|
| // because the OSK was just brought up.
|
| - private boolean mUnfocusOnNextSizeChanged = false;
|
| private final Rect mFocusPreOSKViewportRect = new Rect();
|
|
|
| - // Used to keep track of whether we should try to undo the last zoom-to-textfield operation.
|
| - private boolean mScrolledAndZoomedFocusedEditableNode = false;
|
| -
|
| // Whether we received a new frame since consumePendingRendererFrame() was last called.
|
| private boolean mPendingRendererFrame = false;
|
|
|
| @@ -590,7 +586,6 @@ public class ContentViewCore
|
| getContentViewClient().onImeEvent();
|
| if (!isFinish) {
|
| hideHandles();
|
| - undoScrollFocusedEditableNodeIntoViewIfNeeded(false);
|
| }
|
| }
|
|
|
| @@ -629,8 +624,6 @@ public class ContentViewCore
|
| InputMethodManager.RESULT_UNCHANGED_SHOWN) {
|
| // If the OSK was already there, focus the form immediately.
|
| scrollFocusedEditableNodeIntoView();
|
| - } else {
|
| - undoScrollFocusedEditableNodeIntoViewIfNeeded(false);
|
| }
|
| }
|
| };
|
| @@ -1151,7 +1144,8 @@ public class ContentViewCore
|
| * @see View#onTouchEvent(MotionEvent)
|
| */
|
| public boolean onTouchEvent(MotionEvent event) {
|
| - undoScrollFocusedEditableNodeIntoViewIfNeeded(false);
|
| + cancelRequestToScrollFocusedEditableNodeIntoView();
|
| +
|
| if (!mRequestedVSyncForInput) {
|
| mRequestedVSyncForInput = true;
|
| addVSyncSubscriber();
|
| @@ -1595,56 +1589,23 @@ public class ContentViewCore
|
| if (rect.width() == mFocusPreOSKViewportRect.width()) {
|
| scrollFocusedEditableNodeIntoView();
|
| }
|
| - mFocusPreOSKViewportRect.setEmpty();
|
| + cancelRequestToScrollFocusedEditableNodeIntoView();
|
| }
|
| - } else if (mUnfocusOnNextSizeChanged) {
|
| - undoScrollFocusedEditableNodeIntoViewIfNeeded(true);
|
| - mUnfocusOnNextSizeChanged = false;
|
| }
|
| }
|
|
|
| - private void scrollFocusedEditableNodeIntoView() {
|
| - if (mNativeContentViewCore != 0) {
|
| - Runnable scrollTask = new Runnable() {
|
| - @Override
|
| - public void run() {
|
| - if (mNativeContentViewCore != 0) {
|
| - nativeScrollFocusedEditableNodeIntoView(mNativeContentViewCore);
|
| - }
|
| - }
|
| - };
|
| -
|
| - scrollTask.run();
|
| -
|
| - // The native side keeps track of whether the zoom and scroll actually occurred. It is
|
| - // more efficient to do it this way and sometimes fire an unnecessary message rather
|
| - // than synchronize with the renderer and always have an additional message.
|
| - mScrolledAndZoomedFocusedEditableNode = true;
|
| - }
|
| + private void cancelRequestToScrollFocusedEditableNodeIntoView() {
|
| + // Zero-ing the rect will prevent |updateAfterSizeChanged()| from
|
| + // issuing the delayed form focus event.
|
| + mFocusPreOSKViewportRect.setEmpty();
|
| }
|
|
|
| - private void undoScrollFocusedEditableNodeIntoViewIfNeeded(boolean backButtonPressed) {
|
| - // The only call to this function that matters is the first call after the
|
| - // scrollFocusedEditableNodeIntoView function call.
|
| - // If the first call to this function is a result of a back button press we want to undo the
|
| - // preceding scroll. If the call is a result of some other action we don't want to perform
|
| - // an undo.
|
| - // All subsequent calls are ignored since only the scroll function sets
|
| - // mScrolledAndZoomedFocusedEditableNode to true.
|
| - if (mScrolledAndZoomedFocusedEditableNode && backButtonPressed &&
|
| - mNativeContentViewCore != 0) {
|
| - Runnable scrollTask = new Runnable() {
|
| - @Override
|
| - public void run() {
|
| - if (mNativeContentViewCore != 0) {
|
| - nativeUndoScrollFocusedEditableNodeIntoView(mNativeContentViewCore);
|
| - }
|
| - }
|
| - };
|
| -
|
| - scrollTask.run();
|
| - }
|
| - mScrolledAndZoomedFocusedEditableNode = false;
|
| + private void scrollFocusedEditableNodeIntoView() {
|
| + if (mNativeContentViewCore == 0) return;
|
| + // The native side keeps track of whether the zoom and scroll actually occurred. It is
|
| + // more efficient to do it this way and sometimes fire an unnecessary message rather
|
| + // than synchronize with the renderer and always have an additional message.
|
| + nativeScrollFocusedEditableNodeIntoView(mNativeContentViewCore);
|
| }
|
|
|
| /**
|
| @@ -1681,11 +1642,6 @@ public class ContentViewCore
|
| public boolean dispatchKeyEventPreIme(KeyEvent event) {
|
| try {
|
| TraceEvent.begin();
|
| - if (event.getKeyCode() == KeyEvent.KEYCODE_BACK && mImeAdapter.isActive()) {
|
| - mUnfocusOnNextSizeChanged = true;
|
| - } else {
|
| - undoScrollFocusedEditableNodeIntoViewIfNeeded(false);
|
| - }
|
| return mContainerViewInternals.super_dispatchKeyEventPreIme(event);
|
| } finally {
|
| TraceEvent.end();
|
| @@ -3243,7 +3199,6 @@ public class ContentViewCore
|
| private native void nativeSelectPopupMenuItems(long nativeContentViewCoreImpl, int[] indices);
|
|
|
| private native void nativeScrollFocusedEditableNodeIntoView(long nativeContentViewCoreImpl);
|
| - private native void nativeUndoScrollFocusedEditableNodeIntoView(long nativeContentViewCoreImpl);
|
|
|
| private native void nativeClearHistory(long nativeContentViewCoreImpl);
|
|
|
|
|