| 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/motion_event_aura.h" | 5 #include "ui/events/gestures/motion_event_aura.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "ui/events/gesture_detection/gesture_configuration.h" | 8 #include "ui/events/gesture_detection/gesture_configuration.h" |
| 9 | 9 |
| 10 namespace ui { | 10 namespace ui { |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 int index = FindPointerIndexOfId(touch.touch_id()); | 47 int index = FindPointerIndexOfId(touch.touch_id()); |
| 48 bool pointer_id_is_active = index != -1; | 48 bool pointer_id_is_active = index != -1; |
| 49 | 49 |
| 50 if (touch.type() == ET_TOUCH_PRESSED && pointer_id_is_active) { | 50 if (touch.type() == ET_TOUCH_PRESSED && pointer_id_is_active) { |
| 51 // TODO(tdresser): This should return false (or NOTREACHED()), and | 51 // TODO(tdresser): This should return false (or NOTREACHED()), and |
| 52 // ignore the touch; however, there is at least one case where we | 52 // ignore the touch; however, there is at least one case where we |
| 53 // need to allow a touch press from a currently used touch id. See | 53 // need to allow a touch press from a currently used touch id. See |
| 54 // crbug.com/446852 for details. | 54 // crbug.com/446852 for details. |
| 55 | 55 |
| 56 // Cancel the existing touch, before handling the touch press. | 56 // Cancel the existing touch, before handling the touch press. |
| 57 TouchEvent cancel(ET_TOUCH_CANCELLED, touch.location_f(), touch.touch_id(), | 57 TouchEvent cancel(ET_TOUCH_CANCELLED, gfx::Point(), touch.touch_id(), |
| 58 touch.time_stamp()); | 58 touch.time_stamp()); |
| 59 cancel.set_location_f(touch.location_f()); |
| 60 cancel.set_root_location_f(touch.location_f()); |
| 59 OnTouch(cancel); | 61 OnTouch(cancel); |
| 60 CleanupRemovedTouchPoints(cancel); | 62 CleanupRemovedTouchPoints(cancel); |
| 61 DCHECK_EQ(-1, FindPointerIndexOfId(touch.touch_id())); | 63 DCHECK_EQ(-1, FindPointerIndexOfId(touch.touch_id())); |
| 62 } else if (touch.type() != ET_TOUCH_PRESSED && !pointer_id_is_active) { | 64 } else if (touch.type() != ET_TOUCH_PRESSED && !pointer_id_is_active) { |
| 63 // We could have an active touch stream transfered to us, resulting in touch | 65 // We could have an active touch stream transfered to us, resulting in touch |
| 64 // move or touch up events without associated touch down events. Ignore | 66 // move or touch up events without associated touch down events. Ignore |
| 65 // them. | 67 // them. |
| 66 return false; | 68 return false; |
| 67 } | 69 } |
| 68 | 70 |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 162 | 164 |
| 163 int MotionEventAura::GetIndexFromId(int id) const { | 165 int MotionEventAura::GetIndexFromId(int id) const { |
| 164 int index = FindPointerIndexOfId(id); | 166 int index = FindPointerIndexOfId(id); |
| 165 // TODO(tdresser): remove these checks once crbug.com/525189 is fixed. | 167 // TODO(tdresser): remove these checks once crbug.com/525189 is fixed. |
| 166 CHECK_GE(index, 0); | 168 CHECK_GE(index, 0); |
| 167 CHECK_LT(index, static_cast<int>(GetPointerCount())); | 169 CHECK_LT(index, static_cast<int>(GetPointerCount())); |
| 168 return index; | 170 return index; |
| 169 } | 171 } |
| 170 | 172 |
| 171 } // namespace ui | 173 } // namespace ui |
| OLD | NEW |