Index: content/browser/renderer_host/input/touch_event_queue.h |
diff --git a/content/browser/renderer_host/input/touch_event_queue.h b/content/browser/renderer_host/input/touch_event_queue.h |
index 0e240730566dfabcdc401deaf70e72aaf7d66fb5..226c03665ac19cc86bd0c87baaee396c1c5c4919 100644 |
--- a/content/browser/renderer_host/input/touch_event_queue.h |
+++ b/content/browser/renderer_host/input/touch_event_queue.h |
@@ -14,6 +14,7 @@ |
#include "content/common/content_export.h" |
#include "content/common/input/input_event_ack_state.h" |
#include "third_party/WebKit/public/web/WebInputEvent.h" |
+#include "ui/events/gesture_detection/bitset_32.h" |
#include "ui/gfx/geometry/point_f.h" |
namespace content { |
@@ -114,6 +115,10 @@ class CONTENT_EXPORT TouchEventQueue { |
// it will take effect only for the following touch sequence. |
void SetAckTimeoutEnabled(bool enabled); |
+ bool IsAckTimeoutEnabled() const; |
+ |
+ bool IsForwardingTouches(); |
+ |
bool empty() const WARN_UNUSED_RESULT { |
return touch_queue_.empty(); |
} |
@@ -122,13 +127,7 @@ class CONTENT_EXPORT TouchEventQueue { |
return touch_queue_.size(); |
} |
- bool ack_timeout_enabled() const { |
- return ack_timeout_enabled_; |
- } |
- |
- bool has_handlers() const { |
- return touch_filtering_state_ != DROP_ALL_TOUCHES; |
- } |
+ bool has_handlers() const { return has_handlers_; } |
private: |
class TouchTimeoutHandler; |
@@ -179,10 +178,8 @@ class CONTENT_EXPORT TouchEventQueue { |
// has no touch handler. |
PreFilterResult FilterBeforeForwarding(const blink::WebTouchEvent& event); |
void ForwardToRenderer(const TouchEventWithLatencyInfo& event); |
- void UpdateTouchAckStates(const blink::WebTouchEvent& event, |
- InputEventAckState ack_result); |
- bool AllTouchAckStatesHaveState(InputEventAckState ack_state) const; |
- |
+ void UpdateTouchConsumerStates(const blink::WebTouchEvent& event, |
+ InputEventAckState ack_result); |
// Handles touch event forwarding and ack'ed event dispatch. |
TouchEventQueueClient* client_; |
@@ -190,9 +187,9 @@ class CONTENT_EXPORT TouchEventQueue { |
typedef std::deque<CoalescedWebTouchEvent*> TouchQueue; |
TouchQueue touch_queue_; |
- // Maintain the ACK status for each touch point. |
- typedef std::map<int, InputEventAckState> TouchPointAckStates; |
- TouchPointAckStates touch_ack_states_; |
+ // Maps whether each active pointer has a consumer (i.e., a touch point has a |
+ // valid consumer iff |touch_consumer_states[pointer.id]| is true.). |
+ ui::BitSet32 touch_consumer_states_; |
Rick Byers
2014/09/19 17:54:07
I wonder if we could simplify this further by keep
jdduke (slow)
2014/09/22 16:30:14
Hmm, interesting, that is a tempting simplificatio
|
// Position of the first touch in the most recent sequence forwarded to the |
// client. |
@@ -207,18 +204,18 @@ class CONTENT_EXPORT TouchEventQueue { |
// ack after forwarding a touch event to the client. |
bool dispatching_touch_; |
- enum TouchFilteringState { |
- FORWARD_ALL_TOUCHES, // Don't filter at all - the default. |
- FORWARD_TOUCHES_UNTIL_TIMEOUT, // Don't filter unless we get an ACK timeout. |
- DROP_TOUCHES_IN_SEQUENCE, // Filter all events until a new touch |
- // sequence is received. |
- DROP_ALL_TOUCHES, // Filter all events, e.g., no touch handler. |
- TOUCH_FILTERING_STATE_DEFAULT = FORWARD_ALL_TOUCHES, |
- }; |
- TouchFilteringState touch_filtering_state_; |
+ // Whether the renderer has at least one touch handler. |
+ bool has_handlers_; |
+ |
+ // Whether to allow any remaining touches for the current sequence. Note that |
+ // this is a stricter condition than an empty |touch_consumer_states|, as it |
+ // also prevents forwarding of touchstart events for new pointers in the |
+ // current sequence. This is only used when the event is synthetically |
+ // cancelled after a touch timeout, or after a scroll event when the |
+ // mode is TOUCH_SCROLLING_MODE_TOUCHCANCEL. |
+ bool drop_remaining_touches_in_sequence_; |
// Optional handler for timed-out touch event acks. |
- bool ack_timeout_enabled_; |
scoped_ptr<TouchTimeoutHandler> timeout_handler_; |
// Suppression of TouchMove's within a slop region when a sequence has not yet |