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 "ui/events/gesture_detection/gesture_event_data.h" | 9 #include "ui/events/gesture_detection/gesture_event_data.h" |
9 #include "ui/events/gesture_detection/motion_event.h" | 10 #include "ui/events/gesture_detection/motion_event.h" |
10 | 11 |
11 using blink::WebGestureEvent; | 12 using blink::WebGestureEvent; |
12 using blink::WebInputEvent; | 13 using blink::WebInputEvent; |
13 using blink::WebTouchEvent; | 14 using blink::WebTouchEvent; |
14 using blink::WebTouchPoint; | 15 using blink::WebTouchPoint; |
15 using ui::MotionEvent; | 16 using ui::MotionEvent; |
16 | 17 |
17 namespace { | 18 namespace { |
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
209 sizeof(event->keyIdentifier), | 210 sizeof(event->keyIdentifier), |
210 "U+%04X", | 211 "U+%04X", |
211 base::ToUpperASCII(static_cast<int>(windows_key_code))); | 212 base::ToUpperASCII(static_cast<int>(windows_key_code))); |
212 } | 213 } |
213 } | 214 } |
214 | 215 |
215 blink::WebTouchEvent CreateWebTouchEventFromMotionEvent( | 216 blink::WebTouchEvent CreateWebTouchEventFromMotionEvent( |
216 const ui::MotionEvent& event) { | 217 const ui::MotionEvent& event) { |
217 blink::WebTouchEvent result; | 218 blink::WebTouchEvent result; |
218 | 219 |
219 result.type = ToWebInputEventType(event.GetAction()); | 220 WebTouchEventTraits::ResetType(&result, |
220 DCHECK(WebInputEvent::isTouchEventType(result.type)); | 221 ToWebInputEventType(event.GetAction()), |
jdduke (slow)
2014/04/23 21:55:47
Yeah, could you run "git cl format" on the patch?
Rick Byers
2014/04/23 23:15:35
Done.
| |
221 | 222 (event.GetEventTime() - base::TimeTicks()).InSecondsF(), |
222 result.timeStampSeconds = | 223 WebTouchEventTraits::IGNORE_TOUCHES_STATE); |
223 (event.GetEventTime() - base::TimeTicks()).InSecondsF(); | |
224 | 224 |
225 result.touchesLength = | 225 result.touchesLength = |
226 std::min(event.GetPointerCount(), | 226 std::min(event.GetPointerCount(), |
227 static_cast<size_t>(WebTouchEvent::touchesLengthCap)); | 227 static_cast<size_t>(WebTouchEvent::touchesLengthCap)); |
228 DCHECK_GT(result.touchesLength, 0U); | 228 DCHECK_GT(result.touchesLength, 0U); |
229 | 229 |
230 for (size_t i = 0; i < result.touchesLength; ++i) | 230 for (size_t i = 0; i < result.touchesLength; ++i) |
231 result.touches[i] = CreateWebTouchPoint(event, i); | 231 result.touches[i] = CreateWebTouchPoint(event, i); |
232 | 232 |
233 return result; | 233 return result; |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
324 break; | 324 break; |
325 default: | 325 default: |
326 NOTREACHED() << "ui::EventType provided wasn't a valid gesture event."; | 326 NOTREACHED() << "ui::EventType provided wasn't a valid gesture event."; |
327 break; | 327 break; |
328 } | 328 } |
329 | 329 |
330 return gesture; | 330 return gesture; |
331 } | 331 } |
332 | 332 |
333 } // namespace content | 333 } // namespace content |
OLD | NEW |