| 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 280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 291 // Set a limit on the number of simultaneous touches in a gesture. | 291 // Set a limit on the number of simultaneous touches in a gesture. |
| 292 if (event.GetTouchId() >= kMaxGesturePoints) | 292 if (event.GetTouchId() >= kMaxGesturePoints) |
| 293 return NULL; | 293 return NULL; |
| 294 | 294 |
| 295 if (event.GetEventType() == ui::ET_TOUCH_PRESSED) { | 295 if (event.GetEventType() == ui::ET_TOUCH_PRESSED) { |
| 296 if (point_count_ == kMaxGesturePoints) | 296 if (point_count_ == kMaxGesturePoints) |
| 297 return NULL; | 297 return NULL; |
| 298 GesturePoint* new_point = &points_[event.GetTouchId()]; | 298 GesturePoint* new_point = &points_[event.GetTouchId()]; |
| 299 // We shouldn't be able to get two PRESSED events from the same | 299 // We shouldn't be able to get two PRESSED events from the same |
| 300 // finger without either a RELEASE or CANCEL in between. | 300 // finger without either a RELEASE or CANCEL in between. |
| 301 DCHECK(!points_[event.GetTouchId()].in_use()); | 301 DCHECK(!new_point->in_use()); |
| 302 new_point->set_point_id(point_count_++); | 302 new_point->set_point_id(point_count_++); |
| 303 new_point->set_touch_id(event.GetTouchId()); | 303 new_point->set_touch_id(event.GetTouchId()); |
| 304 } | 304 } |
| 305 | 305 |
| 306 GestureState last_state = state_; | 306 GestureState last_state = state_; |
| 307 | 307 |
| 308 // NOTE: when modifying these state transitions, also update gestures.dot | 308 // NOTE: when modifying these state transitions, also update gestures.dot |
| 309 scoped_ptr<Gestures> gestures(new Gestures()); | 309 scoped_ptr<Gestures> gestures(new Gestures()); |
| 310 GesturePoint& point = GesturePointForEvent(event); | 310 GesturePoint& point = GesturePointForEvent(event); |
| 311 point.UpdateValues(event); | 311 point.UpdateValues(event); |
| (...skipping 687 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 999 return; | 999 return; |
| 1000 | 1000 |
| 1001 // Since long press timer has been started, there should be a non-NULL point. | 1001 // Since long press timer has been started, there should be a non-NULL point. |
| 1002 const GesturePoint* point = GetPointByPointId(0); | 1002 const GesturePoint* point = GetPointByPointId(0); |
| 1003 if (!ui::gestures::IsInsideManhattanSquare(point->first_touch_position(), | 1003 if (!ui::gestures::IsInsideManhattanSquare(point->first_touch_position(), |
| 1004 event.GetLocation())) | 1004 event.GetLocation())) |
| 1005 long_press_timer_->Stop(); | 1005 long_press_timer_->Stop(); |
| 1006 } | 1006 } |
| 1007 | 1007 |
| 1008 } // namespace ui | 1008 } // namespace ui |
| OLD | NEW |