| 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 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 248 base::strlcpy(event->keyIdentifier, id, sizeof(event->keyIdentifier) - 1); | 248 base::strlcpy(event->keyIdentifier, id, sizeof(event->keyIdentifier) - 1); |
| 249 } else { | 249 } else { |
| 250 base::snprintf(event->keyIdentifier, | 250 base::snprintf(event->keyIdentifier, |
| 251 sizeof(event->keyIdentifier), | 251 sizeof(event->keyIdentifier), |
| 252 "U+%04X", | 252 "U+%04X", |
| 253 base::ToUpperASCII(static_cast<int>(windows_key_code))); | 253 base::ToUpperASCII(static_cast<int>(windows_key_code))); |
| 254 } | 254 } |
| 255 } | 255 } |
| 256 | 256 |
| 257 blink::WebTouchEvent CreateWebTouchEventFromMotionEvent( | 257 blink::WebTouchEvent CreateWebTouchEventFromMotionEvent( |
| 258 const ui::MotionEvent& event) { | 258 const ui::MotionEvent& event, |
| 259 bool may_cause_scrolling) { |
| 259 COMPILE_ASSERT(static_cast<int>(MotionEvent::MAX_TOUCH_POINT_COUNT) == | 260 COMPILE_ASSERT(static_cast<int>(MotionEvent::MAX_TOUCH_POINT_COUNT) == |
| 260 static_cast<int>(blink::WebTouchEvent::touchesLengthCap), | 261 static_cast<int>(blink::WebTouchEvent::touchesLengthCap), |
| 261 inconsistent_maximum_number_of_active_touch_points); | 262 inconsistent_maximum_number_of_active_touch_points); |
| 262 | 263 |
| 263 blink::WebTouchEvent result; | 264 blink::WebTouchEvent result; |
| 264 | 265 |
| 265 WebTouchEventTraits::ResetType( | 266 WebTouchEventTraits::ResetType( |
| 266 ToWebInputEventType(event.GetAction()), | 267 ToWebInputEventType(event.GetAction()), |
| 267 (event.GetEventTime() - base::TimeTicks()).InSecondsF(), | 268 (event.GetEventTime() - base::TimeTicks()).InSecondsF(), |
| 268 &result); | 269 &result); |
| 270 result.defaultActionMayCauseScrolling = may_cause_scrolling; |
| 269 | 271 |
| 270 result.modifiers = EventFlagsToWebEventModifiers(event.GetFlags()); | 272 result.modifiers = EventFlagsToWebEventModifiers(event.GetFlags()); |
| 271 result.touchesLength = | 273 result.touchesLength = |
| 272 std::min(event.GetPointerCount(), | 274 std::min(event.GetPointerCount(), |
| 273 static_cast<size_t>(WebTouchEvent::touchesLengthCap)); | 275 static_cast<size_t>(WebTouchEvent::touchesLengthCap)); |
| 274 DCHECK_GT(result.touchesLength, 0U); | 276 DCHECK_GT(result.touchesLength, 0U); |
| 275 | 277 |
| 276 for (size_t i = 0; i < result.touchesLength; ++i) | 278 for (size_t i = 0; i < result.touchesLength; ++i) |
| 277 result.touches[i] = CreateWebTouchPoint(event, i); | 279 result.touches[i] = CreateWebTouchPoint(event, i); |
| 278 | 280 |
| (...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 429 flags |= ui::EF_CAPS_LOCK_DOWN; | 431 flags |= ui::EF_CAPS_LOCK_DOWN; |
| 430 if (modifiers & blink::WebInputEvent::IsAutoRepeat) | 432 if (modifiers & blink::WebInputEvent::IsAutoRepeat) |
| 431 flags |= ui::EF_IS_REPEAT; | 433 flags |= ui::EF_IS_REPEAT; |
| 432 if (modifiers & blink::WebInputEvent::IsKeyPad) | 434 if (modifiers & blink::WebInputEvent::IsKeyPad) |
| 433 flags |= ui::EF_NUMPAD_KEY; | 435 flags |= ui::EF_NUMPAD_KEY; |
| 434 | 436 |
| 435 return flags; | 437 return flags; |
| 436 } | 438 } |
| 437 | 439 |
| 438 } // namespace content | 440 } // namespace content |
| OLD | NEW |