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

Unified 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 side-by-side diff with in-line comments
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 »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 f849b0ecdbd6bb6320cf9dd83dd100ad42b87bd3..5b594addabcb2a729098642010cedc4c7f277e12 100644
--- a/content/browser/renderer_host/input/touch_event_queue.cc
+++ b/content/browser/renderer_host/input/touch_event_queue.cc
@@ -292,8 +292,32 @@
TouchMoveSlopSuppressor() : suppressing_touchmoves_(false) {}
bool FilterEvent(const WebTouchEvent& event) {
- suppressing_touchmoves_ = false;
- return false;
+ if (WebTouchEventTraits::IsTouchSequenceStart(event)) {
+ suppressing_touchmoves_ = true;
+ touch_start_location_ = gfx::PointF(event.touches[0].position);
+ }
+
+ if (event.type() == WebInputEvent::TouchEnd ||
+ event.type() == WebInputEvent::TouchCancel)
+ suppressing_touchmoves_ = false;
+
+ if (event.type() != WebInputEvent::TouchMove)
+ return false;
+
+ if (suppressing_touchmoves_) {
+ if (event.touchesLength > 1) {
+ suppressing_touchmoves_ = false;
+ } else if (event.movedBeyondSlopRegion) {
+ suppressing_touchmoves_ = false;
+ } else {
+ // No sane slop region should be larger than 60 DIPs.
+ DCHECK_LT((gfx::PointF(event.touches[0].position) -
+ touch_start_location_).LengthSquared(),
+ kMaxConceivablePlatformSlopRegionLengthDipsSquared);
+ }
+ }
+
+ return suppressing_touchmoves_;
}
void ConfirmTouchEvent(InputEventAckState ack_result) {
« 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