summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--android_webview/android_webview.gyp1
-rw-r--r--android_webview/lib/DEPS1
-rw-r--r--android_webview/lib/main/aw_main_delegate.cc7
-rw-r--r--content/browser/renderer_host/input/input_router_config_helper.cc94
-rw-r--r--ui/events/gesture_detection/gesture_configuration.cc2
-rw-r--r--ui/events/gesture_detection/gesture_configuration.h17
-rw-r--r--ui/events/gesture_detection/gesture_configuration_android.cc6
-rw-r--r--ui/events/gesture_detection/gesture_configuration_aura.cc2
8 files changed, 66 insertions, 64 deletions
diff --git a/android_webview/android_webview.gyp b/android_webview/android_webview.gyp
index 981e43c..7d3034c 100644
--- a/android_webview/android_webview.gyp
+++ b/android_webview/android_webview.gyp
@@ -201,6 +201,7 @@
'../printing/printing.gyp:printing',
'../skia/skia.gyp:skia',
'../third_party/WebKit/public/blink.gyp:blink',
+ '../ui/events/events.gyp:gesture_detection',
'../ui/gl/gl.gyp:gl',
'../ui/shell_dialogs/shell_dialogs.gyp:shell_dialogs',
'../v8/tools/gyp/v8.gyp:v8',
diff --git a/android_webview/lib/DEPS b/android_webview/lib/DEPS
index 17b7ba6..e46fa53 100644
--- a/android_webview/lib/DEPS
+++ b/android_webview/lib/DEPS
@@ -4,5 +4,6 @@ include_rules = [
"+content/public",
"+gin/public",
"+media/base/media_switches.h", # For media command line switches.
+ "+ui/events/gesture_detection",
"+ui/gl",
]
diff --git a/android_webview/lib/main/aw_main_delegate.cc b/android_webview/lib/main/aw_main_delegate.cc
index 3558a04..232bd96 100644
--- a/android_webview/lib/main/aw_main_delegate.cc
+++ b/android_webview/lib/main/aw_main_delegate.cc
@@ -36,6 +36,7 @@
#include "gpu/command_buffer/client/gl_in_process_context.h"
#include "gpu/command_buffer/service/gpu_switches.h"
#include "media/base/media_switches.h"
+#include "ui/events/gesture_detection/gesture_configuration.h"
namespace android_webview {
@@ -61,6 +62,12 @@ bool AwMainDelegate::BasicStartupComplete(int* exit_code) {
BrowserViewRenderer::CalculateTileMemoryPolicy();
+ // WebView apps can override WebView#computeScroll to achieve custom
+ // scroll/fling. As a result, fling animations may not be ticked, potentially
+ // confusing the tap suppression controller. Simply disable it for WebView.
+ ui::GestureConfiguration::GetInstance()
+ ->set_fling_touchscreen_tap_suppression_enabled(false);
+
base::CommandLine* cl = base::CommandLine::ForCurrentProcess();
cl->AppendSwitch(switches::kUseIpcCommandBuffer);
cl->AppendSwitch(cc::switches::kEnableBeginFrameScheduling);
diff --git a/content/browser/renderer_host/input/input_router_config_helper.cc b/content/browser/renderer_host/input/input_router_config_helper.cc
index d3b2296..24a4354a 100644
--- a/content/browser/renderer_host/input/input_router_config_helper.cc
+++ b/content/browser/renderer_host/input/input_router_config_helper.cc
@@ -6,21 +6,36 @@
#include "base/command_line.h"
#include "content/public/common/content_switches.h"
-#include "ui/events/gesture_detection/gesture_detector.h"
-
-#if defined(USE_AURA)
#include "ui/events/gesture_detection/gesture_configuration.h"
-#elif defined(OS_ANDROID)
-#include "ui/gfx/android/view_configuration.h"
-#include "ui/gfx/screen.h"
-#endif
+#include "ui/events/gesture_detection/gesture_detector.h"
namespace content {
namespace {
-#if defined(USE_AURA)
-// TODO(jdduke): Consolidate router configuration paths using
-// ui::GestureConfiguration.
+// Default time allowance for the touch ack delay before the touch sequence is
+// cancelled, depending on whether the site has a mobile-friendly viewport.
+// Note that these constants are effective only when the timeout is supported.
+const int kDesktopTouchAckTimeoutDelayMs = 200;
+const int kMobileTouchAckTimeoutDelayMs = 1000;
+
+TouchEventQueue::Config GetTouchEventQueueConfig() {
+ TouchEventQueue::Config config;
+
+ config.desktop_touch_ack_timeout_delay =
+ base::TimeDelta::FromMilliseconds(kDesktopTouchAckTimeoutDelayMs);
+ config.mobile_touch_ack_timeout_delay =
+ base::TimeDelta::FromMilliseconds(kMobileTouchAckTimeoutDelayMs);
+
+#if defined(OS_ANDROID)
+ // For historical reasons only Android enables the touch ack timeout.
+ config.touch_ack_timeout_supported = true;
+#else
+ config.touch_ack_timeout_supported = false;
+#endif
+
+ return config;
+}
+
GestureEventQueue::Config GetGestureEventQueueConfig() {
GestureEventQueue::Config config;
ui::GestureConfiguration* gesture_config =
@@ -28,20 +43,20 @@ GestureEventQueue::Config GetGestureEventQueueConfig() {
config.debounce_interval = base::TimeDelta::FromMilliseconds(
gesture_config->scroll_debounce_interval_in_ms());
- config.touchscreen_tap_suppression_config.enabled = true;
+ config.touchscreen_tap_suppression_config.enabled =
+ gesture_config->fling_touchscreen_tap_suppression_enabled();
config.touchscreen_tap_suppression_config.max_cancel_to_down_time =
base::TimeDelta::FromMilliseconds(
gesture_config->fling_max_cancel_to_down_time_in_ms());
-
config.touchscreen_tap_suppression_config.max_tap_gap_time =
base::TimeDelta::FromMilliseconds(
- gesture_config->semi_long_press_time_in_ms());
+ gesture_config->long_press_time_in_ms());
- config.touchpad_tap_suppression_config.enabled = true;
+ config.touchpad_tap_suppression_config.enabled =
+ gesture_config->fling_touchpad_tap_suppression_enabled();
config.touchpad_tap_suppression_config.max_cancel_to_down_time =
base::TimeDelta::FromMilliseconds(
gesture_config->fling_max_cancel_to_down_time_in_ms());
-
config.touchpad_tap_suppression_config.max_tap_gap_time =
base::TimeDelta::FromMilliseconds(
gesture_config->fling_max_tap_gap_time_in_ms());
@@ -49,55 +64,6 @@ GestureEventQueue::Config GetGestureEventQueueConfig() {
return config;
}
-TouchEventQueue::Config GetTouchEventQueueConfig() {
- return TouchEventQueue::Config();
-}
-
-#elif defined(OS_ANDROID)
-
-// Default time allowance for the touch ack delay before the touch sequence is
-// cancelled, depending on whether the site has a mobile-friendly viewport.
-const int kDesktopTouchAckTimeoutDelayMs = 200;
-const int kMobileTouchAckTimeoutDelayMs = 1000;
-
-GestureEventQueue::Config GetGestureEventQueueConfig() {
- GestureEventQueue::Config config;
-
- config.touchscreen_tap_suppression_config.enabled = true;
- config.touchscreen_tap_suppression_config.max_cancel_to_down_time =
- base::TimeDelta::FromMilliseconds(
- gfx::ViewConfiguration::GetTapTimeoutInMs());
- config.touchscreen_tap_suppression_config.max_tap_gap_time =
- base::TimeDelta::FromMilliseconds(
- gfx::ViewConfiguration::GetLongPressTimeoutInMs());
-
- return config;
-}
-
-TouchEventQueue::Config GetTouchEventQueueConfig() {
- TouchEventQueue::Config config;
-
- config.desktop_touch_ack_timeout_delay =
- base::TimeDelta::FromMilliseconds(kDesktopTouchAckTimeoutDelayMs);
- config.mobile_touch_ack_timeout_delay =
- base::TimeDelta::FromMilliseconds(kMobileTouchAckTimeoutDelayMs);
- config.touch_ack_timeout_supported = true;
-
- return config;
-}
-
-#else
-
-GestureEventQueue::Config GetGestureEventQueueConfig() {
- return GestureEventQueue::Config();
-}
-
-TouchEventQueue::Config GetTouchEventQueueConfig() {
- return TouchEventQueue::Config();
-}
-
-#endif
-
} // namespace
InputRouterImpl::Config GetInputRouterConfigForPlatform() {
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>;