Commit 70a68cf8 authored by Mustaq Ahmed's avatar Mustaq Ahmed Committed by Commit Bot

Preserve tap-count when a gesture double-tap becomes a gesture-tap.

When a double-tap is dropped through a touch-action (e.g.  "none" or
"manipulation"), we replace the double-tap event with a single-tap which
is the second single-tap in the gesture sequence.  Blink dispatches
compat "click" events for both these taps.  Without a correct tap-count
(==2) in the second tap, a follow-up "dblclick" event is not dispatched,
which is wrong.  This CL fixes the problem.

Bug: 874474
Change-Id: I25f9806e5ec9f211f9f83d59e8949052a816aaf3
Reviewed-on: https://chromium-review.googlesource.com/c/1276846Reviewed-by: default avatarXida Chen <xidachen@chromium.org>
Reviewed-by: default avatarNavid Zolghadr <nzolghadr@chromium.org>
Commit-Queue: Mustaq Ahmed <mustaq@chromium.org>
Cr-Commit-Position: refs/heads/master@{#598928}
parent c01465bb
...@@ -129,14 +129,23 @@ FilterGestureEventResult TouchActionFilter::FilterGestureEvent( ...@@ -129,14 +129,23 @@ FilterGestureEventResult TouchActionFilter::FilterGestureEvent(
? FilterGestureEventResult::kFilterGestureEventFiltered ? FilterGestureEventResult::kFilterGestureEventFiltered
: FilterGestureEventResult::kFilterGestureEventAllowed; : FilterGestureEventResult::kFilterGestureEventAllowed;
// The double tap gesture is a tap ending event. If a double tap gesture is // The double tap gesture is a tap ending event. If a double-tap gesture is
// filtered out, replace it with a tap event. // filtered out, replace it with a tap event but preserve the tap-count to
// allow firing dblclick event in Blink.
//
// TODO(mustaq): This replacement of a double-tap gesture with a tap seems
// buggy, it produces an inconsistent gesture event stream: GestureTapCancel
// followed by GestureTap. See crbug.com/874474#c47 for a repro. We don't
// know of any bug resulting from it, but it's better to fix the broken
// assumption here at least to avoid introducing new bugs in future.
case WebInputEvent::kGestureDoubleTap: case WebInputEvent::kGestureDoubleTap:
gesture_sequence_in_progress_ = false; gesture_sequence_in_progress_ = false;
gesture_sequence_.append("D"); gesture_sequence_.append("D");
DCHECK_EQ(1, gesture_event->data.tap.tap_count); DCHECK_EQ(1, gesture_event->data.tap.tap_count);
if (!allow_current_double_tap_event_) if (!allow_current_double_tap_event_) {
gesture_event->SetType(WebInputEvent::kGestureTap); gesture_event->SetType(WebInputEvent::kGestureTap);
gesture_event->data.tap.tap_count = 2;
}
allow_current_double_tap_event_ = true; allow_current_double_tap_event_ = true;
break; break;
......
...@@ -828,6 +828,7 @@ TEST_F(TouchActionFilterTest, DoubleTap) { ...@@ -828,6 +828,7 @@ TEST_F(TouchActionFilterTest, DoubleTap) {
EXPECT_EQ(filter_.FilterGestureEvent(&double_tap), EXPECT_EQ(filter_.FilterGestureEvent(&double_tap),
FilterGestureEventResult::kFilterGestureEventAllowed); FilterGestureEventResult::kFilterGestureEventAllowed);
EXPECT_EQ(WebInputEvent::kGestureTap, double_tap.GetType()); EXPECT_EQ(WebInputEvent::kGestureTap, double_tap.GetType());
EXPECT_EQ(2, double_tap.data.tap.tap_count);
filter_.DecreaseActiveTouches(); filter_.DecreaseActiveTouches();
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment