Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(10)

Side by Side Diff: third_party/WebKit/public/platform/WebPointerProperties.h

Issue 2227563003: Refactoring button field and its type (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix new instances Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 : button(Button::NoButton)
21 , id(0) 22 , id(0)
22 , force(std::numeric_limits<float>::quiet_NaN()) 23 , force(std::numeric_limits<float>::quiet_NaN())
23 , tiltX(0) 24 , tiltX(0)
24 , tiltY(0) 25 , tiltY(0)
25 , pointerType(PointerType::Unknown) 26 , pointerType(PointerType::Unknown)
26 { 27 {
27 } 28 }
28 29
29 enum Button { 30 enum class Button : std::int8_t {
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 : std::int8_t {
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 Button button;
45 46
46 int id; 47 int id;
47 48
48 // The valid range is [0,1], with NaN meaning pressure is not supported by 49 // The valid range is [0,1], with NaN meaning pressure is not supported by
49 // the input device. 50 // the input device.
50 float force; 51 float force;
51 52
52 // Tilt of a pen stylus from surface normal as plane angles in degrees, 53 // 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 54 // Values lie in [-90,90]. A positive tiltX is to the right and a positive
54 // tiltY is towards the user. 55 // tiltY is towards the user.
55 int tiltX; 56 int tiltX;
56 int tiltY; 57 int tiltY;
57 58
58 PointerType pointerType; 59 PointerType pointerType;
59 }; 60 };
60 61
61 } // namespace blink 62 } // namespace blink
62 63
63 #endif 64 #endif
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/web/tests/WebViewTest.cpp ('k') | third_party/WebKit/public/platform/WebScrollbarBehavior.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698