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..649fd9d1a296c82f01b622ef152075ca53c3064f 100644 |
--- a/content/browser/renderer_host/input/touch_disposition_gesture_filter.h |
+++ b/content/browser/renderer_host/input/touch_disposition_gesture_filter.h |
@@ -5,14 +5,24 @@ |
#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" |
#include "content/port/common/input_event_ack_state.h" |
#include "third_party/WebKit/public/web/WebInputEvent.h" |
+namespace { |
+ |
+enum RequiredTouches { |
jdduke (slow)
2014/02/14 16:59:52
Any reason we can't stick this in the .cc file?
tdresser
2014/02/14 17:56:11
Done.
|
+ RT_NONE = 0, |
+ RT_START = 1 << 0, |
+ RT_CURRENT = 1 << 1, |
+}; |
+ |
+} // namespace |
+ |
namespace content { |
// Interface with which the |TouchDispositionGestureFilter| forwards gestures |
@@ -56,30 +66,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 +114,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. |