| Index: content/browser/renderer_host/input/touch_disposition_gesture_filter.h
|
| diff --git a/content/browser/renderer_host/input/touch_disposition_gesture_filter.h b/content/browser/renderer_host/input/touch_disposition_gesture_filter.h
|
| index f2acc3b47c1b1ab6001cd16fa4f1315264baa3a3..3872b47d9daf759f79c4d2ff8eaab94305cbf39d 100644
|
| --- a/content/browser/renderer_host/input/touch_disposition_gesture_filter.h
|
| +++ b/content/browser/renderer_host/input/touch_disposition_gesture_filter.h
|
| @@ -5,8 +5,8 @@
|
| #ifndef CONTENT_BROWSER_RENDERER_HOST_INPUT_TOUCH_DISPOSITION_GESTURE_FILTER_H_
|
| #define CONTENT_BROWSER_RENDERER_HOST_INPUT_TOUCH_DISPOSITION_GESTURE_FILTER_H_
|
|
|
| -#include <deque>
|
| #include <queue>
|
| +#include <set>
|
|
|
| #include "content/browser/renderer_host/input/gesture_event_packet.h"
|
| #include "content/common/content_export.h"
|
| @@ -56,30 +56,45 @@ class CONTENT_EXPORT TouchDispositionGestureFilter {
|
| // generated by timeouts from a statinoary finger.
|
| class GestureSequence {
|
| 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 GestureEventPacket& packet);
|
| void Pop();
|
| const GestureEventPacket& Front() const;
|
| - void UpdateState(InputEventAckState ack_state);
|
| - bool IsGesturePrevented() const;
|
| + void UpdateState(GestureEventPacket::GestureSource gesture_source,
|
| + InputEventAckState ack_state);
|
| bool IsEmpty() const;
|
| + const GestureHandlingState& state() const { return state_; };
|
|
|
| private:
|
| std::queue<GestureEventPacket> packets_;
|
| - enum GestureHandlingState {
|
| - PENDING, // The sequence has yet to receive an ack.
|
| - ALLOWED_UNTIL_PREVENTED, // Gestures in the sequence are allowed until
|
| - // a source touch is preventDefault'ed.
|
| - ALWAYS_ALLOWED, // All remaining sequence gestures are forwarded.
|
| - ALWAYS_PREVENTED // All remaining sequence gestures are dropped.
|
| - };
|
| GestureHandlingState state_;
|
| };
|
| + bool IsGesturePrevented(blink::WebInputEvent::Type type,
|
| + InputEventAckState current,
|
| + const GestureSequence::GestureHandlingState& state)
|
| + const;
|
| +
|
| void UpdateAndDispatchPackets(GestureSequence* sequence,
|
| InputEventAckState ack_result);
|
| - void SendPacket(const GestureEventPacket& packet);
|
| +
|
| + void FilterAndSendPacket(
|
| + const GestureEventPacket& packet,
|
| + const GestureSequence::GestureHandlingState& sequence_state,
|
| + InputEventAckState ack_state);
|
| +
|
| void SendGesture(const blink::WebGestureEvent& gesture);
|
| void CancelTapIfNecessary();
|
| void CancelFlingIfNecessary();
|
| @@ -89,6 +104,11 @@ class CONTENT_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.
|
| + std::set<blink::WebInputEvent::Type> last_event_of_type_dropped_;
|
| +
|
| // Bookkeeping for inserting synthetic Gesture{Tap,Fling}Cancel events
|
| // when necessary, e.g., GestureTapCancel when scrolling begins, or
|
| // GestureFlingCancel when a user taps following a GestureFlingStart.
|
|
|