Index: ui/events/gestures/motion_event_aura.cc |
diff --git a/ui/events/gestures/motion_event_aura.cc b/ui/events/gestures/motion_event_aura.cc |
index 11f8ba14c73a48a5d1f713f23055736cf01e29af..1164cd0af589c31f60b568ce2143092eb1555cad 100644 |
--- a/ui/events/gestures/motion_event_aura.cc |
+++ b/ui/events/gestures/motion_event_aura.cc |
@@ -69,7 +69,33 @@ MotionEventAura::MotionEventAura() { |
MotionEventAura::~MotionEventAura() { |
} |
-void MotionEventAura::OnTouch(const TouchEvent& touch) { |
+bool MotionEventAura::OnTouch(const TouchEvent& touch) { |
+ int index = FindPointerIndexOfId(touch.touch_id()); |
+ bool pointer_id_is_active = index != -1; |
+ |
+ if (touch.type() == ET_TOUCH_PRESSED && pointer_id_is_active) { |
+ // Ignore touch press events if we already believe the pointer is down. |
+ |
+ // FIXME(tdresser): this should return false (or NOTREACHED()); |
jdduke (slow)
2015/01/05 22:35:14
Nit: TODO is more common in chromium (vs blink).
tdresser
2015/01/06 14:20:16
Done.
|
+ // however, there is at least one case where we need to allow a |
+ // touch press from a currently used touch id. See |
jdduke (slow)
2015/01/05 22:35:14
Will the drag/drop case only occur when the touch
tdresser
2015/01/06 14:20:16
In the drag and drop case, there are two windows i
jdduke (slow)
2015/01/06 16:49:54
OK, I just want to make sure we don't get into a s
tdresser
2015/01/07 17:01:15
That can happen, both with this patch, and on mast
|
+ // crbug.com/373125 for details. |
+ |
jdduke (slow)
2015/01/05 22:35:14
No need to include the commented out code.
tdresser
2015/01/06 14:20:16
Done.
|
+ // return false; |
+ } else if (touch.type() != ET_TOUCH_PRESSED && !pointer_id_is_active) { |
+ // We could have an active touch stream transfered to us, resulting in touch |
+ // move or touch up events without associated touch down events. Ignore |
+ // them. |
+ return false; |
+ } |
+ |
+ // If this is a touchmove event, and it isn't different from the last |
jdduke (slow)
2015/01/06 16:49:54
Nit: This comment is somewhat redundant. Or maybe
tdresser
2015/01/07 17:01:15
Removed comment.
|
+ // event, ignore it. |
+ if (touch.type() == ET_TOUCH_MOVED && touch.x() == GetX(index) && |
+ touch.y() == GetY(index)) { |
+ return false; |
+ } |
+ |
switch (touch.type()) { |
case ET_TOUCH_PRESSED: |
AddTouch(touch); |
@@ -86,12 +112,13 @@ void MotionEventAura::OnTouch(const TouchEvent& touch) { |
break; |
default: |
NOTREACHED(); |
- break; |
+ return false; |
} |
UpdateCachedAction(touch); |
set_flags(touch.flags()); |
set_event_time(touch.time_stamp() + base::TimeTicks()); |
+ return true; |
} |
int MotionEventAura::GetId() const { |