diff options
| author | Adam Powell <adamp@google.com> | 2010-09-12 13:14:16 -0700 |
|---|---|---|
| committer | Android (Google) Code Review <android-gerrit@google.com> | 2010-09-12 13:14:16 -0700 |
| commit | 806b717bf52fdc4dfd58bb0e0b7118f63f7b7cce (patch) | |
| tree | dd0496deb4da932c740546f5eb5b013f141a15e7 /core/java/android/webkit/WebView.java | |
| parent | 6d000d4eb733fc6ad7fcd27a4022a41f8433306d (diff) | |
| parent | be36668499683d838e9b0c81d6de6abc1a8bc429 (diff) | |
Merge "resolved conflicts for merge of 12e08f3a to master"
Diffstat (limited to 'core/java/android/webkit/WebView.java')
| -rw-r--r-- | core/java/android/webkit/WebView.java | 55 |
1 files changed, 40 insertions, 15 deletions
diff --git a/core/java/android/webkit/WebView.java b/core/java/android/webkit/WebView.java index bc8544414b3c..27178ab711eb 100644 --- a/core/java/android/webkit/WebView.java +++ b/core/java/android/webkit/WebView.java @@ -3390,6 +3390,14 @@ public class WebView extends AbsoluteLayout // to windows overview, the WebView will be temporarily removed from the // view system. In that case, do nothing. if (getParent() == null) return false; + + // A multi-finger gesture can look like a long press; make sure we don't take + // long press actions if we're scaling. + final ScaleGestureDetector detector = mZoomManager.getMultiTouchGestureDetector(); + if (detector != null && detector.isInProgress()) { + return false; + } + if (mNativeClass != 0 && nativeCursorIsTextInput()) { // Send the click so that the textfield is in focus centerKeyPressOnTextField(); @@ -4838,7 +4846,7 @@ public class WebView extends AbsoluteLayout mTouchMode != TOUCH_DRAG_LAYER_MODE && !skipScaleGesture) { // if the page disallows zoom, skip multi-pointer action - if (mZoomManager.isZoomScaleFixed()) { + if (!mZoomManager.supportsPanDuringZoom() && mZoomManager.isZoomScaleFixed()) { return true; } @@ -4849,17 +4857,28 @@ public class WebView extends AbsoluteLayout MotionEvent temp = MotionEvent.obtain(ev); // Clear the original event and set it to // ACTION_POINTER_DOWN. - temp.setAction(temp.getAction() & - ~MotionEvent.ACTION_MASK | - MotionEvent.ACTION_POINTER_DOWN); - detector.onTouchEvent(temp); + try { + temp.setAction(temp.getAction() & + ~MotionEvent.ACTION_MASK | + MotionEvent.ACTION_POINTER_DOWN); + detector.onTouchEvent(temp); + } finally { + temp.recycle(); + } } detector.onTouchEvent(ev); if (detector.isInProgress()) { mLastTouchTime = eventTime; - return true; + cancelLongPress(); + if (!mZoomManager.supportsPanDuringZoom()) { + return true; + } + mTouchMode = TOUCH_DRAG_MODE; + if (mVelocityTracker == null) { + mVelocityTracker = VelocityTracker.obtain(); + } } x = detector.getFocusX(); @@ -5073,15 +5092,21 @@ public class WebView extends AbsoluteLayout mLastTouchTime = eventTime; break; } - // if it starts nearly horizontal or vertical, enforce it - int ax = Math.abs(deltaX); - int ay = Math.abs(deltaY); - if (ax > MAX_SLOPE_FOR_DIAG * ay) { - mSnapScrollMode = SNAP_X; - mSnapPositive = deltaX > 0; - } else if (ay > MAX_SLOPE_FOR_DIAG * ax) { - mSnapScrollMode = SNAP_Y; - mSnapPositive = deltaY > 0; + + // Only lock dragging to one axis if we don't have a scale in progress. + // Scaling implies free-roaming movement. Note this is only ever a question + // if mZoomManager.supportsPanDuringZoom() is true. + if (detector != null && !detector.isInProgress()) { + // if it starts nearly horizontal or vertical, enforce it + int ax = Math.abs(deltaX); + int ay = Math.abs(deltaY); + if (ax > MAX_SLOPE_FOR_DIAG * ay) { + mSnapScrollMode = SNAP_X; + mSnapPositive = deltaX > 0; + } else if (ay > MAX_SLOPE_FOR_DIAG * ax) { + mSnapScrollMode = SNAP_Y; + mSnapPositive = deltaY > 0; + } } mTouchMode = TOUCH_DRAG_MODE; |
