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..7680aed196e34e2154ed45cbafe7c3d5e030416d 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,26 @@ |
#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 <map> |
Rick Byers
2014/02/13 21:59:25
doesn't look like you're actually using map here..
tdresser
2014/02/14 13:52:42
Done.
|
#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 { |
+ RT_NONE = 0, |
+ RT_START = 1 << 0, |
+ RT_MOVE = 1 << 1, |
Rick Byers
2014/02/13 21:59:25
As discussed now in person and in the doc, I think
tdresser
2014/02/14 13:52:42
Done.
|
+ RT_CURRENT = 1 << 2, |
+}; |
+ |
+} // namespace |
+ |
namespace content { |
// Interface with which the |TouchDispositionGestureFilter| forwards gestures |
@@ -56,30 +68,42 @@ class CONTENT_EXPORT TouchDispositionGestureFilter { |
// generated by timeouts from a statinoary finger. |
class GestureSequence { |
public: |
+ struct GestureHandlingState { |
+ GestureHandlingState(); |
+ bool seen_ack; |
Rick Byers
2014/02/13 21:59:25
Since the precise definition of these bits are cri
tdresser
2014/02/14 13:52:42
Done.
|
+ bool start_consumed; |
+ bool move_consumed; |
+ 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 +113,9 @@ class CONTENT_EXPORT TouchDispositionGestureFilter { |
TouchDispositionGestureFilterClient* client_; |
std::queue<GestureSequence> sequences_; |
+ std::set<blink::WebInputEvent::Type> |
+ last_event_of_type_dropped_; |
Rick Byers
2014/02/13 21:59:25
please add a comment describing the precise semant
tdresser
2014/02/14 13:52:42
Done. I previously wasn't clearing this at the sta
|
+ |
// 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. |