summaryrefslogtreecommitdiff
path: root/core/java/android/webkit/WebViewInputDispatcher.java
diff options
context:
space:
mode:
authorJohn Reck <jreck@google.com>2012-05-14 17:59:13 -0700
committerJohn Reck <jreck@google.com>2012-05-14 18:40:48 -0700
commit41f73bdf4d915305152ba2053b7523bf5f90ffa8 (patch)
tree852441d3c849040de0dac5ec0e39205d4d9244aa /core/java/android/webkit/WebViewInputDispatcher.java
parent2411c3361eb2c15b09a8bfadf5c7c4a3de092ea0 (diff)
Always do a HIT_TEST
Bug: 6490959 The issue here is that if the page calls preventDefault on a touchstart handler WebViewClassic will not do a HIT_TEST as it doesn't get the ACTION_DOWN. This means that the mouse is in the wrong position when the click ultimately fires. This changes it so that WebViewInputDispatcher will always do a HIT_TEST at the start of a touch stream, which ensures that the mouse is positioned correctly. Change-Id: I1aaca7692e2c7aeedeb21fa3592cd4cb3223ea25
Diffstat (limited to 'core/java/android/webkit/WebViewInputDispatcher.java')
-rw-r--r--core/java/android/webkit/WebViewInputDispatcher.java17
1 files changed, 14 insertions, 3 deletions
diff --git a/core/java/android/webkit/WebViewInputDispatcher.java b/core/java/android/webkit/WebViewInputDispatcher.java
index 9328d8c04010..9eeb31167df0 100644
--- a/core/java/android/webkit/WebViewInputDispatcher.java
+++ b/core/java/android/webkit/WebViewInputDispatcher.java
@@ -204,6 +204,11 @@ final class WebViewInputDispatcher {
public static final int EVENT_TYPE_DOUBLE_TAP = 5;
/**
+ * Event type: Indicates that a hit test should be performed
+ */
+ public static final int EVENT_TYPE_HIT_TEST = 6;
+
+ /**
* Flag: This event is private to this queue. Do not forward it.
*/
public static final int FLAG_PRIVATE = 1 << 0;
@@ -499,13 +504,17 @@ final class WebViewInputDispatcher {
}
private void enqueueDoubleTapLocked(MotionEvent event) {
- unscheduleClickLocked();
- hideTapCandidateLocked();
MotionEvent eventToEnqueue = MotionEvent.obtainNoHistory(event);
DispatchEvent d = obtainDispatchEventLocked(eventToEnqueue, EVENT_TYPE_DOUBLE_TAP, 0,
mPostLastWebKitXOffset, mPostLastWebKitYOffset, mPostLastWebKitScale);
enqueueEventLocked(d);
- mIsDoubleTapCandidate = false;
+ }
+
+ private void enqueueHitTestLocked(MotionEvent event) {
+ MotionEvent eventToEnqueue = MotionEvent.obtainNoHistory(event);
+ DispatchEvent d = obtainDispatchEventLocked(eventToEnqueue, EVENT_TYPE_HIT_TEST, 0,
+ mPostLastWebKitXOffset, mPostLastWebKitYOffset, mPostLastWebKitScale);
+ enqueueEventLocked(d);
}
private void checkForSlopLocked(MotionEvent event) {
@@ -545,6 +554,7 @@ final class WebViewInputDispatcher {
mInitialDownX = event.getX();
mInitialDownY = event.getY();
scheduleShowTapHighlightLocked();
+ enqueueHitTestLocked(event);
} else if (action == MotionEvent.ACTION_UP) {
unscheduleLongPressLocked();
if (isClickCandidateLocked(event)) {
@@ -824,6 +834,7 @@ final class WebViewInputDispatcher {
case EVENT_TYPE_CLICK:
case EVENT_TYPE_HOVER:
case EVENT_TYPE_SCROLL:
+ case EVENT_TYPE_HIT_TEST:
return false;
case EVENT_TYPE_TOUCH:
return !mPostSendTouchEventsToWebKit