OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "ui/events/gestures/gesture_provider_aura.h" | 5 #include "ui/events/gestures/gesture_provider_aura.h" |
6 | 6 |
7 #include "base/auto_reset.h" | 7 #include "base/auto_reset.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "ui/events/event.h" | 9 #include "ui/events/event.h" |
10 #include "ui/events/gesture_detection/gesture_config_helper.h" | 10 #include "ui/events/gesture_detection/gesture_config_helper.h" |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
115 new ScopedVector<GestureEvent>(); | 115 new ScopedVector<GestureEvent>(); |
116 old_pending_gestures->swap(pending_gestures_); | 116 old_pending_gestures->swap(pending_gestures_); |
117 return old_pending_gestures; | 117 return old_pending_gestures; |
118 } | 118 } |
119 | 119 |
120 bool GestureProviderAura::IsConsideredDoubleTap( | 120 bool GestureProviderAura::IsConsideredDoubleTap( |
121 const GestureEventData& previous_tap, | 121 const GestureEventData& previous_tap, |
122 const GestureEventData& current_tap) const { | 122 const GestureEventData& current_tap) const { |
123 if (current_tap.time - previous_tap.time > | 123 if (current_tap.time - previous_tap.time > |
124 base::TimeDelta::FromMilliseconds( | 124 base::TimeDelta::FromMilliseconds( |
125 ui::GestureConfiguration::max_seconds_between_double_click() * | 125 ui::GestureConfiguration::max_time_between_double_click_in_ms())) { |
126 1000)) { | |
127 return false; | 126 return false; |
128 } | 127 } |
129 | 128 |
130 double double_tap_slop_square = | 129 float double_tap_slop_square = |
131 GestureConfiguration::max_distance_between_taps_for_double_tap(); | 130 GestureConfiguration::max_distance_between_taps_for_double_tap(); |
132 double_tap_slop_square *= double_tap_slop_square; | 131 double_tap_slop_square *= double_tap_slop_square; |
133 const float delta_x = previous_tap.x - current_tap.x; | 132 const float delta_x = previous_tap.x - current_tap.x; |
134 const float delta_y = previous_tap.y - current_tap.y; | 133 const float delta_y = previous_tap.y - current_tap.y; |
135 return (delta_x * delta_x + delta_y * delta_y < double_tap_slop_square); | 134 return (delta_x * delta_x + delta_y * delta_y < double_tap_slop_square); |
136 } | 135 } |
137 | 136 |
138 } // namespace content | 137 } // namespace content |
OLD | NEW |