| Index: ui/events/gesture_detection/touch_disposition_gesture_filter.cc
|
| diff --git a/ui/events/gesture_detection/touch_disposition_gesture_filter.cc b/ui/events/gesture_detection/touch_disposition_gesture_filter.cc
|
| index 323c7aafd04d98327c58b1fb4d63d5112a9163bb..33c8d4322f4ef12edeeb75a2f3f6715b0c6c3a21 100644
|
| --- a/ui/events/gesture_detection/touch_disposition_gesture_filter.cc
|
| +++ b/ui/events/gesture_detection/touch_disposition_gesture_filter.cc
|
| @@ -219,7 +219,7 @@ void TouchDispositionGestureFilter::FilterAndSendPacket(
|
| } else if (packet.gesture_source() == GestureEventDataPacket::TOUCH_START) {
|
| CancelTapIfNecessary(packet);
|
| }
|
| -
|
| + int gesture_end_index = -1;
|
| for (size_t i = 0; i < packet.gesture_count(); ++i) {
|
| const GestureEventData& gesture = packet.gesture(i);
|
| DCHECK_GE(gesture.details.type(), ET_GESTURE_TYPE_START);
|
| @@ -232,9 +232,20 @@ void TouchDispositionGestureFilter::FilterAndSendPacket(
|
| // Sending a timed gesture could delete |this|, so we need to return
|
| // directly after the |SendGesture| call.
|
| SendGesture(gesture, packet);
|
| + // We should not have a timeout gesture and other gestures in the same
|
| + // packet.
|
| + DCHECK_EQ(1U, packet.gesture_count());
|
| return;
|
| }
|
| -
|
| + // Occasionally scroll or tap cancel events are synthesized when a touch
|
| + // sequence has been canceled or terminated, we want to make sure that
|
| + // ET_GESTURE_END always happens after them.
|
| + if (gesture.type() == ET_GESTURE_END) {
|
| + // Make sure there is at most one ET_GESTURE_END event in each packet.
|
| + DCHECK_EQ(-1, gesture_end_index);
|
| + gesture_end_index = static_cast<int>(i);
|
| + continue;
|
| + }
|
| SendGesture(gesture, packet);
|
| }
|
|
|
| @@ -246,6 +257,9 @@ void TouchDispositionGestureFilter::FilterAndSendPacket(
|
| GestureEventDataPacket::TOUCH_SEQUENCE_END) {
|
| EndScrollIfNecessary(packet);
|
| }
|
| + // Always send the ET_GESTURE_END event as the last one for every touch event.
|
| + if (gesture_end_index >= 0)
|
| + SendGesture(packet.gesture(gesture_end_index), packet);
|
| }
|
|
|
| void TouchDispositionGestureFilter::SendGesture(
|
|
|