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

Side by Side Diff: content/browser/renderer_host/input/touch_event_queue.cc

Issue 2691993005: Revert of Move touch slop suppression from LegacyTouchEventQueue to TouchEventManager (Closed)
Patch Set: Created 3 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 unified diff | Download patch
« no previous file with comments | « no previous file | content/browser/renderer_host/input/touch_event_queue_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/browser/renderer_host/input/touch_event_queue.h" 5 #include "content/browser/renderer_host/input/touch_event_queue.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/auto_reset.h" 9 #include "base/auto_reset.h"
10 #include "base/macros.h" 10 #include "base/macros.h"
(...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after
285 bool sequence_using_mobile_timeout_; 285 bool sequence_using_mobile_timeout_;
286 }; 286 };
287 287
288 // Provides touchmove slop suppression for a touch sequence until a 288 // Provides touchmove slop suppression for a touch sequence until a
289 // (unprevented) touch will trigger immediate scrolling. 289 // (unprevented) touch will trigger immediate scrolling.
290 class TouchEventQueue::TouchMoveSlopSuppressor { 290 class TouchEventQueue::TouchMoveSlopSuppressor {
291 public: 291 public:
292 TouchMoveSlopSuppressor() : suppressing_touchmoves_(false) {} 292 TouchMoveSlopSuppressor() : suppressing_touchmoves_(false) {}
293 293
294 bool FilterEvent(const WebTouchEvent& event) { 294 bool FilterEvent(const WebTouchEvent& event) {
295 suppressing_touchmoves_ = false; 295 if (WebTouchEventTraits::IsTouchSequenceStart(event)) {
296 return false; 296 suppressing_touchmoves_ = true;
297 touch_start_location_ = gfx::PointF(event.touches[0].position);
298 }
299
300 if (event.type() == WebInputEvent::TouchEnd ||
301 event.type() == WebInputEvent::TouchCancel)
302 suppressing_touchmoves_ = false;
303
304 if (event.type() != WebInputEvent::TouchMove)
305 return false;
306
307 if (suppressing_touchmoves_) {
308 if (event.touchesLength > 1) {
309 suppressing_touchmoves_ = false;
310 } else if (event.movedBeyondSlopRegion) {
311 suppressing_touchmoves_ = false;
312 } else {
313 // No sane slop region should be larger than 60 DIPs.
314 DCHECK_LT((gfx::PointF(event.touches[0].position) -
315 touch_start_location_).LengthSquared(),
316 kMaxConceivablePlatformSlopRegionLengthDipsSquared);
317 }
318 }
319
320 return suppressing_touchmoves_;
297 } 321 }
298 322
299 void ConfirmTouchEvent(InputEventAckState ack_result) { 323 void ConfirmTouchEvent(InputEventAckState ack_result) {
300 if (ack_result == INPUT_EVENT_ACK_STATE_CONSUMED) 324 if (ack_result == INPUT_EVENT_ACK_STATE_CONSUMED)
301 suppressing_touchmoves_ = false; 325 suppressing_touchmoves_ = false;
302 } 326 }
303 327
304 bool suppressing_touchmoves() const { return suppressing_touchmoves_; } 328 bool suppressing_touchmoves() const { return suppressing_touchmoves_; }
305 329
306 private: 330 private:
(...skipping 605 matching lines...) Expand 10 before | Expand all | Expand 10 after
912 if (ack_result == INPUT_EVENT_ACK_STATE_CONSUMED) 936 if (ack_result == INPUT_EVENT_ACK_STATE_CONSUMED)
913 send_touch_events_async_ = false; 937 send_touch_events_async_ = false;
914 has_handler_for_current_sequence_ |= 938 has_handler_for_current_sequence_ |=
915 ack_result != INPUT_EVENT_ACK_STATE_NO_CONSUMER_EXISTS; 939 ack_result != INPUT_EVENT_ACK_STATE_NO_CONSUMER_EXISTS;
916 } else if (WebTouchEventTraits::IsTouchSequenceEnd(event)) { 940 } else if (WebTouchEventTraits::IsTouchSequenceEnd(event)) {
917 has_handler_for_current_sequence_ = false; 941 has_handler_for_current_sequence_ = false;
918 } 942 }
919 } 943 }
920 944
921 } // namespace content 945 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | content/browser/renderer_host/input/touch_event_queue_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698