Chromium Code Reviews| 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 // MSVC++ requires this to be set before any other includes to get M_PI. | 5 // MSVC++ requires this to be set before any other includes to get M_PI. |
| 6 #define _USE_MATH_DEFINES | 6 #define _USE_MATH_DEFINES |
| 7 | 7 |
| 8 #include "ui/events/gestures/motion_event_aura.h" | 8 #include "ui/events/gestures/motion_event_aura.h" |
| 9 | 9 |
| 10 #include <cmath> | 10 #include <cmath> |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 75 } | 75 } |
| 76 | 76 |
| 77 MotionEventAura::~MotionEventAura() { | 77 MotionEventAura::~MotionEventAura() { |
| 78 } | 78 } |
| 79 | 79 |
| 80 bool MotionEventAura::OnTouch(const TouchEvent& touch) { | 80 bool MotionEventAura::OnTouch(const TouchEvent& touch) { |
| 81 int index = FindPointerIndexOfId(touch.touch_id()); | 81 int index = FindPointerIndexOfId(touch.touch_id()); |
| 82 bool pointer_id_is_active = index != -1; | 82 bool pointer_id_is_active = index != -1; |
| 83 | 83 |
| 84 if (touch.type() == ET_TOUCH_PRESSED && pointer_id_is_active) { | 84 if (touch.type() == ET_TOUCH_PRESSED && pointer_id_is_active) { |
| 85 // Ignore touch press events if we already believe the pointer is down. | 85 // TODO(tdresser): This should return false (or NOTREACHED()), and |
| 86 // ignore the touch; however, there is at least one case where we | |
| 87 // need to allow a touch press from a currently used touch id. See | |
| 88 // crbug.com/446852 for details. | |
| 86 | 89 |
| 87 // TODO(tdresser): this should return false (or NOTREACHED()); | 90 // Update the existing touch location. See crbug.com/450880 for an |
| 88 // however, there is at least one case where we need to allow a | 91 // example of why this is necessary. |
| 89 // touch press from a currently used touch id. See | 92 UpdateTouch(touch); |
|
jdduke (slow)
2015/01/26 17:16:19
I guess the alternative is cancelling the previous
tdresser
2015/01/26 17:48:03
Done.
| |
| 90 // crbug.com/446852 for details. | 93 UpdateCachedAction(touch); |
| 94 set_flags(touch.flags()); | |
| 95 set_event_time(touch.time_stamp() + base::TimeTicks()); | |
| 96 return true; | |
| 91 } else if (touch.type() != ET_TOUCH_PRESSED && !pointer_id_is_active) { | 97 } else if (touch.type() != ET_TOUCH_PRESSED && !pointer_id_is_active) { |
| 92 // We could have an active touch stream transfered to us, resulting in touch | 98 // We could have an active touch stream transfered to us, resulting in touch |
| 93 // move or touch up events without associated touch down events. Ignore | 99 // move or touch up events without associated touch down events. Ignore |
| 94 // them. | 100 // them. |
| 95 return false; | 101 return false; |
| 96 } | 102 } |
| 97 | 103 |
| 98 if (touch.type() == ET_TOUCH_MOVED && touch.x() == GetX(index) && | 104 if (touch.type() == ET_TOUCH_MOVED && touch.x() == GetX(index) && |
| 99 touch.y() == GetY(index)) { | 105 touch.y() == GetY(index)) { |
| 100 return false; | 106 return false; |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 191 } | 197 } |
| 192 | 198 |
| 193 int MotionEventAura::GetIndexFromId(int id) const { | 199 int MotionEventAura::GetIndexFromId(int id) const { |
| 194 int index = FindPointerIndexOfId(id); | 200 int index = FindPointerIndexOfId(id); |
| 195 DCHECK_GE(index, 0); | 201 DCHECK_GE(index, 0); |
| 196 DCHECK_LT(index, static_cast<int>(GetPointerCount())); | 202 DCHECK_LT(index, static_cast<int>(GetPointerCount())); |
| 197 return index; | 203 return index; |
| 198 } | 204 } |
| 199 | 205 |
| 200 } // namespace ui | 206 } // namespace ui |
| OLD | NEW |