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

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

Issue 458363002: Remove old Aura Gesture Detection Pipeline. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address sadrul's comment, and rebase. Created 6 years, 4 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 | Annotate | Revision Log
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 "base/auto_reset.h" 7 #include "base/auto_reset.h"
8 #include "base/debug/trace_event.h" 8 #include "base/debug/trace_event.h"
9 #include "base/stl_util.h" 9 #include "base/stl_util.h"
10 #include "content/browser/renderer_host/input/timeout_monitor.h" 10 #include "content/browser/renderer_host/input/timeout_monitor.h"
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
185 // Provides timeout-based callback behavior. 185 // Provides timeout-based callback behavior.
186 TimeoutMonitor timeout_monitor_; 186 TimeoutMonitor timeout_monitor_;
187 }; 187 };
188 188
189 // Provides touchmove slop suppression for a single touch that remains within 189 // Provides touchmove slop suppression for a single touch that remains within
190 // a given slop region, unless the touchstart is preventDefault'ed. 190 // a given slop region, unless the touchstart is preventDefault'ed.
191 // TODO(jdduke): Use a flag bundled with each TouchEvent declaring whether it 191 // TODO(jdduke): Use a flag bundled with each TouchEvent declaring whether it
192 // has exceeded the slop region, removing duplicated slop determination logic. 192 // has exceeded the slop region, removing duplicated slop determination logic.
193 class TouchEventQueue::TouchMoveSlopSuppressor { 193 class TouchEventQueue::TouchMoveSlopSuppressor {
194 public: 194 public:
195 TouchMoveSlopSuppressor(double slop_suppression_length_dips, 195 TouchMoveSlopSuppressor(double slop_suppression_length_dips)
196 double slop_suppression_region_includes_boundary)
197 : slop_suppression_length_dips_squared_(0), 196 : slop_suppression_length_dips_squared_(0),
198 suppressing_touchmoves_(false) { 197 suppressing_touchmoves_(false) {
199 if (slop_suppression_length_dips) { 198 if (slop_suppression_length_dips) {
200 slop_suppression_length_dips += slop_suppression_region_includes_boundary 199 slop_suppression_length_dips += kSlopEpsilon;
201 ? kSlopEpsilon
202 : -kSlopEpsilon;
203 slop_suppression_length_dips_squared_ = 200 slop_suppression_length_dips_squared_ =
204 slop_suppression_length_dips * slop_suppression_length_dips; 201 slop_suppression_length_dips * slop_suppression_length_dips;
205 } 202 }
206 } 203 }
207 204
208 bool FilterEvent(const WebTouchEvent& event) { 205 bool FilterEvent(const WebTouchEvent& event) {
209 if (WebTouchEventTraits::IsTouchSequenceStart(event)) { 206 if (WebTouchEventTraits::IsTouchSequenceStart(event)) {
210 touch_sequence_start_position_ = 207 touch_sequence_start_position_ =
211 gfx::PointF(event.touches[0].position); 208 gfx::PointF(event.touches[0].position);
212 suppressing_touchmoves_ = slop_suppression_length_dips_squared_ != 0; 209 suppressing_touchmoves_ = slop_suppression_length_dips_squared_ != 0;
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
329 // This is the list of the original events that were coalesced, each requiring 326 // This is the list of the original events that were coalesced, each requiring
330 // future ack dispatch to the client. 327 // future ack dispatch to the client.
331 typedef std::vector<TouchEventWithLatencyInfo> WebTouchEventWithLatencyList; 328 typedef std::vector<TouchEventWithLatencyInfo> WebTouchEventWithLatencyList;
332 WebTouchEventWithLatencyList events_to_ack_; 329 WebTouchEventWithLatencyList events_to_ack_;
333 330
334 DISALLOW_COPY_AND_ASSIGN(CoalescedWebTouchEvent); 331 DISALLOW_COPY_AND_ASSIGN(CoalescedWebTouchEvent);
335 }; 332 };
336 333
337 TouchEventQueue::Config::Config() 334 TouchEventQueue::Config::Config()
338 : touchmove_slop_suppression_length_dips(0), 335 : touchmove_slop_suppression_length_dips(0),
339 touchmove_slop_suppression_region_includes_boundary(true),
340 touch_scrolling_mode(TOUCH_SCROLLING_MODE_DEFAULT), 336 touch_scrolling_mode(TOUCH_SCROLLING_MODE_DEFAULT),
341 touch_ack_timeout_delay(base::TimeDelta::FromMilliseconds(200)), 337 touch_ack_timeout_delay(base::TimeDelta::FromMilliseconds(200)),
342 touch_ack_timeout_supported(false) { 338 touch_ack_timeout_supported(false) {
343 } 339 }
344 340
345 TouchEventQueue::TouchEventQueue(TouchEventQueueClient* client, 341 TouchEventQueue::TouchEventQueue(TouchEventQueueClient* client,
346 const Config& config) 342 const Config& config)
347 : client_(client), 343 : client_(client),
348 dispatching_touch_ack_(NULL), 344 dispatching_touch_ack_(NULL),
349 dispatching_touch_(false), 345 dispatching_touch_(false),
350 touch_filtering_state_(TOUCH_FILTERING_STATE_DEFAULT), 346 touch_filtering_state_(TOUCH_FILTERING_STATE_DEFAULT),
351 ack_timeout_enabled_(config.touch_ack_timeout_supported), 347 ack_timeout_enabled_(config.touch_ack_timeout_supported),
352 touchmove_slop_suppressor_(new TouchMoveSlopSuppressor( 348 touchmove_slop_suppressor_(new TouchMoveSlopSuppressor(
353 config.touchmove_slop_suppression_length_dips, 349 config.touchmove_slop_suppression_length_dips)),
354 config.touchmove_slop_suppression_region_includes_boundary)),
355 send_touch_events_async_(false), 350 send_touch_events_async_(false),
356 needs_async_touchmove_for_outer_slop_region_(false), 351 needs_async_touchmove_for_outer_slop_region_(false),
357 last_sent_touch_timestamp_sec_(0), 352 last_sent_touch_timestamp_sec_(0),
358 touch_scrolling_mode_(config.touch_scrolling_mode) { 353 touch_scrolling_mode_(config.touch_scrolling_mode) {
359 DCHECK(client); 354 DCHECK(client);
360 if (ack_timeout_enabled_) { 355 if (ack_timeout_enabled_) {
361 timeout_handler_.reset( 356 timeout_handler_.reset(
362 new TouchTimeoutHandler(this, config.touch_ack_timeout_delay)); 357 new TouchTimeoutHandler(this, config.touch_ack_timeout_delay));
363 } 358 }
364 } 359 }
(...skipping 460 matching lines...) Expand 10 before | Expand all | Expand 10 after
825 iter != end; 820 iter != end;
826 ++iter) { 821 ++iter) {
827 if (iter->second != ack_state) 822 if (iter->second != ack_state)
828 return false; 823 return false;
829 } 824 }
830 825
831 return true; 826 return true;
832 } 827 }
833 828
834 } // namespace content 829 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698