diff options
| author | Grace Kloba <klobag@google.com> | 2010-01-20 17:38:18 -0800 |
|---|---|---|
| committer | Grace Kloba <klobag@google.com> | 2010-01-20 19:15:44 -0800 |
| commit | 8681df902e8cc61d290808c5d78ea48920d30f3b (patch) | |
| tree | eca11b1ad99172017f272b38351058ab2aac7374 | |
| parent | a66baccc8fa9f6fa5f1630845e3c6370cb3418eb (diff) | |
| download | frameworks_base-8681df902e8cc61d290808c5d78ea48920d30f3b.zip frameworks_base-8681df902e8cc61d290808c5d78ea48920d30f3b.tar.gz frameworks_base-8681df902e8cc61d290808c5d78ea48920d30f3b.tar.bz2 | |
DO NOT MERGE
Adopt the sloppy detection in the ScaleGestureDetector.
Try to fix the fat thumb problem.
Fix http://b/issue?id=2385061
| -rw-r--r-- | core/java/android/webkit/WebView.java | 36 |
1 files changed, 29 insertions, 7 deletions
diff --git a/core/java/android/webkit/WebView.java b/core/java/android/webkit/WebView.java index 1c335aa..ab1841e 100644 --- a/core/java/android/webkit/WebView.java +++ b/core/java/android/webkit/WebView.java @@ -3965,19 +3965,41 @@ public class WebView extends AbsoluteLayout + mTouchMode); } + int action; + float x, y; + long eventTime = ev.getEventTime(); + // FIXME: we may consider to give WebKit an option to handle multi-touch // events later. if (mSupportMultiTouch && mMinZoomScale < mMaxZoomScale && ev.getPointerCount() > 1) { - mLastTouchTime = ev.getEventTime(); - return mScaleDetector.onTouchEvent(ev); + mScaleDetector.onTouchEvent(ev); + if (mScaleDetector.isInProgress()) { + mLastTouchTime = eventTime; + return true; + } + x = mScaleDetector.getFocusX(); + y = mScaleDetector.getFocusY(); + action = ev.getAction() & MotionEvent.ACTION_MASK; + if (action == MotionEvent.ACTION_POINTER_DOWN) { + cancelTouch(); + action = MotionEvent.ACTION_DOWN; + } else if (action == MotionEvent.ACTION_POINTER_UP) { + // set mLastTouchX/Y to the remaining point + mLastTouchX = x; + mLastTouchY = y; + } else if (action == MotionEvent.ACTION_MOVE) { + // negative x or y indicate it is on the edge, skip it. + if (x < 0 || y < 0) { + return true; + } + } + } else { + action = ev.getAction(); + x = ev.getX(); + y = ev.getY(); } - int action = ev.getAction(); - float x = ev.getX(); - float y = ev.getY(); - long eventTime = ev.getEventTime(); - // Due to the touch screen edge effect, a touch closer to the edge // always snapped to the edge. As getViewWidth() can be different from // getWidth() due to the scrollbar, adjusting the point to match |
