From d66d84ffa2d96120ecd607af3f3c597fb673b178 Mon Sep 17 00:00:00 2001 From: Grace Kloba Date: Sun, 27 Sep 2009 14:48:07 -0700 Subject: [PATCH] Reset mPreventDrag at touch_down. Check the delta for short press case as we may switch to PREVENT_DRAG_NO at SWITCH_TO_SHORTPRESS. This should fix another two corner cases where flick doesn't do anything. --- core/java/android/webkit/WebView.java | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/core/java/android/webkit/WebView.java b/core/java/android/webkit/WebView.java index 90985e062cacb..07034afb775c4 100644 --- a/core/java/android/webkit/WebView.java +++ b/core/java/android/webkit/WebView.java @@ -3689,6 +3689,7 @@ public class WebView extends AbsoluteLayout switch (action) { case MotionEvent.ACTION_DOWN: { + mPreventDrag = PREVENT_DRAG_NO; if (!mScroller.isFinished()) { // stop the current scroll animation, but if this is // the start of a fling, allow it to add to the current @@ -3896,19 +3897,15 @@ public class WebView extends AbsoluteLayout mTouchMode = TOUCH_DONE_MODE; doDoubleTap(); break; - case TOUCH_SHORTPRESS_START_MODE: - case TOUCH_SHORTPRESS_MODE: - mPrivateHandler.removeMessages(SWITCH_TO_SHORTPRESS); - mPrivateHandler.removeMessages(SWITCH_TO_LONGPRESS); - mTouchMode = TOUCH_DONE_MODE; - doShortPress(); - break; case TOUCH_SELECT_MODE: commitCopy(); mTouchSelection = false; break; case TOUCH_INIT_MODE: // tap + case TOUCH_SHORTPRESS_START_MODE: + case TOUCH_SHORTPRESS_MODE: mPrivateHandler.removeMessages(SWITCH_TO_SHORTPRESS); + mPrivateHandler.removeMessages(SWITCH_TO_LONGPRESS); if ((deltaX * deltaX + deltaY * deltaY) > mTouchSlopSquare) { Log.w(LOGTAG, "Miss a drag as we are waiting for" + " WebCore's response for touch down."); @@ -3928,10 +3925,15 @@ public class WebView extends AbsoluteLayout mPreventDrag = PREVENT_DRAG_NO; } if (mPreventDrag == PREVENT_DRAG_NO) { - mPrivateHandler.sendMessageDelayed( - mPrivateHandler.obtainMessage( - RELEASE_SINGLE_TAP), - ViewConfiguration.getDoubleTapTimeout()); + if (mTouchMode == TOUCH_INIT_MODE) { + mPrivateHandler.sendMessageDelayed( + mPrivateHandler.obtainMessage( + RELEASE_SINGLE_TAP), + ViewConfiguration.getDoubleTapTimeout()); + } else { + mTouchMode = TOUCH_DONE_MODE; + doShortPress(); + } } break; }