Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(683)

Unified Diff: content/public/android/java/src/org/chromium/content/browser/ContentViewGestureHandler.java

Issue 170673005: [Android] More eager gesture recognition hardening (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add type DCHECK Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/browser/renderer_host/input/gesture_event_packet.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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() {
« no previous file with comments | « content/browser/renderer_host/input/gesture_event_packet.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698