From 36fee7bc622102a5a616a48262d54bdbe1d30903 Mon Sep 17 00:00:00 2001 From: jdduke Date: Wed, 5 Aug 2015 17:16:50 -0700 Subject: Disable tap suppression logic for WebView WebView embedders can suppress fling animation updates, potentially confusing the tap suppression controller. As the feature isn't critical, simply disable it for WebView. Also refactor the input router settings helper to use ui::GestureConfiguration directly for configuring tap suppression. This makes it simpler for different platforms to customize behavior. BUG=514783 Review URL: https://codereview.chromium.org/1267693004 Cr-Commit-Position: refs/heads/master@{#342019} --- ui/events/gesture_detection/gesture_configuration.cc | 2 ++ ui/events/gesture_detection/gesture_configuration.h | 17 +++++++++++++++++ .../gesture_detection/gesture_configuration_android.cc | 6 ++++++ .../gesture_detection/gesture_configuration_aura.cc | 2 ++ 4 files changed, 27 insertions(+) (limited to 'ui/events/gesture_detection') diff --git a/ui/events/gesture_detection/gesture_configuration.cc b/ui/events/gesture_detection/gesture_configuration.cc index 3e5ae29..c3d3d2f 100644 --- a/ui/events/gesture_detection/gesture_configuration.cc +++ b/ui/events/gesture_detection/gesture_configuration.cc @@ -28,6 +28,8 @@ GestureConfiguration::GestureConfiguration() : default_radius_(25), double_tap_enabled_(false), double_tap_timeout_in_ms_(400), + fling_touchpad_tap_suppression_enabled_(false), + fling_touchscreen_tap_suppression_enabled_(false), fling_max_cancel_to_down_time_in_ms_(400), fling_max_tap_gap_time_in_ms_(200), gesture_begin_end_types_enabled_(false), diff --git a/ui/events/gesture_detection/gesture_configuration.h b/ui/events/gesture_detection/gesture_configuration.h index 78234a0..6d100c8 100644 --- a/ui/events/gesture_detection/gesture_configuration.h +++ b/ui/events/gesture_detection/gesture_configuration.h @@ -28,6 +28,18 @@ class GESTURE_DETECTION_EXPORT GestureConfiguration { bool double_tap_enabled() const { return double_tap_enabled_; } void set_double_tap_enabled(bool enabled) { double_tap_enabled_ = enabled; } int double_tap_timeout_in_ms() const { return double_tap_timeout_in_ms_; } + bool fling_touchpad_tap_suppression_enabled() const { + return fling_touchpad_tap_suppression_enabled_; + } + void set_fling_touchpad_tap_suppression_enabled(bool enabled) { + fling_touchpad_tap_suppression_enabled_ = enabled; + } + bool fling_touchscreen_tap_suppression_enabled() const { + return fling_touchscreen_tap_suppression_enabled_; + } + void set_fling_touchscreen_tap_suppression_enabled(bool enabled) { + fling_touchscreen_tap_suppression_enabled_ = enabled; + } int fling_max_cancel_to_down_time_in_ms() const { return fling_max_cancel_to_down_time_in_ms_; } @@ -196,6 +208,11 @@ class GESTURE_DETECTION_EXPORT GestureConfiguration { bool double_tap_enabled_; int double_tap_timeout_in_ms_; + // Whether to suppress touchscreen/touchpad taps that occur during a fling ( + // in particular, when such taps cancel the active fling). + bool fling_touchpad_tap_suppression_enabled_; + bool fling_touchscreen_tap_suppression_enabled_; + // Maximum time between a GestureFlingCancel and a mousedown such that the // mousedown is considered associated with the cancel event. int fling_max_cancel_to_down_time_in_ms_; diff --git a/ui/events/gesture_detection/gesture_configuration_android.cc b/ui/events/gesture_detection/gesture_configuration_android.cc index 4922559..4a81915 100644 --- a/ui/events/gesture_detection/gesture_configuration_android.cc +++ b/ui/events/gesture_detection/gesture_configuration_android.cc @@ -52,6 +52,12 @@ class GestureConfigurationAndroid : public GestureConfiguration { ViewConfiguration::GetMinScalingTouchMajorInDips()); set_show_press_delay_in_ms(ViewConfiguration::GetTapTimeoutInMs()); set_span_slop(ViewConfiguration::GetTouchSlopInDips() * 2.f); + set_fling_touchscreen_tap_suppression_enabled(true); + set_fling_touchpad_tap_suppression_enabled(false); + set_fling_max_cancel_to_down_time_in_ms( + ViewConfiguration::GetTapTimeoutInMs()); + set_fling_max_tap_gap_time_in_ms( + ViewConfiguration::GetLongPressTimeoutInMs()); } friend struct DefaultSingletonTraits; diff --git a/ui/events/gesture_detection/gesture_configuration_aura.cc b/ui/events/gesture_detection/gesture_configuration_aura.cc index df4bcf4..d7e47c1 100644 --- a/ui/events/gesture_detection/gesture_configuration_aura.cc +++ b/ui/events/gesture_detection/gesture_configuration_aura.cc @@ -36,6 +36,8 @@ class GestureConfigurationAura : public GestureConfiguration { set_span_slop(max_touch_move_in_pixels_for_click() * 2); set_swipe_enabled(true); set_two_finger_tap_enabled(true); + set_fling_touchpad_tap_suppression_enabled(true); + set_fling_touchscreen_tap_suppression_enabled(true); } friend struct DefaultSingletonTraits; -- cgit v1.1