@@ -399,7 +399,6 @@ private void showTapCandidateLocked() {
399399 unscheduleHideTapHighlightLocked ();
400400 unscheduleShowTapHighlightLocked ();
401401 mUiCallbacks .showTapHighlight (true );
402- scheduleHideTapHighlightLocked ();
403402 }
404403
405404 private void scheduleShowTapHighlightLocked () {
@@ -466,13 +465,13 @@ private void postClick() {
466465 return ;
467466 }
468467 mPostClickScheduled = false ;
469- showTapCandidateLocked ();
470468
471469 MotionEvent event = mPostTouchStream .getLastEvent ();
472470 if (event == null || event .getAction () != MotionEvent .ACTION_UP ) {
473471 return ;
474472 }
475473
474+ showTapCandidateLocked ();
476475 MotionEvent eventToEnqueue = MotionEvent .obtainNoHistory (event );
477476 DispatchEvent d = obtainDispatchEventLocked (eventToEnqueue , EVENT_TYPE_CLICK , 0 ,
478477 mPostLastWebKitXOffset , mPostLastWebKitYOffset , mPostLastWebKitScale );
@@ -511,6 +510,7 @@ private void enqueueDoubleTapLocked(MotionEvent event) {
511510 }
512511
513512 private void enqueueHitTestLocked (MotionEvent event ) {
513+ mUiCallbacks .clearPreviousHitTest ();
514514 MotionEvent eventToEnqueue = MotionEvent .obtainNoHistory (event );
515515 DispatchEvent d = obtainDispatchEventLocked (eventToEnqueue , EVENT_TYPE_HIT_TEST , 0 ,
516516 mPostLastWebKitXOffset , mPostLastWebKitYOffset , mPostLastWebKitScale );
@@ -666,6 +666,10 @@ private void dispatchWebKitEvents(boolean calledFromHandler) {
666666 if (event != null && recycleEvent ) {
667667 event .recycle ();
668668 }
669+
670+ if (eventType == EVENT_TYPE_CLICK ) {
671+ scheduleHideTapHighlightLocked ();
672+ }
669673 }
670674 }
671675 }
@@ -802,6 +806,10 @@ private void dispatchUiEvents(boolean calledFromHandler) {
802806 d .mEvent = null ; // retain ownership of event, don't recycle it yet
803807 }
804808 recycleDispatchEventLocked (d );
809+
810+ if (eventType == EVENT_TYPE_CLICK ) {
811+ scheduleHideTapHighlightLocked ();
812+ }
805813 }
806814
807815 // Handle the event.
@@ -1050,6 +1058,12 @@ public static interface UiCallbacks {
10501058 * @param show True if it should show the highlight, false if it should hide it
10511059 */
10521060 public void showTapHighlight (boolean show );
1061+
1062+ /**
1063+ * Called when we are sending a new EVENT_TYPE_HIT_TEST to WebKit, so
1064+ * previous hit tests should be cleared as they are obsolete.
1065+ */
1066+ public void clearPreviousHitTest ();
10531067 }
10541068
10551069 /* Implemented by {@link WebViewCore} to perform operations on the web kit thread. */
0 commit comments