Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(204)

Unified Diff: ui/events/gestures/motion_event_aura.cc

Issue 510793003: Remove ui::TouchEvent -> blink::WebTouchEvent conversion methods. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix tests. Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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..89d1e20dce38b7697f8c41e62f5742fb993b5144 100644
--- a/ui/events/gestures/motion_event_aura.cc
+++ b/ui/events/gestures/motion_event_aura.cc
@@ -69,7 +69,27 @@ 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.
+ 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
+ // 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 +106,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 {

Powered by Google App Engine
This is Rietveld 408576698