| 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 0d1ea54d54947c624173cf6cc0260afcd0e58b00..6d4ad9afb10e2eeb4e7c034c349f0b1e32ed90a3 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
|
| @@ -65,7 +65,6 @@ import org.chromium.content.browser.input.AnimationIntervalProvider;
|
| import org.chromium.content.browser.input.FloatingPastePopupMenu;
|
| import org.chromium.content.browser.input.ImeAdapter;
|
| import org.chromium.content.browser.input.InputMethodManagerWrapper;
|
| -import org.chromium.content.browser.input.JoystickScrollProvider;
|
| import org.chromium.content.browser.input.JoystickZoomProvider;
|
| import org.chromium.content.browser.input.LegacyPastePopupMenu;
|
| import org.chromium.content.browser.input.PastePopupMenu;
|
| @@ -354,9 +353,6 @@ public class ContentViewCore implements AccessibilityStateChangeListener, Screen
|
| // Cached copy of all positions and scales as reported by the renderer.
|
| private final RenderCoordinates mRenderCoordinates;
|
|
|
| - // Provides smooth gamepad joystick-driven scrolling.
|
| - private final JoystickScrollProvider mJoystickScrollProvider;
|
| -
|
| // Provides smooth gamepad joystick-driven zooming.
|
| private JoystickZoomProvider mJoystickZoomProvider;
|
|
|
| @@ -412,10 +408,6 @@ public class ContentViewCore implements AccessibilityStateChangeListener, Screen
|
| // because the OSK was just brought up.
|
| private final Rect mFocusPreOSKViewportRect = new Rect();
|
|
|
| - // Store the x, y coordinates of the last touch or mouse event.
|
| - private float mLastFocalEventX;
|
| - private float mLastFocalEventY;
|
| -
|
| // Whether a touch scroll sequence is active, used to hide text selection
|
| // handles. Note that a scroll sequence will *always* bound a pinch
|
| // sequence, so this will also be true for the duration of a pinch gesture.
|
| @@ -480,7 +472,6 @@ public class ContentViewCore implements AccessibilityStateChangeListener, Screen
|
| public ContentViewCore(Context context) {
|
| mContext = context;
|
| mRenderCoordinates = new RenderCoordinates();
|
| - mJoystickScrollProvider = new JoystickScrollProvider(this);
|
| mAccessibilityManager = (AccessibilityManager)
|
| getContext().getSystemService(Context.ACCESSIBILITY_SERVICE);
|
| mSystemCaptioningBridge = CaptioningBridgeFactory.getSystemCaptioningBridge(mContext);
|
| @@ -1500,7 +1491,6 @@ public class ContentViewCore implements AccessibilityStateChangeListener, Screen
|
|
|
| public void onFocusChanged(boolean gainFocus) {
|
| mImeAdapter.onViewFocusChanged(gainFocus);
|
| - mJoystickScrollProvider.setEnabled(gainFocus && !mFocusedNodeEditable);
|
|
|
| if (gainFocus) {
|
| restoreSelectionPopupsIfNecessary();
|
| @@ -1594,8 +1584,6 @@ public class ContentViewCore implements AccessibilityStateChangeListener, Screen
|
| public boolean onGenericMotionEvent(MotionEvent event) {
|
| if (GamepadList.onGenericMotionEvent(event)) return true;
|
| if ((event.getSource() & InputDevice.SOURCE_CLASS_POINTER) != 0) {
|
| - mLastFocalEventX = event.getX();
|
| - mLastFocalEventY = event.getY();
|
| switch (event.getAction()) {
|
| case MotionEvent.ACTION_SCROLL:
|
| if (mNativeContentViewCore == 0) return false;
|
| @@ -1621,7 +1609,6 @@ public class ContentViewCore implements AccessibilityStateChangeListener, Screen
|
| return true;
|
| }
|
| } else if ((event.getSource() & InputDevice.SOURCE_CLASS_JOYSTICK) != 0) {
|
| - if (mJoystickScrollProvider.onMotion(event)) return true;
|
| if (mJoystickZoomProvider == null) {
|
| mJoystickZoomProvider =
|
| new JoystickZoomProvider(this, new SystemAnimationIntervalProvider());
|
| @@ -1656,7 +1643,7 @@ public class ContentViewCore implements AccessibilityStateChangeListener, Screen
|
| * are overridden, so that View's mScrollX and mScrollY will be unchanged at
|
| * (0, 0). This is critical for drawing ContentView correctly.
|
| */
|
| - public void scrollBy(float dxPix, float dyPix, boolean useLastFocalEventLocation) {
|
| + public void scrollBy(float dxPix, float dyPix) {
|
| if (mNativeContentViewCore == 0) return;
|
| if (dxPix == 0 && dyPix == 0) return;
|
| long time = SystemClock.uptimeMillis();
|
| @@ -1665,11 +1652,8 @@ public class ContentViewCore implements AccessibilityStateChangeListener, Screen
|
| // such cases ensures a consistent gesture event stream.
|
| if (mPotentiallyActiveFlingCount > 0) nativeFlingCancel(mNativeContentViewCore, time);
|
| // x/y represents starting location of scroll.
|
| - final float x = useLastFocalEventLocation ? mLastFocalEventX : 0f;
|
| - final float y = useLastFocalEventLocation ? mLastFocalEventY : 0f;
|
| - nativeScrollBegin(
|
| - mNativeContentViewCore, time, x, y, -dxPix, -dyPix, !useLastFocalEventLocation);
|
| - nativeScrollBy(mNativeContentViewCore, time, x, y, dxPix, dyPix);
|
| + nativeScrollBegin(mNativeContentViewCore, time, 0, 0, -dxPix, -dyPix, true);
|
| + nativeScrollBy(mNativeContentViewCore, time, 0, 0, dxPix, dyPix);
|
| nativeScrollEnd(mNativeContentViewCore, time);
|
| }
|
|
|
| @@ -1682,7 +1666,7 @@ public class ContentViewCore implements AccessibilityStateChangeListener, Screen
|
| final float yCurrentPix = mRenderCoordinates.getScrollYPix();
|
| final float dxPix = xPix - xCurrentPix;
|
| final float dyPix = yPix - yCurrentPix;
|
| - scrollBy(dxPix, dyPix, false);
|
| + scrollBy(dxPix, dyPix);
|
| }
|
|
|
| // NOTE: this can go away once ContentView.getScrollX() reports correct values.
|
| @@ -1762,7 +1746,7 @@ public class ContentViewCore implements AccessibilityStateChangeListener, Screen
|
| }
|
| }
|
|
|
| - private void updateForTapOrPress(int type, float xPix, float yPix) {
|
| + private void updateForTapOrPress(int type, float x, float y) {
|
| if (type != GestureEventType.SINGLE_TAP_CONFIRMED
|
| && type != GestureEventType.SINGLE_TAP_UP
|
| && type != GestureEventType.LONG_PRESS
|
| @@ -1775,9 +1759,10 @@ public class ContentViewCore implements AccessibilityStateChangeListener, Screen
|
| mContainerView.requestFocus();
|
| }
|
|
|
| - if (!mPopupZoomer.isShowing()) mPopupZoomer.setLastTouch(xPix, yPix);
|
| - mLastFocalEventX = xPix;
|
| - mLastFocalEventY = yPix;
|
| + if (!mPopupZoomer.isShowing()) {
|
| + final float deviceScale = mRenderCoordinates.getDeviceScaleFactor();
|
| + mPopupZoomer.setLastTouch((int) (x * deviceScale), (int) (y * deviceScale));
|
| + }
|
| }
|
|
|
| public void setZoomControlsDelegate(ZoomControlsDelegate zoomControlsDelegate) {
|
| @@ -2340,7 +2325,6 @@ public class ContentViewCore implements AccessibilityStateChangeListener, Screen
|
| mFocusedNodeIsPassword = focusedNodeIsPassword;
|
| if (focusedNodeEditable != mFocusedNodeEditable) {
|
| mFocusedNodeEditable = focusedNodeEditable;
|
| - mJoystickScrollProvider.setEnabled(!mFocusedNodeEditable);
|
| getContentViewClient().onFocusedNodeEditabilityChanged(mFocusedNodeEditable);
|
| }
|
| } finally {
|
|
|