diff options
author | jdduke <jdduke@chromium.org> | 2015-08-05 17:16:50 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-08-06 00:17:32 +0000 |
commit | 36fee7bc622102a5a616a48262d54bdbe1d30903 (patch) | |
tree | c08b9a20eb1f42d542b30b4ddeab699f068afecd /ui/events/gesture_detection | |
parent | f7f7383da10b2207dfeb6603dc855052240e9990 (diff) | |
download | chromium_src-36fee7bc622102a5a616a48262d54bdbe1d30903.zip chromium_src-36fee7bc622102a5a616a48262d54bdbe1d30903.tar.gz chromium_src-36fee7bc622102a5a616a48262d54bdbe1d30903.tar.bz2 |
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}
Diffstat (limited to 'ui/events/gesture_detection')
4 files changed, 27 insertions, 0 deletions
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<GestureConfigurationAndroid>; 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<GestureConfigurationAura>; |