Index: ui/events/gesture_detection/gesture_config_helper_android.cc |
diff --git a/ui/events/gesture_detection/gesture_config_helper_android.cc b/ui/events/gesture_detection/gesture_config_helper_android.cc |
index 546cb84e1193635965d49523fcc19fc4a1da1226..fbaba5771ea2529b6528f82f5421870c1414fea3 100644 |
--- a/ui/events/gesture_detection/gesture_config_helper_android.cc |
+++ b/ui/events/gesture_detection/gesture_config_helper_android.cc |
@@ -17,6 +17,10 @@ namespace { |
// detection pipeline. |
const float kMinGestureBoundsLengthDips = 24.f; |
+// This value is somewhat arbitrary, but provides a reasonable maximum |
+// approximating a large thumb depression. |
+const float kMaxGestureBoundsLengthDips = kMinGestureBoundsLengthDips * 4.f; |
+ |
GestureDetector::Config DefaultGestureDetectorConfig( |
const gfx::Display& display) { |
GestureDetector::Config config; |
@@ -51,8 +55,17 @@ ScaleGestureDetector::Config DefaultScaleGestureDetectorConfig( |
const float px_to_dp = 1.f / display.device_scale_factor(); |
config.min_scaling_touch_major = |
ViewConfiguration::GetMinScalingTouchMajorInPixels() * px_to_dp; |
+ config.use_touch_major_in_span = |
+ ViewConfiguration::ShouldUseTouchMajorInScalingSpan(); |
config.min_scaling_span = |
ViewConfiguration::GetMinScalingSpanInPixels() * px_to_dp; |
+ // As the |min_scaling_span| platform constant assumes that touch major values |
+ // are used when computing the span, subtract off a reasonable touch major |
+ // value for the case where the touch major values are not used. |
+ if (!config.use_touch_major_in_span) { |
+ config.min_scaling_span = std::max( |
+ 0.f, config.min_scaling_span - 2.f * config.min_scaling_touch_major); |
+ } |
return config; |
} |
@@ -67,6 +80,7 @@ GestureProvider::Config DefaultGestureProviderConfig() { |
DefaultScaleGestureDetectorConfig(config.display); |
config.gesture_begin_end_types_enabled = false; |
config.min_gesture_bounds_length = kMinGestureBoundsLengthDips; |
+ config.max_gesture_bounds_length = kMaxGestureBoundsLengthDips; |
return config; |
} |