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

Side by Side Diff: ui/events/blink/blink_event_util.cc

Issue 1120293003: Make sure send one WebTouchEvent ack per ui::TouchEvent (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 7 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 unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/blink/blink_event_util.h" 8 #include "ui/events/blink/blink_event_util.h"
9 9
10 #include <cmath> 10 #include <cmath>
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 46
47 // Note that |is_action_pointer| is meaningful only in the context of 47 // Note that |is_action_pointer| is meaningful only in the context of
48 // |ACTION_POINTER_UP| and |ACTION_POINTER_DOWN|; other actions map directly to 48 // |ACTION_POINTER_UP| and |ACTION_POINTER_DOWN|; other actions map directly to
49 // WebTouchPoint::State. 49 // WebTouchPoint::State.
50 WebTouchPoint::State ToWebTouchPointState(const MotionEvent& event, 50 WebTouchPoint::State ToWebTouchPointState(const MotionEvent& event,
51 size_t pointer_index) { 51 size_t pointer_index) {
52 switch (event.GetAction()) { 52 switch (event.GetAction()) {
53 case MotionEvent::ACTION_DOWN: 53 case MotionEvent::ACTION_DOWN:
54 return WebTouchPoint::StatePressed; 54 return WebTouchPoint::StatePressed;
55 case MotionEvent::ACTION_MOVE: 55 case MotionEvent::ACTION_MOVE:
56 return WebTouchPoint::StateMoved; 56 return static_cast<int>(pointer_index) == event.GetActionIndex()
tdresser 2015/05/04 20:39:37 GetActionIndex is only valid if |GetAction()| retu
57 ? WebTouchPoint::StateMoved
58 : WebTouchPoint::StateStationary;
57 case MotionEvent::ACTION_UP: 59 case MotionEvent::ACTION_UP:
58 return WebTouchPoint::StateReleased; 60 return WebTouchPoint::StateReleased;
59 case MotionEvent::ACTION_CANCEL: 61 case MotionEvent::ACTION_CANCEL:
60 return WebTouchPoint::StateCancelled; 62 return static_cast<int>(pointer_index) == event.GetActionIndex()
63 ? WebTouchPoint::StateCancelled
64 : WebTouchPoint::StateStationary;
61 case MotionEvent::ACTION_POINTER_DOWN: 65 case MotionEvent::ACTION_POINTER_DOWN:
62 return static_cast<int>(pointer_index) == event.GetActionIndex() 66 return static_cast<int>(pointer_index) == event.GetActionIndex()
63 ? WebTouchPoint::StatePressed 67 ? WebTouchPoint::StatePressed
64 : WebTouchPoint::StateStationary; 68 : WebTouchPoint::StateStationary;
65 case MotionEvent::ACTION_POINTER_UP: 69 case MotionEvent::ACTION_POINTER_UP:
66 return static_cast<int>(pointer_index) == event.GetActionIndex() 70 return static_cast<int>(pointer_index) == event.GetActionIndex()
67 ? WebTouchPoint::StateReleased 71 ? WebTouchPoint::StateReleased
68 : WebTouchPoint::StateStationary; 72 : WebTouchPoint::StateStationary;
69 } 73 }
70 NOTREACHED() << "Invalid MotionEvent::Action."; 74 NOTREACHED() << "Invalid MotionEvent::Action.";
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after
296 } 300 }
297 301
298 WebGestureEvent CreateWebGestureEventFromGestureEventData( 302 WebGestureEvent CreateWebGestureEventFromGestureEventData(
299 const GestureEventData& data) { 303 const GestureEventData& data) {
300 return CreateWebGestureEvent(data.details, data.time - base::TimeTicks(), 304 return CreateWebGestureEvent(data.details, data.time - base::TimeTicks(),
301 gfx::PointF(data.x, data.y), 305 gfx::PointF(data.x, data.y),
302 gfx::PointF(data.raw_x, data.raw_y), data.flags); 306 gfx::PointF(data.raw_x, data.raw_y), data.flags);
303 } 307 }
304 308
305 } // namespace ui 309 } // namespace ui
OLDNEW
« no previous file with comments | « no previous file | ui/events/gesture_detection/motion_event_generic.cc » ('j') | ui/events/gestures/motion_event_aura.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698