Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(496)

Unified Diff: content/browser/renderer_host/input/touch_event_queue.h

Issue 586553002: Allow repeated handler removal/addition with the TouchEventQueue (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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 a45e60f272e5a72bad6f0081bd7dc86250416650..3bdab903750f69d119f6f1f077c7f2a89ce3f784 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;
@@ -181,10 +180,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_;
@@ -192,9 +189,11 @@ 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.).
+ // TODO(jdduke): Consider simply tracking whether *any* touchstart had a
+ // consumer, crbug.com/416497.
+ ui::BitSet32 touch_consumer_states_;
// Position of the first touch in the most recent sequence forwarded to the
// client.
@@ -209,18 +208,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

Powered by Google App Engine
This is Rietveld 408576698