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 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
229 if (event.GetTouchId() >= kMaxGesturePoints) | 229 if (event.GetTouchId() >= kMaxGesturePoints) |
230 return NULL; | 230 return NULL; |
231 | 231 |
232 if (event.GetEventType() == ui::ET_TOUCH_PRESSED) { | 232 if (event.GetEventType() == ui::ET_TOUCH_PRESSED) { |
233 if (point_count_ == kMaxGesturePoints) | 233 if (point_count_ == kMaxGesturePoints) |
234 return NULL; | 234 return NULL; |
235 GesturePoint* new_point = &points_[event.GetTouchId()]; | 235 GesturePoint* new_point = &points_[event.GetTouchId()]; |
236 // We shouldn't be able to get two PRESSED events from the same | 236 // We shouldn't be able to get two PRESSED events from the same |
237 // finger without either a RELEASE or CANCEL in between. | 237 // finger without either a RELEASE or CANCEL in between. |
238 DCHECK(!points_[event.GetTouchId()].in_use()); | 238 DCHECK(!points_[event.GetTouchId()].in_use()); |
239 DCHECK(!new_point->in_use()); | |
sadrul
2012/07/05 17:00:54
lines 238/239 are checking the same thing?
girard
2012/07/05 18:43:44
Yes. Since the rest of the code uses the new_poin
sadrul
2012/07/09 07:12:06
Ah, in that case, remove line 238?
girard
2012/07/26 12:36:43
Done.
| |
239 new_point->set_point_id(point_count_++); | 240 new_point->set_point_id(point_count_++); |
240 new_point->set_touch_id(event.GetTouchId()); | 241 new_point->set_touch_id(event.GetTouchId()); |
241 } | 242 } |
242 | 243 |
243 GestureState last_state = state_; | 244 GestureState last_state = state_; |
244 | 245 |
245 // NOTE: when modifying these state transitions, also update gestures.dot | 246 // NOTE: when modifying these state transitions, also update gestures.dot |
246 scoped_ptr<Gestures> gestures(new Gestures()); | 247 scoped_ptr<Gestures> gestures(new Gestures()); |
247 GesturePoint& point = GesturePointForEvent(event); | 248 GesturePoint& point = GesturePointForEvent(event); |
248 point.UpdateValues(event); | 249 point.UpdateValues(event); |
(...skipping 675 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
924 return; | 925 return; |
925 | 926 |
926 // Since long press timer has been started, there should be a non-NULL point. | 927 // Since long press timer has been started, there should be a non-NULL point. |
927 const GesturePoint* point = GetPointByPointId(0); | 928 const GesturePoint* point = GetPointByPointId(0); |
928 if (!ui::gestures::IsInsideManhattanSquare(point->first_touch_position(), | 929 if (!ui::gestures::IsInsideManhattanSquare(point->first_touch_position(), |
929 event.GetLocation())) | 930 event.GetLocation())) |
930 long_press_timer_->Stop(); | 931 long_press_timer_->Stop(); |
931 } | 932 } |
932 | 933 |
933 } // namespace ui | 934 } // namespace ui |
OLD | NEW |