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

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: Fix test name. 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 03fac0abd3dda6b61eb0233a69a2171810fe8802..1990b96b1b0579b55a47943948965bf8c781a31d 100644
--- a/content/browser/renderer_host/input/touch_event_queue.cc
+++ b/content/browser/renderer_host/input/touch_event_queue.cc
@@ -9,7 +9,7 @@
#include "base/debug/trace_event.h"
#include "base/stl_util.h"
#include "content/browser/renderer_host/input/timeout_monitor.h"
-#include "content/common/input/web_input_event_traits.h"
+#include "content/browser/renderer_host/input/web_touch_event_traits.h"
#include "content/public/common/content_switches.h"
#include "ui/gfx/geometry/point_f.h"
@@ -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 !WebTouchEventTraits::IsTouchSequenceStart(timeout_event_.event);
}
void SetPendingAckState(PendingAckState new_pending_ack_state) {
@@ -184,7 +172,7 @@ class TouchEventQueue::TouchMoveSlopSuppressor {
suppressing_touch_moves_(false) {}
bool FilterEvent(const WebTouchEvent& event) {
- if (IsNewTouchSequence(event)) {
+ if (WebTouchEventTraits::IsTouchSequenceStart(event)) {
touch_sequence_start_position_ =
gfx::Point(event.touches[0].position);
suppressing_touch_moves_ = slop_suppression_length_dips_squared_ != 0;
@@ -321,7 +309,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))) {
+ !WebTouchEventTraits::IsTouchSequenceStart(event.event))) {
client_->OnTouchEventAck(event, INPUT_EVENT_ACK_STATE_NO_CONSUMER_EXISTS);
return;
}
@@ -400,7 +388,7 @@ void TouchEventQueue::ForwardToRenderer(
DCHECK(!dispatching_touch_);
DCHECK_NE(touch_filtering_state_, DROP_ALL_TOUCHES);
- if (IsNewTouchSequence(touch.event)) {
+ if (WebTouchEventTraits::IsTouchSequenceStart(touch.event)) {
touch_filtering_state_ =
ack_timeout_enabled_ ? FORWARD_TOUCHES_UNTIL_TIMEOUT
: FORWARD_ALL_TOUCHES;
@@ -574,7 +562,7 @@ TouchEventQueue::FilterBeforeForwarding(const WebTouchEvent& event) {
if (touch_filtering_state_ == DROP_TOUCHES_IN_SEQUENCE &&
event.type != WebInputEvent::TouchCancel) {
- if (IsNewTouchSequence(event))
+ if (WebTouchEventTraits::IsTouchSequenceStart(event))
return FORWARD_TO_RENDERER;
return ACK_WITH_NOT_CONSUMED;
}

Powered by Google App Engine
This is Rietveld 408576698