summaryrefslogtreecommitdiffstats
path: root/ui
diff options
context:
space:
mode:
authorvarunjain@chromium.org <varunjain@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-08-28 06:17:05 +0000
committervarunjain@chromium.org <varunjain@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-08-28 06:17:05 +0000
commit2d2a33952a3a67454ccfb826009223341ee62928 (patch)
tree9c00e2a848035deef485e0b9900fd1c73fb1244c /ui
parentcd81a65a5ab4619df60a900a875e78cf3f98cdfe (diff)
downloadchromium_src-2d2a33952a3a67454ccfb826009223341ee62928.zip
chromium_src-2d2a33952a3a67454ccfb826009223341ee62928.tar.gz
chromium_src-2d2a33952a3a67454ccfb826009223341ee62928.tar.bz2
Change default values of some gesture related constants
BUG=139650,145059 TEST=manual Review URL: https://chromiumcodereview.appspot.com/10878085 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@153634 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui')
-rw-r--r--ui/aura/gestures/gesture_recognizer_unittest.cc30
-rw-r--r--ui/aura/test/aura_test_base.cc5
-rw-r--r--ui/base/gestures/gesture_configuration.cc5
-rw-r--r--ui/base/gestures/gesture_configuration.h7
-rw-r--r--ui/base/gestures/gesture_point.cc6
5 files changed, 32 insertions, 21 deletions
diff --git a/ui/aura/gestures/gesture_recognizer_unittest.cc b/ui/aura/gestures/gesture_recognizer_unittest.cc
index c0bc2dc..a7ecec5 100644
--- a/ui/aura/gestures/gesture_recognizer_unittest.cc
+++ b/ui/aura/gestures/gesture_recognizer_unittest.cc
@@ -532,7 +532,7 @@ TEST_F(GestureRecognizerTest, GestureEventTapRegion) {
EXPECT_FALSE(delegate->long_press());
delegate->Reset();
- ui::TouchEvent release(ui::ET_TOUCH_RELEASED, gfx::Point(377, 291),
+ ui::TouchEvent release(ui::ET_TOUCH_RELEASED, gfx::Point(367, 291),
kTouchId, press.time_stamp() +
base::TimeDelta::FromMilliseconds(50));
release.set_radius_x(20);
@@ -550,9 +550,9 @@ TEST_F(GestureRecognizerTest, GestureEventTapRegion) {
EXPECT_EQ(1, delegate->tap_count());
gfx::Point actual_point(delegate->tap_location());
- EXPECT_EQ(46, delegate->bounding_box().width());
+ EXPECT_EQ(40, delegate->bounding_box().width());
EXPECT_EQ(40, delegate->bounding_box().height());
- EXPECT_EQ(373, actual_point.x());
+ EXPECT_EQ(366, actual_point.x());
EXPECT_EQ(290, actual_point.y());
}
@@ -574,7 +574,7 @@ TEST_F(GestureRecognizerTest, GestureEventTapRegion) {
EXPECT_FALSE(delegate->long_press());
delegate->Reset();
- ui::TouchEvent move(ui::ET_TOUCH_MOVED, gfx::Point(52, 200),
+ ui::TouchEvent move(ui::ET_TOUCH_MOVED, gfx::Point(49, 204),
kTouchId, press.time_stamp() +
base::TimeDelta::FromMilliseconds(50));
move.set_radius_x(8);
@@ -590,7 +590,7 @@ TEST_F(GestureRecognizerTest, GestureEventTapRegion) {
EXPECT_FALSE(delegate->long_press());
delegate->Reset();
- ui::TouchEvent release(ui::ET_TOUCH_RELEASED, gfx::Point(50, 195),
+ ui::TouchEvent release(ui::ET_TOUCH_RELEASED, gfx::Point(49, 204),
kTouchId, press.time_stamp() +
base::TimeDelta::FromMilliseconds(50));
release.set_radius_x(4);
@@ -608,10 +608,10 @@ TEST_F(GestureRecognizerTest, GestureEventTapRegion) {
EXPECT_EQ(1, delegate->tap_count());
gfx::Point actual_point(delegate->tap_location());
- EXPECT_EQ(28, delegate->bounding_box().width());
- EXPECT_EQ(28, delegate->bounding_box().height());
- EXPECT_EQ(49, actual_point.x());
- EXPECT_EQ(200, actual_point.y());
+ EXPECT_EQ(25, delegate->bounding_box().width());
+ EXPECT_EQ(24, delegate->bounding_box().height());
+ EXPECT_EQ(48, actual_point.x());
+ EXPECT_EQ(203, actual_point.y());
}
// Test with a few ET_TOUCH_MOVED events.
@@ -632,7 +632,7 @@ TEST_F(GestureRecognizerTest, GestureEventTapRegion) {
EXPECT_FALSE(delegate->long_press());
delegate->Reset();
- ui::TouchEvent move(ui::ET_TOUCH_MOVED, gfx::Point(397, 155),
+ ui::TouchEvent move(ui::ET_TOUCH_MOVED, gfx::Point(397, 151),
kTouchId, press.time_stamp() +
base::TimeDelta::FromMilliseconds(50));
move.set_radius_x(13);
@@ -648,7 +648,7 @@ TEST_F(GestureRecognizerTest, GestureEventTapRegion) {
EXPECT_FALSE(delegate->long_press());
delegate->Reset();
- ui::TouchEvent move1(ui::ET_TOUCH_MOVED, gfx::Point(395, 148),
+ ui::TouchEvent move1(ui::ET_TOUCH_MOVED, gfx::Point(397, 149),
kTouchId, move.time_stamp() +
base::TimeDelta::FromMilliseconds(50));
move1.set_radius_x(16);
@@ -698,10 +698,10 @@ TEST_F(GestureRecognizerTest, GestureEventTapRegion) {
EXPECT_EQ(1, delegate->tap_count());
gfx::Point actual_point(delegate->tap_location());
- EXPECT_EQ(35, delegate->bounding_box().width());
- EXPECT_EQ(36, delegate->bounding_box().height());
- EXPECT_EQ(396, actual_point.x());
- EXPECT_EQ(149, actual_point.y());
+ EXPECT_EQ(33, delegate->bounding_box().width());
+ EXPECT_EQ(32, delegate->bounding_box().height());
+ EXPECT_EQ(397, actual_point.x());
+ EXPECT_EQ(148, actual_point.y());
}
}
diff --git a/ui/aura/test/aura_test_base.cc b/ui/aura/test/aura_test_base.cc
index 5dbb9fc..fcad350 100644
--- a/ui/aura/test/aura_test_base.cc
+++ b/ui/aura/test/aura_test_base.cc
@@ -25,14 +25,15 @@ void AuraTestBase::SetUp() {
// tests to fail, so we use a separate set of parameters for unit
// testing.
ui::GestureConfiguration::set_long_press_time_in_seconds(1.0);
- ui::GestureConfiguration::set_semi_long_press_time_in_seconds(0.5);
+ ui::GestureConfiguration::set_semi_long_press_time_in_seconds(0.4);
ui::GestureConfiguration::set_max_distance_for_two_finger_tap_in_pixels(300);
ui::GestureConfiguration::set_max_seconds_between_double_click(0.7);
ui::GestureConfiguration::
set_max_separation_for_gesture_touches_in_pixels(150);
ui::GestureConfiguration::
set_max_touch_down_duration_in_seconds_for_click(0.8);
- ui::GestureConfiguration::set_max_touch_move_in_pixels_for_click(20);
+ ui::GestureConfiguration::set_max_touch_move_in_pixels_for_click(5);
+ ui::GestureConfiguration::set_max_distance_between_taps_for_double_tap(20);
ui::GestureConfiguration::set_min_distance_for_pinch_scroll_in_pixels(20);
ui::GestureConfiguration::set_min_flick_speed_squared(550.f * 550.f);
ui::GestureConfiguration::set_min_pinch_update_distance_in_pixels(5);
diff --git a/ui/base/gestures/gesture_configuration.cc b/ui/base/gestures/gesture_configuration.cc
index 928f008..26e68a3 100644
--- a/ui/base/gestures/gesture_configuration.cc
+++ b/ui/base/gestures/gesture_configuration.cc
@@ -10,7 +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_ = 1.0;
-double GestureConfiguration::semi_long_press_time_in_seconds_ = 0.2;
+double GestureConfiguration::semi_long_press_time_in_seconds_ = 0.4;
double GestureConfiguration::max_distance_for_two_finger_tap_in_pixels_ = 300;
int GestureConfiguration::max_radius_ = 100;
double GestureConfiguration::max_seconds_between_double_click_ = 0.7;
@@ -19,7 +19,8 @@ double
double GestureConfiguration::max_swipe_deviation_ratio_ = 3;
double
GestureConfiguration::max_touch_down_duration_in_seconds_for_click_ = 0.8;
-double GestureConfiguration::max_touch_move_in_pixels_for_click_ = 20;
+double GestureConfiguration::max_touch_move_in_pixels_for_click_ = 5;
+double GestureConfiguration::max_distance_between_taps_for_double_tap_ = 20;
double GestureConfiguration::min_distance_for_pinch_scroll_in_pixels_ = 20;
double GestureConfiguration::min_flick_speed_squared_ = 550.f * 550.f;
double GestureConfiguration::min_pinch_update_distance_in_pixels_ = 5;
diff --git a/ui/base/gestures/gesture_configuration.h b/ui/base/gestures/gesture_configuration.h
index 7deac42..d0b5cbc 100644
--- a/ui/base/gestures/gesture_configuration.h
+++ b/ui/base/gestures/gesture_configuration.h
@@ -73,6 +73,12 @@ class UI_EXPORT GestureConfiguration {
static void set_max_touch_move_in_pixels_for_click(double val) {
max_touch_move_in_pixels_for_click_ = val;
}
+ static double max_distance_between_taps_for_double_tap() {
+ return max_distance_between_taps_for_double_tap_;
+ }
+ static void set_max_distance_between_taps_for_double_tap(double val) {
+ max_distance_between_taps_for_double_tap_ = val;
+ }
static double min_distance_for_pinch_scroll_in_pixels() {
return min_distance_for_pinch_scroll_in_pixels_;
}
@@ -165,6 +171,7 @@ class UI_EXPORT GestureConfiguration {
static double max_swipe_deviation_ratio_;
static double max_touch_down_duration_in_seconds_for_click_;
static double max_touch_move_in_pixels_for_click_;
+ static double max_distance_between_taps_for_double_tap_;
static double min_distance_for_pinch_scroll_in_pixels_;
static double min_flick_speed_squared_;
static double min_pinch_update_distance_in_pixels_;
diff --git a/ui/base/gestures/gesture_point.cc b/ui/base/gestures/gesture_point.cc
index bbf4d7b1..89ec955 100644
--- a/ui/base/gestures/gesture_point.cc
+++ b/ui/base/gestures/gesture_point.cc
@@ -155,8 +155,10 @@ bool GesturePoint::IsInsideManhattanSquare(const TouchEvent& event) const {
bool GesturePoint::IsSecondClickInsideManhattanSquare(
const TouchEvent& event) const {
- return ui::gestures::IsInsideManhattanSquare(event.location(),
- last_tap_position_);
+ int manhattan_distance = abs(event.location().x() - last_tap_position_.x()) +
+ abs(event.location().y() - last_tap_position_.y());
+ return manhattan_distance <
+ GestureConfiguration::max_distance_between_taps_for_double_tap();
}
bool GesturePoint::IsOverMinFlickSpeed() {