OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/base/gestures/gesture_sequence.h" | 5 #include "ui/base/gestures/gesture_sequence.h" |
6 | 6 |
7 #include <cmath> | 7 #include <cmath> |
8 #include <stdlib.h> | 8 #include <stdlib.h> |
9 | 9 |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 829 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
840 flags_, | 840 flags_, |
841 base::Time::FromDoubleT(point->last_touch_time()), | 841 base::Time::FromDoubleT(point->last_touch_time()), |
842 1 << point->touch_id())); | 842 1 << point->touch_id())); |
843 } | 843 } |
844 | 844 |
845 bool GestureSequence::Click(const TouchEvent& event, | 845 bool GestureSequence::Click(const TouchEvent& event, |
846 const GesturePoint& point, | 846 const GesturePoint& point, |
847 Gestures* gestures) { | 847 Gestures* gestures) { |
848 DCHECK(state_ == GS_PENDING_SYNTHETIC_CLICK); | 848 DCHECK(state_ == GS_PENDING_SYNTHETIC_CLICK); |
849 if (point.IsInClickWindow(event)) { | 849 if (point.IsInClickWindow(event)) { |
850 bool double_tap = point.IsInDoubleClickWindow(event); | 850 int tap_count = 1; |
851 AppendClickGestureEvent(point, double_tap ? 2 : 1, gestures); | 851 if (point.IsInTripleClickWindow(event)) |
| 852 tap_count = 3; |
| 853 else if (point.IsInDoubleClickWindow(event)) |
| 854 tap_count = 2; |
| 855 AppendClickGestureEvent(point, tap_count, gestures); |
852 return true; | 856 return true; |
853 } else if (point.IsInsideManhattanSquare(event) && | 857 } else if (point.IsInsideManhattanSquare(event) && |
854 !GetLongPressTimer()->IsRunning()) { | 858 !GetLongPressTimer()->IsRunning()) { |
855 AppendLongTapGestureEvent(point, gestures); | 859 AppendLongTapGestureEvent(point, gestures); |
856 } | 860 } |
857 return false; | 861 return false; |
858 } | 862 } |
859 | 863 |
860 bool GestureSequence::ScrollStart(const TouchEvent& event, | 864 bool GestureSequence::ScrollStart(const TouchEvent& event, |
861 GesturePoint& point, | 865 GesturePoint& point, |
(...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1137 return; | 1141 return; |
1138 | 1142 |
1139 // Since long press timer has been started, there should be a non-NULL point. | 1143 // Since long press timer has been started, there should be a non-NULL point. |
1140 const GesturePoint* point = GetPointByPointId(0); | 1144 const GesturePoint* point = GetPointByPointId(0); |
1141 if (!ui::gestures::IsInsideManhattanSquare(point->first_touch_position(), | 1145 if (!ui::gestures::IsInsideManhattanSquare(point->first_touch_position(), |
1142 event.location())) | 1146 event.location())) |
1143 GetLongPressTimer()->Stop(); | 1147 GetLongPressTimer()->Stop(); |
1144 } | 1148 } |
1145 | 1149 |
1146 } // namespace ui | 1150 } // namespace ui |
OLD | NEW |