diff options
| author | John Reck <jreck@google.com> | 2012-05-17 13:47:39 -0700 |
|---|---|---|
| committer | John Reck <jreck@google.com> | 2012-05-17 13:47:39 -0700 |
| commit | eb11f47353102deb13c73b9c1106ed34761cd784 (patch) | |
| tree | ded3339b49e4e252c3bfee3f61a6bbd466768d99 /core/java/android/webkit/WebViewInputDispatcher.java | |
| parent | 76c0c612cdd5eeef8ff2f7a4478f6320a713d7a3 (diff) | |
Tweak show/hide of touch highlight
Bug: 6490959
Fixes the issue where we will show the old tap highlight
if webkit isn't quick enough to respond
Change-Id: Icd9864d276b6ad311e3f3dc4deaa7085e3769006
Diffstat (limited to 'core/java/android/webkit/WebViewInputDispatcher.java')
| -rw-r--r-- | core/java/android/webkit/WebViewInputDispatcher.java | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/core/java/android/webkit/WebViewInputDispatcher.java b/core/java/android/webkit/WebViewInputDispatcher.java index c5a86d824239..d118eacb3b00 100644 --- a/core/java/android/webkit/WebViewInputDispatcher.java +++ b/core/java/android/webkit/WebViewInputDispatcher.java @@ -399,7 +399,6 @@ final class WebViewInputDispatcher { unscheduleHideTapHighlightLocked(); unscheduleShowTapHighlightLocked(); mUiCallbacks.showTapHighlight(true); - scheduleHideTapHighlightLocked(); } private void scheduleShowTapHighlightLocked() { @@ -466,13 +465,13 @@ final class WebViewInputDispatcher { return; } mPostClickScheduled = false; - showTapCandidateLocked(); MotionEvent event = mPostTouchStream.getLastEvent(); if (event == null || event.getAction() != MotionEvent.ACTION_UP) { return; } + showTapCandidateLocked(); MotionEvent eventToEnqueue = MotionEvent.obtainNoHistory(event); DispatchEvent d = obtainDispatchEventLocked(eventToEnqueue, EVENT_TYPE_CLICK, 0, mPostLastWebKitXOffset, mPostLastWebKitYOffset, mPostLastWebKitScale); @@ -511,6 +510,7 @@ final class WebViewInputDispatcher { } private void enqueueHitTestLocked(MotionEvent event) { + mUiCallbacks.clearPreviousHitTest(); MotionEvent eventToEnqueue = MotionEvent.obtainNoHistory(event); DispatchEvent d = obtainDispatchEventLocked(eventToEnqueue, EVENT_TYPE_HIT_TEST, 0, mPostLastWebKitXOffset, mPostLastWebKitYOffset, mPostLastWebKitScale); @@ -666,6 +666,10 @@ final class WebViewInputDispatcher { if (event != null && recycleEvent) { event.recycle(); } + + if (eventType == EVENT_TYPE_CLICK) { + scheduleHideTapHighlightLocked(); + } } } } @@ -802,6 +806,10 @@ final class WebViewInputDispatcher { d.mEvent = null; // retain ownership of event, don't recycle it yet } recycleDispatchEventLocked(d); + + if (eventType == EVENT_TYPE_CLICK) { + scheduleHideTapHighlightLocked(); + } } // Handle the event. @@ -1050,6 +1058,12 @@ final class WebViewInputDispatcher { * @param show True if it should show the highlight, false if it should hide it */ public void showTapHighlight(boolean show); + + /** + * Called when we are sending a new EVENT_TYPE_HIT_TEST to WebKit, so + * previous hit tests should be cleared as they are obsolete. + */ + public void clearPreviousHitTest(); } /* Implemented by {@link WebViewCore} to perform operations on the web kit thread. */ |
