| 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 "ui/events/gesture_detection/gesture_event_data.h" | 8 #include "ui/events/gesture_detection/gesture_event_data.h" |
| 9 #include "ui/events/gesture_detection/motion_event.h" | 9 #include "ui/events/gesture_detection/motion_event.h" |
| 10 | 10 |
| (...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 211 base::ToUpperASCII(static_cast<int>(windows_key_code))); | 211 base::ToUpperASCII(static_cast<int>(windows_key_code))); |
| 212 } | 212 } |
| 213 } | 213 } |
| 214 | 214 |
| 215 blink::WebTouchEvent CreateWebTouchEventFromMotionEvent( | 215 blink::WebTouchEvent CreateWebTouchEventFromMotionEvent( |
| 216 const ui::MotionEvent& event) { | 216 const ui::MotionEvent& event) { |
| 217 blink::WebTouchEvent result; | 217 blink::WebTouchEvent result; |
| 218 | 218 |
| 219 result.type = ToWebInputEventType(event.GetAction()); | 219 result.type = ToWebInputEventType(event.GetAction()); |
| 220 DCHECK(WebInputEvent::isTouchEventType(result.type)); | 220 DCHECK(WebInputEvent::isTouchEventType(result.type)); |
| 221 if (result.type == WebInputEvent::TouchCancel) |
| 222 result.cancelable = false; |
| 221 | 223 |
| 222 result.timeStampSeconds = | 224 result.timeStampSeconds = |
| 223 (event.GetEventTime() - base::TimeTicks()).InSecondsF(); | 225 (event.GetEventTime() - base::TimeTicks()).InSecondsF(); |
| 224 | 226 |
| 225 result.touchesLength = | 227 result.touchesLength = |
| 226 std::min(event.GetPointerCount(), | 228 std::min(event.GetPointerCount(), |
| 227 static_cast<size_t>(WebTouchEvent::touchesLengthCap)); | 229 static_cast<size_t>(WebTouchEvent::touchesLengthCap)); |
| 228 DCHECK_GT(result.touchesLength, 0U); | 230 DCHECK_GT(result.touchesLength, 0U); |
| 229 | 231 |
| 230 for (size_t i = 0; i < result.touchesLength; ++i) | 232 for (size_t i = 0; i < result.touchesLength; ++i) |
| (...skipping 93 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 |