OLD | NEW |
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 "third_party/WebKit/public/web/WebInputEvent.h" | 7 #include "third_party/WebKit/public/web/WebInputEvent.h" |
8 #include "ui/events/event.h" | 8 #include "ui/events/event.h" |
9 #include "ui/events/event_constants.h" | 9 #include "ui/events/event_constants.h" |
10 | 10 |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
114 } | 114 } |
115 | 115 |
116 int flags = WebModifiersToUIFlags(touch.modifiers); | 116 int flags = WebModifiersToUIFlags(touch.modifiers); |
117 base::TimeDelta timestamp = base::TimeDelta::FromMicroseconds( | 117 base::TimeDelta timestamp = base::TimeDelta::FromMicroseconds( |
118 static_cast<int64>(touch.timeStampSeconds * 1000000)); | 118 static_cast<int64>(touch.timeStampSeconds * 1000000)); |
119 for (unsigned i = 0; i < touch.touchesLength; ++i) { | 119 for (unsigned i = 0; i < touch.touchesLength; ++i) { |
120 const blink::WebTouchPoint& point = touch.touches[i]; | 120 const blink::WebTouchPoint& point = touch.touches[i]; |
121 if (WebTouchPointStateToEventType(point.state) != type) | 121 if (WebTouchPointStateToEventType(point.state) != type) |
122 continue; | 122 continue; |
123 // ui events start in the co-ordinate space of the EventDispatcher. | 123 // ui events start in the co-ordinate space of the EventDispatcher. |
124 gfx::Point location; | 124 gfx::PointF location; |
125 if (coordinate_system == LOCAL_COORDINATES) | 125 if (coordinate_system == LOCAL_COORDINATES) |
126 location = gfx::Point(point.position.x, point.position.y); | 126 location = point.position; |
127 else | 127 else |
128 location = gfx::Point(point.screenPosition.x, point.screenPosition.y); | 128 location = point.screenPosition; |
129 ui::TouchEvent* uievent = new ui::TouchEvent(type, | 129 ui::TouchEvent* uievent = new ui::TouchEvent(type, |
130 location, | 130 location, |
131 flags, | 131 flags, |
132 point.id, | 132 point.id, |
133 timestamp, | 133 timestamp, |
134 point.radiusX, | 134 point.radiusX, |
135 point.radiusY, | 135 point.radiusY, |
136 point.rotationAngle, | 136 point.rotationAngle, |
137 point.force); | 137 point.force); |
138 uievent->set_latency(touch_with_latency.latency); | 138 uievent->set_latency(touch_with_latency.latency); |
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
326 | 326 |
327 // Update the type of the touch event. | 327 // Update the type of the touch event. |
328 web_event->type = TouchEventTypeFromEvent(event); | 328 web_event->type = TouchEventTypeFromEvent(event); |
329 web_event->timeStampSeconds = event.time_stamp().InSecondsF(); | 329 web_event->timeStampSeconds = event.time_stamp().InSecondsF(); |
330 web_event->modifiers = EventFlagsToWebEventModifiers(event.flags()); | 330 web_event->modifiers = EventFlagsToWebEventModifiers(event.flags()); |
331 | 331 |
332 return point; | 332 return point; |
333 } | 333 } |
334 | 334 |
335 } // namespace content | 335 } // namespace content |
OLD | NEW |