diff options
author | tdanderson@chromium.org <tdanderson@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-05-18 18:28:50 +0000 |
---|---|---|
committer | tdanderson@chromium.org <tdanderson@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-05-18 18:28:50 +0000 |
commit | 3f1fd807302565f5ce1abf1996376c48e37362c6 (patch) | |
tree | 73426fe7e2d3bf7a2e3d3c12c2a122257a95b89d /ui/base | |
parent | a17dcc9b1ed370324010af080d7efb06122101c1 (diff) | |
download | chromium_src-3f1fd807302565f5ce1abf1996376c48e37362c6.zip chromium_src-3f1fd807302565f5ce1abf1996376c48e37362c6.tar.gz chromium_src-3f1fd807302565f5ce1abf1996376c48e37362c6.tar.bz2 |
Set a maximum radius size for touch events
Only allow touch events having radius values of at most 100 when computing
the enclosing rectangle for a ET_GESTURE_TAP event.
BUG=chrome-os-partner:9751
TEST=none
Review URL: https://chromiumcodereview.appspot.com/10388193
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@137909 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui/base')
-rw-r--r-- | ui/base/gestures/gesture_configuration.cc | 1 | ||||
-rw-r--r-- | ui/base/gestures/gesture_configuration.h | 7 | ||||
-rw-r--r-- | ui/base/gestures/gesture_point.cc | 6 |
3 files changed, 14 insertions, 0 deletions
diff --git a/ui/base/gestures/gesture_configuration.cc b/ui/base/gestures/gesture_configuration.cc index 789b927..65a4576 100644 --- a/ui/base/gestures/gesture_configuration.cc +++ b/ui/base/gestures/gesture_configuration.cc @@ -10,6 +10,7 @@ namespace ui { // associated list of prefs in gesture_prefs_aura.cc. int GestureConfiguration::default_radius_ = 15; double GestureConfiguration::long_press_time_in_seconds_ = 0.5; +int GestureConfiguration::max_radius_ = 100; double GestureConfiguration::max_seconds_between_double_click_ = 0.7; double GestureConfiguration::max_separation_for_gesture_touches_in_pixels_ = 150; diff --git a/ui/base/gestures/gesture_configuration.h b/ui/base/gestures/gesture_configuration.h index 3914629..f491ccd 100644 --- a/ui/base/gestures/gesture_configuration.h +++ b/ui/base/gestures/gesture_configuration.h @@ -25,6 +25,9 @@ class UI_EXPORT GestureConfiguration { static double long_press_time_in_seconds() { return long_press_time_in_seconds_; } + static int max_radius() { + return max_radius_; + } static void set_long_press_time_in_seconds(double val) { long_press_time_in_seconds_ = val; } @@ -128,6 +131,10 @@ class UI_EXPORT GestureConfiguration { // by the device is the touch center. static int default_radius_; + // The maximum allowed size for the radius of a touch region used in + // forming an ET_GESTURE_TAP event. + static int max_radius_; + static double long_press_time_in_seconds_; static double max_seconds_between_double_click_; static double max_separation_for_gesture_touches_in_pixels_; diff --git a/ui/base/gestures/gesture_point.cc b/ui/base/gestures/gesture_point.cc index 5b8fe5e..5a6537f 100644 --- a/ui/base/gestures/gesture_point.cc +++ b/ui/base/gestures/gesture_point.cc @@ -178,6 +178,12 @@ bool GesturePoint::IsOverMinFlickSpeed() { void GesturePoint::UpdateEnclosingRectangle(const TouchEvent& event) { int radius; + // Ignore this TouchEvent if it has a radius larger than the maximum + // allowed radius size. + if (event.RadiusX() > GestureConfiguration::max_radius() || + event.RadiusY() > GestureConfiguration::max_radius()) + return; + // If the device provides at least one of the radius values, take the larger // of the two and use this as both the x radius and the y radius of the // touch region. Otherwise use the default radius value. |