From fc0bcdd92a36cdd61cbf9d57e338dd5a137cc667 Mon Sep 17 00:00:00 2001 From: Ben Murdoch Date: Fri, 23 Apr 2010 10:55:29 -0700 Subject: [PATCH] If the user performed a very quick touch sequence without a response from WebCore, then we would enter the ACTION_UP handler and cancel pending touch events in WebCore's message queue. This cancellation was orginally needed for Flash but the touch model for Flash has now changed and it's no longer necessary. In the case of the layout test controller the events do come very fast, and we were hitting this case so WebCore was losing the events that got cancelled meaning that the JS touch callbacks weren't getting invoked. This was exposed by fast/events/basic-single-touch-events.html. Change-Id: Icea09fb55a5b77f7ab9c19473cfa5ae272867a9a --- core/java/android/webkit/WebView.java | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/core/java/android/webkit/WebView.java b/core/java/android/webkit/WebView.java index 3aeabd079fa48..700f1ee6a6d64 100644 --- a/core/java/android/webkit/WebView.java +++ b/core/java/android/webkit/WebView.java @@ -4763,9 +4763,11 @@ public class WebView extends AbsoluteLayout invalidate(); break; } + if (!mConfirmMove) { break; } + if (mPreventDefault == PREVENT_DEFAULT_MAYBE_YES || mPreventDefault == PREVENT_DEFAULT_NO_FROM_TOUCH_DOWN) { // track mLastTouchTime as we may need to do fling at @@ -4933,9 +4935,17 @@ public class WebView extends AbsoluteLayout if (mPreventDefault != PREVENT_DEFAULT_YES && (computeMaxScrollX() > 0 || computeMaxScrollY() > 0)) { - // UI takes control back, cancel WebCore touch - cancelWebCoreTouchEvent(contentX, contentY, - true); + // If the user has performed a very quick touch + // sequence it is possible that we may get here + // before WebCore has had a chance to process the events. + // In this case, any call to preventDefault in the + // JS touch handler will not have been executed yet. + // Hence we will see both the UI (now) and WebCore + // (when context switches) handling the event, + // regardless of whether the web developer actually + // doeses preventDefault in their touch handler. This + // is the nature of our asynchronous touch model. + // we will not rewrite drag code here, but we // will try fling if it applies. WebViewCore.reducePriority();