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

Unified Diff: ui/aura/window_event_dispatcher.cc

Issue 1048333005: ozone: Map TouchEvent::touch_id_ into expected range (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 8 months 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/aura/window_event_dispatcher.cc
diff --git a/ui/aura/window_event_dispatcher.cc b/ui/aura/window_event_dispatcher.cc
index 8b7db5d1eb1ec68d96d3cbcaee170b8c5cfee7f4..bad218f5b115734ea00852a597ea10339d8ddd48 100644
--- a/ui/aura/window_event_dispatcher.cc
+++ b/ui/aura/window_event_dispatcher.cc
@@ -75,7 +75,6 @@ bool IsEventCandidateForHold(const ui::Event& event) {
WindowEventDispatcher::WindowEventDispatcher(WindowTreeHost* host)
: host_(host),
- touch_ids_down_(0),
mouse_pressed_handler_(NULL),
mouse_moved_handler_(NULL),
event_dispatch_target_(NULL),
@@ -853,8 +852,8 @@ void WindowEventDispatcher::PreDispatchTouchEvent(Window* target,
ui::TouchEvent* event) {
switch (event->type()) {
case ui::ET_TOUCH_PRESSED:
- touch_ids_down_ |= (1 << event->touch_id());
- Env::GetInstance()->set_touch_down(touch_ids_down_ != 0);
+ touch_ids_down_.insert(event->touch_id());
+ Env::GetInstance()->set_touch_down(!touch_ids_down_.empty());
break;
// Handle ET_TOUCH_CANCELLED only if it has a native event.
@@ -863,9 +862,8 @@ void WindowEventDispatcher::PreDispatchTouchEvent(Window* target,
break;
// fallthrough
case ui::ET_TOUCH_RELEASED:
- touch_ids_down_ = (touch_ids_down_ | (1 << event->touch_id())) ^
- (1 << event->touch_id());
- Env::GetInstance()->set_touch_down(touch_ids_down_ != 0);
+ touch_ids_down_.erase(event->touch_id());
+ Env::GetInstance()->set_touch_down(!touch_ids_down_.empty());
break;
case ui::ET_TOUCH_MOVED:

Powered by Google App Engine
This is Rietveld 408576698