Chromium Code Reviews| 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..e4f76d28324bbd4611e6be554af3c0ccc74da2e2 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(); |
|
aurimas (slooooooooow)
2014/03/12 18:06:11
Do we still need this value?
jdduke (slow)
2014/03/12 18:18:55
Unfortunately yes. Longer term we should use anot
|
| - // 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,6 @@ public class ContentViewCore |
| * @see View#onTouchEvent(MotionEvent) |
| */ |
| public boolean onTouchEvent(MotionEvent event) { |
| - undoScrollFocusedEditableNodeIntoViewIfNeeded(false); |
| if (!mRequestedVSyncForInput) { |
| mRequestedVSyncForInput = true; |
| addVSyncSubscriber(); |
| @@ -1597,54 +1589,15 @@ public class ContentViewCore |
| } |
| mFocusPreOSKViewportRect.setEmpty(); |
| } |
| - } 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 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; |
| + 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 +1634,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 +3191,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); |