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

Side by Side Diff: content/browser/renderer_host/ui_events_helper.cc

Issue 1260453006: ui: events: Add a class to hold common touch and stylus properties (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address build problems, add accessor and unit tests. Created 5 years, 4 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 #include "content/browser/renderer_host/ui_events_helper.h" 5 #include "content/browser/renderer_host/ui_events_helper.h"
6 6
7 #include "content/browser/renderer_host/input/web_input_event_util.h" 7 #include "content/browser/renderer_host/input/web_input_event_util.h"
8 #include "content/common/input/web_touch_event_traits.h" 8 #include "content/common/input/web_touch_event_traits.h"
9 #include "third_party/WebKit/public/web/WebInputEvent.h" 9 #include "third_party/WebKit/public/web/WebInputEvent.h"
10 #include "ui/events/blink/blink_event_util.h" 10 #include "ui/events/blink/blink_event_util.h"
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 for (unsigned i = 0; i < touch.touchesLength; ++i) { 67 for (unsigned i = 0; i < touch.touchesLength; ++i) {
68 const blink::WebTouchPoint& point = touch.touches[i]; 68 const blink::WebTouchPoint& point = touch.touches[i];
69 if (WebTouchPointStateToEventType(point.state) != type) 69 if (WebTouchPointStateToEventType(point.state) != type)
70 continue; 70 continue;
71 // ui events start in the co-ordinate space of the EventDispatcher. 71 // ui events start in the co-ordinate space of the EventDispatcher.
72 gfx::PointF location; 72 gfx::PointF location;
73 if (coordinate_system == LOCAL_COORDINATES) 73 if (coordinate_system == LOCAL_COORDINATES)
74 location = point.position; 74 location = point.position;
75 else 75 else
76 location = point.screenPosition; 76 location = point.screenPosition;
77 ui::TouchEvent* uievent = new ui::TouchEvent(type, 77 ui::TouchEvent* uievent = new ui::TouchEvent(
78 location, 78 type, location, flags, point.id, timestamp, point.rotationAngle,
79 flags, 79 ui::PointerEventDetails(ui::EventPointerType::POINTER_TYPE_TOUCH,
80 point.id, 80 point.radiusX, point.radiusY, point.force,
81 timestamp, 81 /* tilt_x */ 0.0f,
82 point.radiusX, 82 /* tilt_y */ 0.0f));
83 point.radiusY,
84 point.rotationAngle,
85 point.force);
86 uievent->set_latency(touch_with_latency.latency); 83 uievent->set_latency(touch_with_latency.latency);
87 list->push_back(uievent); 84 list->push_back(uievent);
88 } 85 }
89 return true; 86 return true;
90 } 87 }
91 88
92 blink::WebGestureEvent MakeWebGestureEventFromUIEvent( 89 blink::WebGestureEvent MakeWebGestureEventFromUIEvent(
93 const ui::GestureEvent& event) { 90 const ui::GestureEvent& event) {
94 return ui::CreateWebGestureEvent(event.details(), event.time_stamp(), 91 return ui::CreateWebGestureEvent(event.details(), event.time_stamp(),
95 event.location_f(), event.root_location_f(), 92 event.location_f(), event.root_location_f(),
96 event.flags()); 93 event.flags());
97 } 94 }
98 95
99 } // namespace content 96 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698