diff options
author | jdduke <jdduke@chromium.org> | 2015-09-25 13:41:41 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-09-25 20:42:31 +0000 |
commit | b1c7ccf1e392ea2b3bef380148a86978f43a2967 (patch) | |
tree | 635366992b32dbee5d3b4d435402b2d247bdeea8 /ui/events/gestures | |
parent | 050ed11680ed7d2b3286cd0d4f2bdb01b38b57cc (diff) | |
download | chromium_src-b1c7ccf1e392ea2b3bef380148a86978f43a2967.zip chromium_src-b1c7ccf1e392ea2b3bef380148a86978f43a2967.tar.gz chromium_src-b1c7ccf1e392ea2b3bef380148a86978f43a2967.tar.bz2 |
[Android] Support double-tap selection
Add single tap repeat count detection to GestureDetector for cases when
double-tap detection is disabled. Refactor Aura to use this path, and
also update the TouchSelectionController to support selection handle
display when the user's double (or triple) tap gesture selects text.
BUG=234986,453476,522268
Review URL: https://codereview.chromium.org/1358263002
Cr-Commit-Position: refs/heads/master@{#350902}
Diffstat (limited to 'ui/events/gestures')
-rw-r--r-- | ui/events/gestures/gesture_provider_aura.cc | 34 | ||||
-rw-r--r-- | ui/events/gestures/gesture_provider_aura.h | 5 |
2 files changed, 0 insertions, 39 deletions
diff --git a/ui/events/gestures/gesture_provider_aura.cc b/ui/events/gestures/gesture_provider_aura.cc index b491a2f..4d9e6fc 100644 --- a/ui/events/gestures/gesture_provider_aura.cc +++ b/ui/events/gestures/gesture_provider_aura.cc @@ -49,21 +49,6 @@ void GestureProviderAura::OnGestureEvent( const GestureEventData& gesture) { GestureEventDetails details = gesture.details; details.set_oldest_touch_id(gesture.motion_event_id); - - if (gesture.type() == ET_GESTURE_TAP) { - int tap_count = 1; - if (previous_tap_ && IsConsideredDoubleTap(*previous_tap_, gesture)) - tap_count = 1 + (previous_tap_->details.tap_count() % 3); - details.set_tap_count(tap_count); - if (!previous_tap_) - previous_tap_.reset(new GestureEventData(gesture)); - else - *previous_tap_ = gesture; - previous_tap_->details = details; - } else if (gesture.type() == ET_GESTURE_TAP_CANCEL) { - previous_tap_.reset(); - } - scoped_ptr<ui::GestureEvent> event( new ui::GestureEvent(gesture.x, gesture.y, @@ -90,23 +75,4 @@ ScopedVector<GestureEvent>* GestureProviderAura::GetAndResetPendingGestures() { return old_pending_gestures; } -bool GestureProviderAura::IsConsideredDoubleTap( - const GestureEventData& previous_tap, - const GestureEventData& current_tap) const { - if (current_tap.time - previous_tap.time > - base::TimeDelta::FromMilliseconds( - GestureConfiguration::GetInstance() - ->max_time_between_double_click_in_ms())) { - return false; - } - - float double_tap_slop_square = - GestureConfiguration::GetInstance() - ->max_distance_between_taps_for_double_tap(); - double_tap_slop_square *= double_tap_slop_square; - const float delta_x = previous_tap.x - current_tap.x; - const float delta_y = previous_tap.y - current_tap.y; - return (delta_x * delta_x + delta_y * delta_y < double_tap_slop_square); -} - } // namespace content diff --git a/ui/events/gestures/gesture_provider_aura.h b/ui/events/gestures/gesture_provider_aura.h index 236a5ac..c188905 100644 --- a/ui/events/gestures/gesture_provider_aura.h +++ b/ui/events/gestures/gesture_provider_aura.h @@ -38,11 +38,6 @@ class EVENTS_EXPORT GestureProviderAura : public GestureProviderClient { void OnGestureEvent(const GestureEventData& gesture) override; private: - bool IsConsideredDoubleTap(const GestureEventData& previous_tap, - const GestureEventData& current_tap) const; - - scoped_ptr<GestureEventData> previous_tap_; - GestureProviderAuraClient* client_; MotionEventAura pointer_state_; FilteredGestureProvider filtered_gesture_provider_; |