| 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 fa109dedddf9bd87868d6edbe6a7a7fc1cbe9351..7fc26cd5c2eb94ae321c7cabb9a98171a88ce956 100644
|
| --- a/content/browser/renderer_host/input/touch_event_queue.cc
|
| +++ b/content/browser/renderer_host/input/touch_event_queue.cc
|
| @@ -28,11 +28,6 @@ const double kAsyncTouchMoveIntervalSec = .2;
|
| // trigger an immediate async touchmove to cancel potential tap-related logic.
|
| const double kApplicationSlopRegionLengthDipsSqared = 15. * 15.;
|
|
|
| -// Using a small epsilon when comparing slop distances allows pixel perfect
|
| -// slop determination when using fractional DIP coordinates (assuming the slop
|
| -// region and DPI scale are reasonably proportioned).
|
| -const float kSlopEpsilon = .05f;
|
| -
|
| TouchEventWithLatencyInfo ObtainCancelEventForTouchEvent(
|
| const TouchEventWithLatencyInfo& event_to_cancel) {
|
| TouchEventWithLatencyInfo event = event_to_cancel;
|
| @@ -215,48 +210,23 @@ class TouchEventQueue::TouchTimeoutHandler {
|
| bool enabled_for_current_sequence_;
|
| };
|
|
|
| -// Provides touchmove slop suppression for a single touch that remains within
|
| -// a given slop region, unless the touchstart is preventDefault'ed.
|
| -// TODO(jdduke): Use a flag bundled with each TouchEvent declaring whether it
|
| -// has exceeded the slop region, removing duplicated slop determination logic.
|
| +// Provides touchmove slop suppression for a touch sequence until a
|
| +// (unprevented) touch will trigger immediate scrolling.
|
| class TouchEventQueue::TouchMoveSlopSuppressor {
|
| public:
|
| - TouchMoveSlopSuppressor(double slop_suppression_length_dips)
|
| - : slop_suppression_length_dips_squared_(0),
|
| - suppressing_touchmoves_(false) {
|
| - if (slop_suppression_length_dips) {
|
| - slop_suppression_length_dips += kSlopEpsilon;
|
| - slop_suppression_length_dips_squared_ =
|
| - slop_suppression_length_dips * slop_suppression_length_dips;
|
| - }
|
| - }
|
| + TouchMoveSlopSuppressor() : suppressing_touchmoves_(false) {}
|
|
|
| bool FilterEvent(const WebTouchEvent& event) {
|
| - if (WebTouchEventTraits::IsTouchSequenceStart(event)) {
|
| - touch_sequence_start_position_ =
|
| - gfx::PointF(event.touches[0].position);
|
| - suppressing_touchmoves_ = slop_suppression_length_dips_squared_ != 0;
|
| - }
|
| + if (WebTouchEventTraits::IsTouchSequenceStart(event))
|
| + suppressing_touchmoves_ = true;
|
|
|
| if (event.type == WebInputEvent::TouchEnd ||
|
| event.type == WebInputEvent::TouchCancel)
|
| suppressing_touchmoves_ = false;
|
|
|
| - if (event.type != WebInputEvent::TouchMove)
|
| - return false;
|
| + if (event.defaultActionMayCauseScrolling)
|
| + suppressing_touchmoves_ = false;
|
|
|
| - if (suppressing_touchmoves_) {
|
| - // Movement with a secondary pointer should terminate suppression.
|
| - if (event.touchesLength > 1) {
|
| - suppressing_touchmoves_ = false;
|
| - } else if (event.touchesLength == 1) {
|
| - // Movement outside of the slop region should terminate suppression.
|
| - gfx::PointF position(event.touches[0].position);
|
| - if ((position - touch_sequence_start_position_).LengthSquared() >
|
| - slop_suppression_length_dips_squared_)
|
| - suppressing_touchmoves_ = false;
|
| - }
|
| - }
|
| return suppressing_touchmoves_;
|
| }
|
|
|
| @@ -268,8 +238,6 @@ class TouchEventQueue::TouchMoveSlopSuppressor {
|
| bool suppressing_touchmoves() const { return suppressing_touchmoves_; }
|
|
|
| private:
|
| - double slop_suppression_length_dips_squared_;
|
| - gfx::PointF touch_sequence_start_position_;
|
| bool suppressing_touchmoves_;
|
|
|
| DISALLOW_COPY_AND_ASSIGN(TouchMoveSlopSuppressor);
|
| @@ -362,8 +330,7 @@ class CoalescedWebTouchEvent {
|
| };
|
|
|
| TouchEventQueue::Config::Config()
|
| - : touchmove_slop_suppression_length_dips(0),
|
| - touch_scrolling_mode(TOUCH_SCROLLING_MODE_DEFAULT),
|
| + : touch_scrolling_mode(TOUCH_SCROLLING_MODE_DEFAULT),
|
| touch_ack_timeout_delay(base::TimeDelta::FromMilliseconds(200)),
|
| touch_ack_timeout_supported(false) {
|
| }
|
| @@ -375,8 +342,7 @@ TouchEventQueue::TouchEventQueue(TouchEventQueueClient* client,
|
| dispatching_touch_(false),
|
| has_handlers_(true),
|
| drop_remaining_touches_in_sequence_(false),
|
| - touchmove_slop_suppressor_(new TouchMoveSlopSuppressor(
|
| - config.touchmove_slop_suppression_length_dips)),
|
| + touchmove_slop_suppressor_(new TouchMoveSlopSuppressor),
|
| send_touch_events_async_(false),
|
| needs_async_touchmove_for_outer_slop_region_(false),
|
| last_sent_touch_timestamp_sec_(0),
|
|
|