| OLD | NEW |
| 1 // Copyright (c) 2015 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2015 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 #ifndef WebPointerProperties_h | 5 #ifndef WebPointerProperties_h |
| 6 #define WebPointerProperties_h | 6 #define WebPointerProperties_h |
| 7 | 7 |
| 8 #include <cstdint> |
| 8 #include <limits> | 9 #include <limits> |
| 9 | 10 |
| 10 namespace blink { | 11 namespace blink { |
| 11 | 12 |
| 12 // This class encapsulates the properties that are common between mouse and | 13 // This class encapsulates the properties that are common between mouse and |
| 13 // pointer events and touch points as we transition towards the unified pointer | 14 // pointer events and touch points as we transition towards the unified pointer |
| 14 // event model. | 15 // event model. |
| 15 // TODO(e_hakkinen): Replace WebTouchEvent with WebPointerEvent, remove | 16 // TODO(e_hakkinen): Replace WebTouchEvent with WebPointerEvent, remove |
| 16 // WebTouchEvent and WebTouchPoint and merge this into WebPointerEvent. | 17 // WebTouchEvent and WebTouchPoint and merge this into WebPointerEvent. |
| 17 class WebPointerProperties { | 18 class WebPointerProperties { |
| 18 public: | 19 public: |
| 19 WebPointerProperties() | 20 WebPointerProperties() |
| 20 : button(ButtonNone) | 21 : id(0) |
| 21 , id(0) | |
| 22 , force(std::numeric_limits<float>::quiet_NaN()) | 22 , force(std::numeric_limits<float>::quiet_NaN()) |
| 23 , tiltX(0) | 23 , tiltX(0) |
| 24 , tiltY(0) | 24 , tiltY(0) |
| 25 , button(Button::NoButton) |
| 25 , pointerType(PointerType::Unknown) | 26 , pointerType(PointerType::Unknown) |
| 26 { | 27 { |
| 27 } | 28 } |
| 28 | 29 |
| 29 enum Button { | 30 enum class Button { |
| 30 ButtonNone = -1, | 31 NoButton = -1, |
| 31 ButtonLeft, | 32 Left, |
| 32 ButtonMiddle, | 33 Middle, |
| 33 ButtonRight | 34 Right |
| 34 }; | 35 }; |
| 35 | 36 |
| 36 enum class PointerType : int { | 37 enum class PointerType { |
| 37 Unknown, | 38 Unknown, |
| 38 Mouse, | 39 Mouse, |
| 39 Pen, | 40 Pen, |
| 40 Touch, | 41 Touch, |
| 41 LastEntry = Touch // Must be the last entry in the list | 42 LastEntry = Touch // Must be the last entry in the list |
| 42 }; | 43 }; |
| 43 | 44 |
| 44 Button button; | |
| 45 | |
| 46 int id; | 45 int id; |
| 47 | 46 |
| 48 // The valid range is [0,1], with NaN meaning pressure is not supported by | 47 // The valid range is [0,1], with NaN meaning pressure is not supported by |
| 49 // the input device. | 48 // the input device. |
| 50 float force; | 49 float force; |
| 51 | 50 |
| 52 // Tilt of a pen stylus from surface normal as plane angles in degrees, | 51 // Tilt of a pen stylus from surface normal as plane angles in degrees, |
| 53 // Values lie in [-90,90]. A positive tiltX is to the right and a positive | 52 // Values lie in [-90,90]. A positive tiltX is to the right and a positive |
| 54 // tiltY is towards the user. | 53 // tiltY is towards the user. |
| 55 int tiltX; | 54 int tiltX; |
| 56 int tiltY; | 55 int tiltY; |
| 57 | 56 |
| 57 Button button; |
| 58 PointerType pointerType; | 58 PointerType pointerType; |
| 59 }; | 59 }; |
| 60 | 60 |
| 61 } // namespace blink | 61 } // namespace blink |
| 62 | 62 |
| 63 #endif | 63 #endif |
| OLD | NEW |