| 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> |
| 11 | 11 |
| 12 #include "base/float_util.h" |
| 12 #include "base/strings/string_util.h" | 13 #include "base/strings/string_util.h" |
| 13 #include "content/common/input/web_touch_event_traits.h" | 14 #include "content/common/input/web_touch_event_traits.h" |
| 14 #include "ui/events/event_constants.h" | 15 #include "ui/events/event_constants.h" |
| 15 #include "ui/events/gesture_detection/gesture_event_data.h" | 16 #include "ui/events/gesture_detection/gesture_event_data.h" |
| 16 #include "ui/events/gesture_detection/motion_event.h" | 17 #include "ui/events/gesture_detection/motion_event.h" |
| 17 #include "ui/gfx/geometry/safe_integer_conversions.h" | 18 #include "ui/gfx/geometry/safe_integer_conversions.h" |
| 18 | 19 |
| 19 using blink::WebGestureEvent; | 20 using blink::WebGestureEvent; |
| 20 using blink::WebInputEvent; | 21 using blink::WebInputEvent; |
| 21 using blink::WebTouchEvent; | 22 using blink::WebTouchEvent; |
| (...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 228 // report elliptical touches). | 229 // report elliptical touches). |
| 229 touch.radiusX = minor_radius; | 230 touch.radiusX = minor_radius; |
| 230 touch.radiusY = major_radius; | 231 touch.radiusY = major_radius; |
| 231 touch.rotationAngle = orientation_deg; | 232 touch.rotationAngle = orientation_deg; |
| 232 } else { | 233 } else { |
| 233 touch.radiusX = major_radius; | 234 touch.radiusX = major_radius; |
| 234 touch.radiusY = minor_radius; | 235 touch.radiusY = minor_radius; |
| 235 touch.rotationAngle = orientation_deg + 90; | 236 touch.rotationAngle = orientation_deg + 90; |
| 236 } | 237 } |
| 237 | 238 |
| 239 float tilt = event.GetTilt(pointer_index); |
| 240 touch.tilt = base::IsNaN(tilt) ? |
| 241 std::numeric_limits<float>::quiet_NaN() : (180.f / M_PI * tilt); |
| 242 |
| 243 float tilt_direction = event.GetTiltDirection(pointer_index); |
| 244 touch.tiltDirection = base::IsNaN(tilt_direction) ? |
| 245 std::numeric_limits<float>::quiet_NaN() : (180.f / M_PI * tilt_direction); |
| 246 |
| 238 touch.force = event.GetPressure(pointer_index); | 247 touch.force = event.GetPressure(pointer_index); |
| 239 | 248 |
| 240 return touch; | 249 return touch; |
| 241 } | 250 } |
| 242 | 251 |
| 243 } // namespace | 252 } // namespace |
| 244 | 253 |
| 245 namespace content { | 254 namespace content { |
| 246 | 255 |
| 247 void UpdateWindowsKeyCodeAndKeyIdentifier(blink::WebKeyboardEvent* event, | 256 void UpdateWindowsKeyCodeAndKeyIdentifier(blink::WebKeyboardEvent* event, |
| (...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 457 flags |= ui::EF_CAPS_LOCK_DOWN; | 466 flags |= ui::EF_CAPS_LOCK_DOWN; |
| 458 if (modifiers & blink::WebInputEvent::IsAutoRepeat) | 467 if (modifiers & blink::WebInputEvent::IsAutoRepeat) |
| 459 flags |= ui::EF_IS_REPEAT; | 468 flags |= ui::EF_IS_REPEAT; |
| 460 if (modifiers & blink::WebInputEvent::IsKeyPad) | 469 if (modifiers & blink::WebInputEvent::IsKeyPad) |
| 461 flags |= ui::EF_NUMPAD_KEY; | 470 flags |= ui::EF_NUMPAD_KEY; |
| 462 | 471 |
| 463 return flags; | 472 return flags; |
| 464 } | 473 } |
| 465 | 474 |
| 466 } // namespace content | 475 } // namespace content |
| OLD | NEW |