Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/input/web_input_event_util.h" | 5 #include "content/browser/renderer_host/input/web_input_event_util.h" |
| 6 | 6 |
| 7 #include "base/strings/string_util.h" | 7 #include "base/strings/string_util.h" |
| 8 #include "content/common/input/web_touch_event_traits.h" | 8 #include "content/common/input/web_touch_event_traits.h" |
| 9 #include "ui/events/gesture_detection/gesture_event_data.h" | 9 #include "ui/events/gesture_detection/gesture_event_data.h" |
| 10 #include "ui/events/gesture_detection/motion_event.h" | 10 #include "ui/events/gesture_detection/motion_event.h" |
| (...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 231 result.touches[i] = CreateWebTouchPoint(event, i); | 231 result.touches[i] = CreateWebTouchPoint(event, i); |
| 232 | 232 |
| 233 return result; | 233 return result; |
| 234 } | 234 } |
| 235 | 235 |
| 236 WebGestureEvent CreateWebGestureEventFromGestureEventData( | 236 WebGestureEvent CreateWebGestureEventFromGestureEventData( |
| 237 const ui::GestureEventData& data) { | 237 const ui::GestureEventData& data) { |
| 238 WebGestureEvent gesture; | 238 WebGestureEvent gesture; |
| 239 gesture.x = data.x; | 239 gesture.x = data.x; |
| 240 gesture.y = data.y; | 240 gesture.y = data.y; |
| 241 gesture.globalX = data.raw_x; | |
| 242 gesture.globalY = data.raw_y; | |
|
tdresser
2014/06/19 21:12:37
The ui::GestureEvent |root_location| should be pas
jdduke (slow)
2014/06/19 21:43:34
Looks like we already populate that value: https:/
| |
| 241 gesture.timeStampSeconds = (data.time - base::TimeTicks()).InSecondsF(); | 243 gesture.timeStampSeconds = (data.time - base::TimeTicks()).InSecondsF(); |
| 242 gesture.sourceDevice = blink::WebGestureDeviceTouchscreen; | 244 gesture.sourceDevice = blink::WebGestureDeviceTouchscreen; |
| 243 | 245 |
| 244 switch (data.type()) { | 246 switch (data.type()) { |
| 245 case ui::ET_GESTURE_SHOW_PRESS: | 247 case ui::ET_GESTURE_SHOW_PRESS: |
| 246 gesture.type = WebInputEvent::GestureShowPress; | 248 gesture.type = WebInputEvent::GestureShowPress; |
| 247 gesture.data.showPress.width = data.details.bounding_box_f().width(); | 249 gesture.data.showPress.width = data.details.bounding_box_f().width(); |
| 248 gesture.data.showPress.height = data.details.bounding_box_f().height(); | 250 gesture.data.showPress.height = data.details.bounding_box_f().height(); |
| 249 break; | 251 break; |
| 250 case ui::ET_GESTURE_DOUBLE_TAP: | 252 case ui::ET_GESTURE_DOUBLE_TAP: |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 324 break; | 326 break; |
| 325 default: | 327 default: |
| 326 NOTREACHED() << "ui::EventType provided wasn't a valid gesture event."; | 328 NOTREACHED() << "ui::EventType provided wasn't a valid gesture event."; |
| 327 break; | 329 break; |
| 328 } | 330 } |
| 329 | 331 |
| 330 return gesture; | 332 return gesture; |
| 331 } | 333 } |
| 332 | 334 |
| 333 } // namespace content | 335 } // namespace content |
| OLD | NEW |