| 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 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 228 // Set a limit on the number of simultaneous touches in a gesture. | 228 // Set a limit on the number of simultaneous touches in a gesture. |
| 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(!new_point->in_use()); |
| 239 new_point->set_point_id(point_count_++); | 239 new_point->set_point_id(point_count_++); |
| 240 new_point->set_touch_id(event.GetTouchId()); | 240 new_point->set_touch_id(event.GetTouchId()); |
| 241 } | 241 } |
| 242 | 242 |
| 243 GestureState last_state = state_; | 243 GestureState last_state = state_; |
| 244 | 244 |
| 245 // NOTE: when modifying these state transitions, also update gestures.dot | 245 // NOTE: when modifying these state transitions, also update gestures.dot |
| 246 scoped_ptr<Gestures> gestures(new Gestures()); | 246 scoped_ptr<Gestures> gestures(new Gestures()); |
| 247 GesturePoint& point = GesturePointForEvent(event); | 247 GesturePoint& point = GesturePointForEvent(event); |
| 248 point.UpdateValues(event); | 248 point.UpdateValues(event); |
| (...skipping 675 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 924 return; | 924 return; |
| 925 | 925 |
| 926 // Since long press timer has been started, there should be a non-NULL point. | 926 // Since long press timer has been started, there should be a non-NULL point. |
| 927 const GesturePoint* point = GetPointByPointId(0); | 927 const GesturePoint* point = GetPointByPointId(0); |
| 928 if (!ui::gestures::IsInsideManhattanSquare(point->first_touch_position(), | 928 if (!ui::gestures::IsInsideManhattanSquare(point->first_touch_position(), |
| 929 event.GetLocation())) | 929 event.GetLocation())) |
| 930 long_press_timer_->Stop(); | 930 long_press_timer_->Stop(); |
| 931 } | 931 } |
| 932 | 932 |
| 933 } // namespace ui | 933 } // namespace ui |
| OLD | NEW |