summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Huahui Wu <hwu@google.com> 2011-01-12 14:02:36 -0800
committer Huahui Wu <hwu@google.com> 2011-01-12 14:38:30 -0800
commitf147d456a586cfb0de9be8ef6220c4f075189211 (patch)
treea37177adf997c315a8e3afc7a66f5a7f128a98cb
parent8465cc9d88d9511a2fe03185b6d2ac3051eddd56 (diff)
b/3344966 pan following the focus point instead the first point.
Change-Id: Iaed482c7c4e8a616cbabf8c5af706b8160c880b1
-rw-r--r--core/java/android/webkit/WebView.java22
1 files changed, 13 insertions, 9 deletions
diff --git a/core/java/android/webkit/WebView.java b/core/java/android/webkit/WebView.java
index 02cc86fe48ba..4addb08a761c 100644
--- a/core/java/android/webkit/WebView.java
+++ b/core/java/android/webkit/WebView.java
@@ -5341,13 +5341,16 @@ public class WebView extends AbsoluteLayout
return true;
}
- return handleTouchEventCommon(ev);
+ return handleTouchEventCommon(ev, ev.getX(), ev.getY());
}
- private boolean handleTouchEventCommon(MotionEvent ev) {
+ /*
+ * Common code for single touch and multi-touch.
+ * (x, y) denotes current focus point, which is the touch point for single touch
+ * and the middle point for multi-touch.
+ */
+ private boolean handleTouchEventCommon(MotionEvent ev, float x, float y) {
int action = ev.getAction();
- float x = ev.getX();
- float y = ev.getY();
long eventTime = ev.getEventTime();
@@ -5843,10 +5846,8 @@ public class WebView extends AbsoluteLayout
// We don't need to support multi touch for them.
if (detector == null) return false;
- int action = ev.getAction();
float x = ev.getX();
float y = ev.getY();
- long eventTime = ev.getEventTime();
if (!detector.isInProgress() &&
ev.getActionMasked() != MotionEvent.ACTION_POINTER_DOWN) {
@@ -5871,7 +5872,10 @@ public class WebView extends AbsoluteLayout
if (DebugFlags.WEB_VIEW) {
Log.v(LOGTAG, "detector is in progress");
}
- mLastTouchTime = eventTime;
+ mLastTouchTime = ev.getEventTime();
+ x = detector.getFocusX();
+ y = detector.getFocusY();
+
cancelLongPress();
mPrivateHandler.removeMessages(SWITCH_TO_LONGPRESS);
if (!mZoomManager.supportsPanDuringZoom()) {
@@ -5883,7 +5887,7 @@ public class WebView extends AbsoluteLayout
}
}
- action = ev.getAction() & MotionEvent.ACTION_MASK;
+ int action = ev.getActionMasked();
if (action == MotionEvent.ACTION_POINTER_DOWN) {
cancelTouch();
action = MotionEvent.ACTION_DOWN;
@@ -5898,7 +5902,7 @@ public class WebView extends AbsoluteLayout
}
}
- return handleTouchEventCommon(ev);
+ return handleTouchEventCommon(ev, x, y);
}
private void cancelWebCoreTouchEvent(int x, int y, boolean removeEvents) {