| 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 5bd4ed79fe778231d725e699352fe3364bdfc25d..7a089f8bb446651c1169842bd07b5d132358006e 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
|
| @@ -198,11 +198,6 @@ public class ContentViewCore
|
| void onPinchGestureEnd();
|
|
|
| /**
|
| - * Called when the fling gesture is sent.
|
| - */
|
| - void onFlingStartGesture(int vx, int vy);
|
| -
|
| - /**
|
| * Called when the fling cancel gesture is sent.
|
| */
|
| void onFlingCancelGesture();
|
| @@ -210,7 +205,7 @@ public class ContentViewCore
|
| /**
|
| * Called when a fling event was not handled by the renderer.
|
| */
|
| - void onUnhandledFlingStartEvent();
|
| + void onUnhandledFlingStartEvent(int velocityX, int velocityY);
|
|
|
| /**
|
| * Called to indicate that a scroll update gesture had been consumed by the page.
|
| @@ -1338,39 +1333,44 @@ public class ContentViewCore
|
| }
|
|
|
| @Override
|
| - public boolean sendTouchEvent(long timeMs, int action, TouchPoint[] pts) {
|
| - if (mNativeContentViewCore != 0) {
|
| - return nativeSendTouchEvent(mNativeContentViewCore, timeMs, action, pts);
|
| - }
|
| - return false;
|
| + public void onTouchEventHandlingBegin(long timeMs, int action, TouchPoint[] pts) {
|
| + if (mNativeContentViewCore == 0) return;
|
| + nativeOnTouchEventHandlingBegin(mNativeContentViewCore, timeMs, action, pts);
|
| }
|
|
|
| - @SuppressWarnings("unused")
|
| - @CalledByNative
|
| - private void hasTouchEventHandlers(boolean hasTouchHandlers) {
|
| - mContentViewGestureHandler.hasTouchEventHandlers(hasTouchHandlers);
|
| + @Override
|
| + public void onTouchEventHandlingEnd() {
|
| + if (mNativeContentViewCore == 0) return;
|
| + nativeOnTouchEventHandlingEnd(mNativeContentViewCore);
|
| }
|
|
|
| @SuppressWarnings("unused")
|
| @CalledByNative
|
| - private void confirmTouchEvent(int ackResult) {
|
| - mContentViewGestureHandler.confirmTouchEvent(ackResult);
|
| + private void unhandledFlingStartEvent(float vx, float vy) {
|
| + if (mGestureStateListener != null) {
|
| + mGestureStateListener.onUnhandledFlingStartEvent((int) vx, (int) vy);
|
| + }
|
| }
|
|
|
| @SuppressWarnings("unused")
|
| @CalledByNative
|
| - private void unhandledFlingStartEvent() {
|
| + private void onScrollUpdateGestureConsumed() {
|
| if (mGestureStateListener != null) {
|
| - mGestureStateListener.onUnhandledFlingStartEvent();
|
| + mGestureStateListener.onScrollUpdateGestureConsumed();
|
| }
|
| }
|
|
|
| @SuppressWarnings("unused")
|
| @CalledByNative
|
| - private void onScrollUpdateGestureConsumed() {
|
| - if (mGestureStateListener != null) {
|
| - mGestureStateListener.onScrollUpdateGestureConsumed();
|
| + private boolean onForwardingGestureEvent(int type, int x, int y) {
|
| + if (offerGestureToEmbedder(type)) return true;
|
| + updateTextHandlesForGesture(type);
|
| + updateGestureStateListener(type);
|
| + updateForTapOrPress(type, x, y);
|
| + if (type == ContentViewGestureHandler.GESTURE_SCROLL_BY) {
|
| + mZoomControlsDelegate.invokeZoomPicker();
|
| }
|
| + return false;
|
| }
|
|
|
| private void reportActionAfterDoubleTapUMA(int type) {
|
| @@ -1379,10 +1379,7 @@ public class ContentViewCore
|
|
|
| @Override
|
| public boolean sendGesture(int type, long timeMs, int x, int y, Bundle b) {
|
| - if (offerGestureToEmbedder(type)) return false;
|
| if (mNativeContentViewCore == 0) return false;
|
| - updateTextHandlesForGesture(type);
|
| - updateGestureStateListener(type, b);
|
| switch (type) {
|
| case ContentViewGestureHandler.GESTURE_SHOW_PRESSED_STATE:
|
| nativeShowPressState(mNativeContentViewCore, timeMs, x, y);
|
| @@ -1400,17 +1397,19 @@ public class ContentViewCore
|
| nativeSingleTap(mNativeContentViewCore, timeMs, x, y, false);
|
| return true;
|
| case ContentViewGestureHandler.GESTURE_SINGLE_TAP_CONFIRMED:
|
| - handleTapOrPress(timeMs, x, y, 0,
|
| - b.getBoolean(ContentViewGestureHandler.SHOW_PRESS, false));
|
| + if (!b.getBoolean(ContentViewGestureHandler.SHOW_PRESS, false)) {
|
| + nativeShowPressState(mNativeContentViewCore, timeMs, x, y);
|
| + }
|
| + nativeSingleTap(mNativeContentViewCore, timeMs, x, y, false);
|
| return true;
|
| case ContentViewGestureHandler.GESTURE_SINGLE_TAP_UNCONFIRMED:
|
| nativeSingleTapUnconfirmed(mNativeContentViewCore, timeMs, x, y);
|
| return true;
|
| case ContentViewGestureHandler.GESTURE_LONG_PRESS:
|
| - handleTapOrPress(timeMs, x, y, IS_LONG_PRESS, false);
|
| + nativeLongPress(mNativeContentViewCore, timeMs, x, y, false);
|
| return true;
|
| case ContentViewGestureHandler.GESTURE_LONG_TAP:
|
| - handleTapOrPress(timeMs, x, y, IS_LONG_TAP, false);
|
| + nativeLongTap(mNativeContentViewCore, timeMs, x, y, false);
|
| return true;
|
| case ContentViewGestureHandler.GESTURE_SCROLL_START: {
|
| int dx = b.getInt(ContentViewGestureHandler.DELTA_HINT_X);
|
| @@ -1479,7 +1478,7 @@ public class ContentViewCore
|
| mGestureStateListener = pinchGestureStateListener;
|
| }
|
|
|
| - void updateGestureStateListener(int gestureType, Bundle b) {
|
| + void updateGestureStateListener(int gestureType) {
|
| if (mGestureStateListener == null) return;
|
|
|
| switch (gestureType) {
|
| @@ -1489,11 +1488,6 @@ public class ContentViewCore
|
| case ContentViewGestureHandler.GESTURE_PINCH_END:
|
| mGestureStateListener.onPinchGestureEnd();
|
| break;
|
| - case ContentViewGestureHandler.GESTURE_FLING_START:
|
| - mGestureStateListener.onFlingStartGesture(
|
| - b.getInt(ContentViewGestureHandler.VELOCITY_X, 0),
|
| - b.getInt(ContentViewGestureHandler.VELOCITY_Y, 0));
|
| - break;
|
| case ContentViewGestureHandler.GESTURE_FLING_CANCEL:
|
| mGestureStateListener.onFlingCancelGesture();
|
| break;
|
| @@ -2024,8 +2018,11 @@ public class ContentViewCore
|
| }
|
| }
|
|
|
| - private void handleTapOrPress(
|
| - long timeMs, float xPix, float yPix, int isLongPressOrTap, boolean showPress) {
|
| + private void updateForTapOrPress(int type, float xPix, float yPix) {
|
| + if (type != ContentViewGestureHandler.GESTURE_SINGLE_TAP_CONFIRMED
|
| + && type != ContentViewGestureHandler.GESTURE_LONG_PRESS
|
| + && type != ContentViewGestureHandler.GESTURE_LONG_TAP) return;
|
| +
|
| if (mContainerView.isFocusable() && mContainerView.isFocusableInTouchMode()
|
| && !mContainerView.isFocused()) {
|
| mContainerView.requestFocus();
|
| @@ -2033,26 +2030,14 @@ public class ContentViewCore
|
|
|
| if (!mPopupZoomer.isShowing()) mPopupZoomer.setLastTouch(xPix, yPix);
|
|
|
| - if (isLongPressOrTap == IS_LONG_PRESS) {
|
| + if (type == ContentViewGestureHandler.GESTURE_LONG_PRESS) {
|
| getInsertionHandleController().allowAutomaticShowing();
|
| getSelectionHandleController().allowAutomaticShowing();
|
| - if (mNativeContentViewCore != 0) {
|
| - nativeLongPress(mNativeContentViewCore, timeMs, xPix, yPix, false);
|
| - }
|
| - } else if (isLongPressOrTap == IS_LONG_TAP) {
|
| + } else if (type == ContentViewGestureHandler.GESTURE_LONG_TAP) {
|
| getInsertionHandleController().allowAutomaticShowing();
|
| getSelectionHandleController().allowAutomaticShowing();
|
| - if (mNativeContentViewCore != 0) {
|
| - nativeLongTap(mNativeContentViewCore, timeMs, xPix, yPix, false);
|
| - }
|
| } else {
|
| - if (!showPress && mNativeContentViewCore != 0) {
|
| - nativeShowPressState(mNativeContentViewCore, timeMs, xPix, yPix);
|
| - }
|
| if (mSelectionEditable) getInsertionHandleController().allowAutomaticShowing();
|
| - if (mNativeContentViewCore != 0) {
|
| - nativeSingleTap(mNativeContentViewCore, timeMs, xPix, yPix, false);
|
| - }
|
| }
|
| }
|
|
|
| @@ -2792,14 +2777,6 @@ public class ContentViewCore
|
| }
|
|
|
| /**
|
| - * Invokes the graphical zoom picker widget for this ContentView.
|
| - */
|
| - @Override
|
| - public void invokeZoomPicker() {
|
| - mZoomControlsDelegate.invokeZoomPicker();
|
| - }
|
| -
|
| - /**
|
| * This will mimic {@link #addPossiblyUnsafeJavascriptInterface(Object, String, Class)}
|
| * and automatically pass in {@link JavascriptInterface} as the required annotation.
|
| *
|
| @@ -3289,9 +3266,11 @@ public class ContentViewCore
|
| long nativeContentViewCoreImpl, int orientation);
|
|
|
| // All touch events (including flings, scrolls etc) accept coordinates in physical pixels.
|
| - private native boolean nativeSendTouchEvent(
|
| + private native void nativeOnTouchEventHandlingBegin(
|
| long nativeContentViewCoreImpl, long timeMs, int action, TouchPoint[] pts);
|
|
|
| + private native void nativeOnTouchEventHandlingEnd(long nativeContentViewCoreImpl);
|
| +
|
| private native int nativeSendMouseMoveEvent(
|
| long nativeContentViewCoreImpl, long timeMs, float x, float y);
|
|
|
|
|