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 // MSVC++ requires this to be set before any other includes to get M_PI. | 5 // MSVC++ requires this to be set before any other includes to get M_PI. |
6 #define _USE_MATH_DEFINES | 6 #define _USE_MATH_DEFINES |
7 | 7 |
8 #include "content/browser/renderer_host/input/web_input_event_util.h" | 8 #include "content/browser/renderer_host/input/web_input_event_util.h" |
9 | 9 |
10 #include <cmath> | 10 #include <cmath> |
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
249 base::strlcpy(event->keyIdentifier, id, sizeof(event->keyIdentifier) - 1); | 249 base::strlcpy(event->keyIdentifier, id, sizeof(event->keyIdentifier) - 1); |
250 } else { | 250 } else { |
251 base::snprintf(event->keyIdentifier, | 251 base::snprintf(event->keyIdentifier, |
252 sizeof(event->keyIdentifier), | 252 sizeof(event->keyIdentifier), |
253 "U+%04X", | 253 "U+%04X", |
254 base::ToUpperASCII(static_cast<int>(windows_key_code))); | 254 base::ToUpperASCII(static_cast<int>(windows_key_code))); |
255 } | 255 } |
256 } | 256 } |
257 | 257 |
258 blink::WebTouchEvent CreateWebTouchEventFromMotionEvent( | 258 blink::WebTouchEvent CreateWebTouchEventFromMotionEvent( |
259 const ui::MotionEvent& event) { | 259 const ui::MotionEvent& event, |
| 260 bool may_cause_scrolling) { |
260 COMPILE_ASSERT(static_cast<int>(MotionEvent::MAX_TOUCH_POINT_COUNT) == | 261 COMPILE_ASSERT(static_cast<int>(MotionEvent::MAX_TOUCH_POINT_COUNT) == |
261 static_cast<int>(blink::WebTouchEvent::touchesLengthCap), | 262 static_cast<int>(blink::WebTouchEvent::touchesLengthCap), |
262 inconsistent_maximum_number_of_active_touch_points); | 263 inconsistent_maximum_number_of_active_touch_points); |
263 | 264 |
264 blink::WebTouchEvent result; | 265 blink::WebTouchEvent result; |
265 | 266 |
266 WebTouchEventTraits::ResetType( | 267 WebTouchEventTraits::ResetType( |
267 ToWebInputEventType(event.GetAction()), | 268 ToWebInputEventType(event.GetAction()), |
268 (event.GetEventTime() - base::TimeTicks()).InSecondsF(), | 269 (event.GetEventTime() - base::TimeTicks()).InSecondsF(), |
269 &result); | 270 &result); |
| 271 result.causesScrollingIfUncanceled = may_cause_scrolling; |
270 | 272 |
271 result.modifiers = EventFlagsToWebEventModifiers(event.GetFlags()); | 273 result.modifiers = EventFlagsToWebEventModifiers(event.GetFlags()); |
272 result.touchesLength = | 274 result.touchesLength = |
273 std::min(event.GetPointerCount(), | 275 std::min(event.GetPointerCount(), |
274 static_cast<size_t>(WebTouchEvent::touchesLengthCap)); | 276 static_cast<size_t>(WebTouchEvent::touchesLengthCap)); |
275 DCHECK_GT(result.touchesLength, 0U); | 277 DCHECK_GT(result.touchesLength, 0U); |
276 | 278 |
277 for (size_t i = 0; i < result.touchesLength; ++i) | 279 for (size_t i = 0; i < result.touchesLength; ++i) |
278 result.touches[i] = CreateWebTouchPoint(event, i); | 280 result.touches[i] = CreateWebTouchPoint(event, i); |
279 | 281 |
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
451 flags |= ui::EF_CAPS_LOCK_DOWN; | 453 flags |= ui::EF_CAPS_LOCK_DOWN; |
452 if (modifiers & blink::WebInputEvent::IsAutoRepeat) | 454 if (modifiers & blink::WebInputEvent::IsAutoRepeat) |
453 flags |= ui::EF_IS_REPEAT; | 455 flags |= ui::EF_IS_REPEAT; |
454 if (modifiers & blink::WebInputEvent::IsKeyPad) | 456 if (modifiers & blink::WebInputEvent::IsKeyPad) |
455 flags |= ui::EF_NUMPAD_KEY; | 457 flags |= ui::EF_NUMPAD_KEY; |
456 | 458 |
457 return flags; | 459 return flags; |
458 } | 460 } |
459 | 461 |
460 } // namespace content | 462 } // namespace content |
OLD | NEW |