Skip to content

Commit 94c478e

Browse files
committed
Don't send an ontouchmove until slop is exceeded
Bug: 6490959 Change-Id: I0f447f65c84f9ce208ce52caba05e7dcb2f76bc5
1 parent ae14715 commit 94c478e

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

core/java/android/webkit/WebViewInputDispatcher.java

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -822,21 +822,31 @@ private void dispatchUiEvent(MotionEvent event, int eventType, int flags) {
822822
}
823823

824824
private void enqueueEventLocked(DispatchEvent d) {
825-
if (!shouldSkipWebKit(d.mEventType)) {
825+
if (!shouldSkipWebKit(d)) {
826826
enqueueWebKitEventLocked(d);
827827
} else {
828828
enqueueUiEventLocked(d);
829829
}
830830
}
831831

832-
private boolean shouldSkipWebKit(int eventType) {
833-
switch (eventType) {
832+
private boolean shouldSkipWebKit(DispatchEvent d) {
833+
switch (d.mEventType) {
834834
case EVENT_TYPE_CLICK:
835835
case EVENT_TYPE_HOVER:
836836
case EVENT_TYPE_SCROLL:
837837
case EVENT_TYPE_HIT_TEST:
838838
return false;
839839
case EVENT_TYPE_TOUCH:
840+
// TODO: This should be cleaned up. We now have WebViewInputDispatcher
841+
// and WebViewClassic both checking for slop and doing their own
842+
// thing - they should be consolidated. And by consolidated, I mean
843+
// WebViewClassic's version should just be deleted.
844+
// The reason this is done is because webpages seem to expect
845+
// that they only get an ontouchmove if the slop has been exceeded.
846+
if (mIsTapCandidate && d.mEvent != null
847+
&& d.mEvent.getActionMasked() == MotionEvent.ACTION_MOVE) {
848+
return true;
849+
}
840850
return !mPostSendTouchEventsToWebKit
841851
|| mPostDoNotSendTouchEventsToWebKitUntilNextGesture;
842852
}

0 commit comments

Comments
 (0)