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

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

Issue 273933002: Allow exclusive touchmove slop regions in the TouchEventQueue (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix tests Created 6 years, 7 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 187728134120ad9edc378fe6fb60347a9a123535..d97a4db8b59f684e62cc4abab9a153535b97fc5a 100644
--- a/content/browser/renderer_host/input/touch_event_queue.cc
+++ b/content/browser/renderer_host/input/touch_event_queue.cc
@@ -204,6 +204,10 @@ class TouchEventQueue::TouchMoveSlopSuppressor {
suppressing_touchmoves_ = slop_suppression_length_dips_squared_ != 0;
}
+ if (event.type == WebInputEvent::TouchEnd ||
+ event.type == WebInputEvent::TouchCancel)
+ suppressing_touchmoves_ = false;
+
if (event.type != WebInputEvent::TouchMove)
return false;
@@ -227,6 +231,8 @@ class TouchEventQueue::TouchMoveSlopSuppressor {
suppressing_touchmoves_ = false;
}
+ bool suppressing_touchmoves() const { return suppressing_touchmoves_; }
+
private:
double slop_suppression_length_dips_squared_;
gfx::PointF touch_sequence_start_position_;
@@ -322,6 +328,7 @@ class CoalescedWebTouchEvent {
TouchEventQueue::Config::Config()
: touchmove_slop_suppression_length_dips(0),
+ touchmove_slop_suppression_region_includes_boundary(true),
touch_scrolling_mode(TOUCH_SCROLLING_MODE_DEFAULT),
touch_ack_timeout_delay(base::TimeDelta::FromMilliseconds(200)),
touch_ack_timeout_supported(false) {
@@ -335,7 +342,10 @@ TouchEventQueue::TouchEventQueue(TouchEventQueueClient* client,
touch_filtering_state_(TOUCH_FILTERING_STATE_DEFAULT),
ack_timeout_enabled_(config.touch_ack_timeout_supported),
touchmove_slop_suppressor_(new TouchMoveSlopSuppressor(
- config.touchmove_slop_suppression_length_dips + kSlopEpsilon)),
+ config.touchmove_slop_suppression_length_dips +
+ (config.touchmove_slop_suppression_region_includes_boundary
+ ? kSlopEpsilon
+ : -kSlopEpsilon))),
send_touch_events_async_(false),
needs_async_touchmove_for_outer_slop_region_(false),
last_sent_touch_timestamp_sec_(0),
@@ -527,6 +537,12 @@ void TouchEventQueue::OnGestureScrollEvent(
if (gesture_event.event.type != blink::WebInputEvent::GestureScrollBegin)
return;
+ if (touch_filtering_state_ != DROP_ALL_TOUCHES &&
+ touch_filtering_state_ != DROP_TOUCHES_IN_SEQUENCE) {
+ DCHECK(!touchmove_slop_suppressor_->suppressing_touchmoves())
+ << "The renderer should be offered a touchmove before scrolling begins";
+ }
+
if (touch_scrolling_mode_ == TOUCH_SCROLLING_MODE_ASYNC_TOUCHMOVE) {
if (touch_filtering_state_ != DROP_ALL_TOUCHES &&
touch_filtering_state_ != DROP_TOUCHES_IN_SEQUENCE) {

Powered by Google App Engine
This is Rietveld 408576698