| Index: content/public/android/java/src/org/chromium/content/browser/ContentViewGestureHandler.java
|
| diff --git a/content/public/android/java/src/org/chromium/content/browser/ContentViewGestureHandler.java b/content/public/android/java/src/org/chromium/content/browser/ContentViewGestureHandler.java
|
| index 7983a77139a70c062ed55269e00aed12aa6459ae..92573f4550742e59f064ee6526dd86287a782a46 100644
|
| --- a/content/public/android/java/src/org/chromium/content/browser/ContentViewGestureHandler.java
|
| +++ b/content/public/android/java/src/org/chromium/content/browser/ContentViewGestureHandler.java
|
| @@ -781,41 +781,42 @@ class ContentViewGestureHandler {
|
| private boolean processTouchEvent(MotionEvent event) {
|
| if (!canHandle(event)) return false;
|
|
|
| - mMotionEventDelegate.onTouchEventHandlingBegin(event);
|
| -
|
| - final boolean wasTouchScrolling = mTouchScrolling;
|
| -
|
| - mSnapScrollController.setSnapScrollingMode(event, isScaleGestureDetectionInProgress());
|
| + try {
|
| + mMotionEventDelegate.onTouchEventHandlingBegin(event);
|
|
|
| - if (event.getActionMasked() == MotionEvent.ACTION_POINTER_DOWN) {
|
| - endDoubleTapDragIfNecessary(event);
|
| - } else if (event.getActionMasked() == MotionEvent.ACTION_DOWN) {
|
| - mGestureDetector.setIsLongpressEnabled(true);
|
| - mCurrentDownEvent = MotionEvent.obtain(event);
|
| - }
|
| + final boolean wasTouchScrolling = mTouchScrolling;
|
|
|
| - boolean handled = mGestureDetector.onTouchEvent(event);
|
| - handled |= processTouchEventForMultiTouch(event);
|
| + mSnapScrollController.setSnapScrollingMode(event, isScaleGestureDetectionInProgress());
|
|
|
| - if (event.getAction() == MotionEvent.ACTION_UP
|
| - || event.getAction() == MotionEvent.ACTION_CANCEL) {
|
| - if (event.getAction() == MotionEvent.ACTION_CANCEL) {
|
| - sendTapCancelIfNecessary(event);
|
| + if (event.getActionMasked() == MotionEvent.ACTION_POINTER_DOWN) {
|
| + endDoubleTapDragIfNecessary(event);
|
| + } else if (event.getActionMasked() == MotionEvent.ACTION_DOWN) {
|
| + mGestureDetector.setIsLongpressEnabled(true);
|
| + mCurrentDownEvent = MotionEvent.obtain(event);
|
| }
|
|
|
| - // "Last finger raised" could be an end to movement, but it should
|
| - // only terminate scrolling if the event did not cause a fling.
|
| - if (wasTouchScrolling && !handled) {
|
| - endTouchScrollIfNecessary(event.getEventTime(), true);
|
| - }
|
| + boolean handled = mGestureDetector.onTouchEvent(event);
|
| + handled |= processTouchEventForMultiTouch(event);
|
|
|
| - if (mCurrentDownEvent != null) recycleEvent(mCurrentDownEvent);
|
| - mCurrentDownEvent = null;
|
| - }
|
| + if (event.getAction() == MotionEvent.ACTION_UP
|
| + || event.getAction() == MotionEvent.ACTION_CANCEL) {
|
| + if (event.getAction() == MotionEvent.ACTION_CANCEL) {
|
| + sendTapCancelIfNecessary(event);
|
| + }
|
|
|
| - mMotionEventDelegate.onTouchEventHandlingEnd();
|
| + // "Last finger raised" could be an end to movement, but it should
|
| + // only terminate scrolling if the event did not cause a fling.
|
| + if (wasTouchScrolling && !handled) {
|
| + endTouchScrollIfNecessary(event.getEventTime(), true);
|
| + }
|
|
|
| - return handled;
|
| + if (mCurrentDownEvent != null) recycleEvent(mCurrentDownEvent);
|
| + mCurrentDownEvent = null;
|
| + }
|
| + return handled;
|
| + } finally {
|
| + mMotionEventDelegate.onTouchEventHandlingEnd();
|
| + }
|
| }
|
|
|
| private boolean isScaleGestureDetectionInProgress() {
|
|
|