| Index: ui/events/gesture_detection/touch_disposition_gesture_filter.h
|
| diff --git a/ui/events/gesture_detection/touch_disposition_gesture_filter.h b/ui/events/gesture_detection/touch_disposition_gesture_filter.h
|
| index 2c1ca04f6e79e030e22ebc64a79e503b01208b9e..70fe5da7117e125267c09fd82d95346a627d9ef9 100644
|
| --- a/ui/events/gesture_detection/touch_disposition_gesture_filter.h
|
| +++ b/ui/events/gesture_detection/touch_disposition_gesture_filter.h
|
| @@ -7,6 +7,7 @@
|
|
|
| #include <queue>
|
|
|
| +#include "ui/events/event_constants.h"
|
| #include "ui/events/gesture_detection/bitset_32.h"
|
| #include "ui/events/gesture_detection/gesture_detection_export.h"
|
| #include "ui/events/gesture_detection/gesture_event_data_packet.h"
|
| @@ -41,64 +42,41 @@ class GESTURE_DETECTION_EXPORT TouchDispositionGestureFilter {
|
| };
|
| PacketResult OnGesturePacket(const GestureEventDataPacket& packet);
|
|
|
| - // TODO(jdduke): Consider adoption of ui::EventResult.
|
| - enum TouchEventAck {
|
| - CONSUMED,
|
| - NOT_CONSUMED,
|
| - NO_CONSUMER_EXISTS
|
| - };
|
| // To be called upon receipt of *all* touch event acks.
|
| - void OnTouchEventAck(TouchEventAck ack_result);
|
| + void OnTouchEventAck(bool event_consumed);
|
|
|
| // Whether there are any active gesture sequences still queued in the filter.
|
| bool IsEmpty() const;
|
|
|
| private:
|
| - // Utility class for tracking gesture events and dispositions for a single
|
| - // gesture sequence. A single sequence corresponds to all gestures created
|
| + // A single GestureSequence corresponds to all gestures created
|
| // between the first finger down and the last finger up, including gestures
|
| // generated by timeouts from a statinoary finger.
|
| - class GestureSequence {
|
| + typedef std::queue<GestureEventDataPacket> GestureSequence;
|
| +
|
| + // Utility class for maintaining the touch and gesture handling state for the
|
| + // current gesture sequence.
|
| + class GestureHandlingState {
|
| public:
|
| - struct GestureHandlingState {
|
| - GestureHandlingState();
|
| - // True iff the sequence has had at least one touch acked.
|
| - bool seen_ack;
|
| - // True iff the sequence has had any touch down event consumed.
|
| - bool start_consumed;
|
| - // True iff the first ack received for this sequence reported that no
|
| - // consumer exists.
|
| - bool no_consumer;
|
| - };
|
| -
|
| - GestureSequence();
|
| - ~GestureSequence();
|
| -
|
| - void Push(const GestureEventDataPacket& packet);
|
| - void Pop();
|
| - const GestureEventDataPacket& Front() const;
|
| - void UpdateState(GestureEventDataPacket::GestureSource gesture_source,
|
| - TouchEventAck ack_state);
|
| - bool IsEmpty() const;
|
| - const GestureHandlingState& state() const { return state_; };
|
| + GestureHandlingState();
|
|
|
| - private:
|
| - std::queue<GestureEventDataPacket> packets_;
|
| - GestureHandlingState state_;
|
| - };
|
| - bool IsGesturePrevented(EventType type,
|
| - TouchEventAck current,
|
| - const GestureSequence::GestureHandlingState& state)
|
| - const;
|
| + // To be called on each touch event ack.
|
| + void OnTouchEventAck(bool event_consumed, bool is_touch_start_event);
|
|
|
| - void UpdateAndDispatchPackets(GestureSequence* sequence,
|
| - TouchEventAck ack_result);
|
| + // Returns true iff the gesture should be dropped.
|
| + bool Filter(EventType type);
|
|
|
| - void FilterAndSendPacket(
|
| - const GestureEventDataPacket& packet,
|
| - const GestureSequence::GestureHandlingState& sequence_state,
|
| - TouchEventAck ack_state);
|
| + private:
|
| + // True iff the sequence has had any touch down event consumed.
|
| + bool start_touch_consumed_;
|
| + // True iff the most recently ack'ed touch event was consumed.
|
| + bool current_touch_consumed_;
|
| + // If the previous gesture of a given type was dropped instead of being
|
| + // dispatched, its type will occur in this set.
|
| + BitSet32 last_gesture_of_type_dropped_;
|
| + };
|
|
|
| + void FilterAndSendPacket(const GestureEventDataPacket& packet);
|
| void SendGesture(const GestureEventData& gesture);
|
| void CancelTapIfNecessary();
|
| void CancelFlingIfNecessary();
|
| @@ -109,10 +87,7 @@ class GESTURE_DETECTION_EXPORT TouchDispositionGestureFilter {
|
| TouchDispositionGestureFilterClient* client_;
|
| std::queue<GestureSequence> sequences_;
|
|
|
| - // If the previous gesture of a given type was dropped instead of being
|
| - // dispatched, its type will occur in this set. Cleared when a new touch
|
| - // sequence begins to be acked.
|
| - BitSet32 last_event_of_type_dropped_;
|
| + GestureHandlingState state_;
|
|
|
| // Bookkeeping for inserting synthetic Gesture{Tap,Fling}Cancel events
|
| // when necessary, e.g., GestureTapCancel when scrolling begins, or
|
|
|