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

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

Issue 171283002: Always reset touch action at the beginning of a new gesture sequence (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address rbyers' comments. Created 6 years, 10 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.cc
diff --git a/content/browser/renderer_host/input/touch_event_queue.cc b/content/browser/renderer_host/input/touch_event_queue.cc
index 9924c903a26318e2d91e177f8ded5cf83e9b1a60..3e0e9c573a8298225dfc5f56ce0c796e3049579d 100644
--- a/content/browser/renderer_host/input/touch_event_queue.cc
+++ b/content/browser/renderer_host/input/touch_event_queue.cc
@@ -32,18 +32,6 @@ TouchEventWithLatencyInfo ObtainCancelEventForTouchEvent(
return event;
}
-bool IsNewTouchSequence(const WebTouchEvent& event) {
- if (event.type != WebInputEvent::TouchStart)
- return false;
- if (!event.touchesLength)
- return false;
- for (size_t i = 0; i < event.touchesLength; i++) {
- if (event.touches[i].state != WebTouchPoint::StatePressed)
- return false;
- }
- return true;
-}
-
bool ShouldTouchTypeTriggerTimeout(WebInputEvent::Type type) {
return type == WebInputEvent::TouchStart ||
type == WebInputEvent::TouchMove;
@@ -126,7 +114,7 @@ class TouchEventQueue::TouchTimeoutHandler {
DCHECK(HasTimeoutEvent());
if (ack_result != INPUT_EVENT_ACK_STATE_NO_CONSUMER_EXISTS)
return true;
- return !IsNewTouchSequence(timeout_event_.event);
+ return !WebInputEventTraits::IsNewTouchSequence(timeout_event_.event);
}
void SetPendingAckState(PendingAckState new_pending_ack_state) {
@@ -182,7 +170,7 @@ class TouchEventQueue::TouchMoveSlopSuppressor {
suppressing_touch_moves_(false) {}
bool FilterEvent(const WebTouchEvent& event) {
- if (IsNewTouchSequence(event)) {
+ if (WebInputEventTraits::IsNewTouchSequence(event)) {
touch_sequence_start_position_ =
gfx::Point(event.touches[0].position);
suppressing_touch_moves_ = slop_suppression_length_dips_squared_ != 0;
@@ -317,7 +305,7 @@ void TouchEventQueue::QueueEvent(const TouchEventWithLatencyInfo& event) {
// yields identical results, but this avoids unnecessary allocations.
if (touch_filtering_state_ == DROP_ALL_TOUCHES ||
(touch_filtering_state_ == DROP_TOUCHES_IN_SEQUENCE &&
- !IsNewTouchSequence(event.event))) {
+ !WebInputEventTraits::IsNewTouchSequence(event.event))) {
client_->OnTouchEventAck(event, INPUT_EVENT_ACK_STATE_NO_CONSUMER_EXISTS);
return;
}
@@ -396,7 +384,7 @@ void TouchEventQueue::ForwardToRenderer(
DCHECK(!dispatching_touch_);
DCHECK_NE(touch_filtering_state_, DROP_ALL_TOUCHES);
- if (IsNewTouchSequence(touch.event)) {
+ if (WebInputEventTraits::IsNewTouchSequence(touch.event)) {
touch_filtering_state_ =
ack_timeout_enabled_ ? FORWARD_TOUCHES_UNTIL_TIMEOUT
: FORWARD_ALL_TOUCHES;
@@ -570,7 +558,7 @@ TouchEventQueue::FilterBeforeForwarding(const WebTouchEvent& event) {
if (touch_filtering_state_ == DROP_TOUCHES_IN_SEQUENCE &&
event.type != WebInputEvent::TouchCancel) {
- if (IsNewTouchSequence(event))
+ if (WebInputEventTraits::IsNewTouchSequence(event))
return FORWARD_TO_RENDERER;
return ACK_WITH_NOT_CONSUMED;
}

Powered by Google App Engine
This is Rietveld 408576698