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: ui/events/gesture_event_details.h

Issue 289373009: Support tap_count in ui::GestureProvider. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Use DCHECK_EQ Created 6 years, 7 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 | Annotate | Revision Log
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 UI_EVENTS_GESTURE_DETECTION_GESTURE_EVENT_DETAILS_H_ 5 #ifndef UI_EVENTS_GESTURE_DETECTION_GESTURE_EVENT_DETAILS_H_
6 #define UI_EVENTS_GESTURE_DETECTION_GESTURE_EVENT_DETAILS_H_ 6 #define UI_EVENTS_GESTURE_DETECTION_GESTURE_EVENT_DETAILS_H_
7 7
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "ui/events/event_constants.h" 9 #include "ui/events/event_constants.h"
10 #include "ui/events/events_base_export.h" 10 #include "ui/events/events_base_export.h"
(...skipping 17 matching lines...) Expand all
28 return ToEnclosingRect(bounding_box_); 28 return ToEnclosingRect(bounding_box_);
29 } 29 }
30 30
31 const gfx::RectF& bounding_box_f() const { 31 const gfx::RectF& bounding_box_f() const {
32 return bounding_box_; 32 return bounding_box_;
33 } 33 }
34 34
35 void set_bounding_box(const gfx::RectF& box) { bounding_box_ = box; } 35 void set_bounding_box(const gfx::RectF& box) { bounding_box_ = box; }
36 36
37 float scroll_x_hint() const { 37 float scroll_x_hint() const {
38 DCHECK_EQ(ui::ET_GESTURE_SCROLL_BEGIN, type_); 38 DCHECK_EQ(ET_GESTURE_SCROLL_BEGIN, type_);
39 return data.scroll_begin.x_hint; 39 return data.scroll_begin.x_hint;
40 } 40 }
41 41
42 float scroll_y_hint() const { 42 float scroll_y_hint() const {
43 DCHECK_EQ(ui::ET_GESTURE_SCROLL_BEGIN, type_); 43 DCHECK_EQ(ET_GESTURE_SCROLL_BEGIN, type_);
44 return data.scroll_begin.y_hint; 44 return data.scroll_begin.y_hint;
45 } 45 }
46 46
47 float scroll_x() const { 47 float scroll_x() const {
48 DCHECK_EQ(ui::ET_GESTURE_SCROLL_UPDATE, type_); 48 DCHECK_EQ(ET_GESTURE_SCROLL_UPDATE, type_);
49 return data.scroll_update.x; 49 return data.scroll_update.x;
50 } 50 }
51 51
52 float scroll_y() const { 52 float scroll_y() const {
53 DCHECK_EQ(ui::ET_GESTURE_SCROLL_UPDATE, type_); 53 DCHECK_EQ(ET_GESTURE_SCROLL_UPDATE, type_);
54 return data.scroll_update.y; 54 return data.scroll_update.y;
55 } 55 }
56 56
57 float velocity_x() const { 57 float velocity_x() const {
58 DCHECK(type_ == ui::ET_SCROLL_FLING_START); 58 DCHECK_EQ(ET_SCROLL_FLING_START, type_);
59 return data.fling_velocity.x; 59 return data.fling_velocity.x;
60 } 60 }
61 61
62 float velocity_y() const { 62 float velocity_y() const {
63 DCHECK(type_ == ui::ET_SCROLL_FLING_START); 63 DCHECK_EQ(ET_SCROLL_FLING_START, type_);
64 return data.fling_velocity.y; 64 return data.fling_velocity.y;
65 } 65 }
66 66
67 float first_finger_width() const { 67 float first_finger_width() const {
68 DCHECK_EQ(ui::ET_GESTURE_TWO_FINGER_TAP, type_); 68 DCHECK_EQ(ET_GESTURE_TWO_FINGER_TAP, type_);
69 return data.first_finger_enclosing_rectangle.width; 69 return data.first_finger_enclosing_rectangle.width;
70 } 70 }
71 71
72 float first_finger_height() const { 72 float first_finger_height() const {
73 DCHECK_EQ(ui::ET_GESTURE_TWO_FINGER_TAP, type_); 73 DCHECK_EQ(ET_GESTURE_TWO_FINGER_TAP, type_);
74 return data.first_finger_enclosing_rectangle.height; 74 return data.first_finger_enclosing_rectangle.height;
75 } 75 }
76 76
77 float scale() const { 77 float scale() const {
78 DCHECK_EQ(ui::ET_GESTURE_PINCH_UPDATE, type_); 78 DCHECK_EQ(ET_GESTURE_PINCH_UPDATE, type_);
79 return data.scale; 79 return data.scale;
80 } 80 }
81 81
82 bool swipe_left() const { 82 bool swipe_left() const {
83 DCHECK_EQ(ui::ET_GESTURE_MULTIFINGER_SWIPE, type_); 83 DCHECK_EQ(ET_GESTURE_MULTIFINGER_SWIPE, type_);
84 return data.swipe.left; 84 return data.swipe.left;
85 } 85 }
86 86
87 bool swipe_right() const { 87 bool swipe_right() const {
88 DCHECK_EQ(ui::ET_GESTURE_MULTIFINGER_SWIPE, type_); 88 DCHECK_EQ(ET_GESTURE_MULTIFINGER_SWIPE, type_);
89 return data.swipe.right; 89 return data.swipe.right;
90 } 90 }
91 91
92 bool swipe_up() const { 92 bool swipe_up() const {
93 DCHECK_EQ(ui::ET_GESTURE_MULTIFINGER_SWIPE, type_); 93 DCHECK_EQ(ET_GESTURE_MULTIFINGER_SWIPE, type_);
94 return data.swipe.up; 94 return data.swipe.up;
95 } 95 }
96 96
97 bool swipe_down() const { 97 bool swipe_down() const {
98 DCHECK_EQ(ui::ET_GESTURE_MULTIFINGER_SWIPE, type_); 98 DCHECK_EQ(ET_GESTURE_MULTIFINGER_SWIPE, type_);
99 return data.swipe.down; 99 return data.swipe.down;
100 } 100 }
101 101
102 int tap_count() const { 102 int tap_count() const {
103 DCHECK(type_ == ui::ET_GESTURE_TAP || 103 DCHECK(type_ == ET_GESTURE_TAP ||
104 type_ == ui::ET_GESTURE_TAP_UNCONFIRMED || 104 type_ == ET_GESTURE_TAP_UNCONFIRMED ||
105 type_ == ET_GESTURE_DOUBLE_TAP); 105 type_ == ET_GESTURE_DOUBLE_TAP);
106 return data.tap_count; 106 return data.tap_count;
107 } 107 }
108 108
109 void set_tap_count(int tap_count) {
110 DCHECK(type_ == ET_GESTURE_TAP ||
111 type_ == ET_GESTURE_TAP_UNCONFIRMED ||
112 type_ == ET_GESTURE_DOUBLE_TAP);
113 data.tap_count = tap_count;
114 }
115
109 private: 116 private:
110 ui::EventType type_; 117 EventType type_;
111 union Details { 118 union Details {
112 Details(); 119 Details();
113 struct { // SCROLL start details. 120 struct { // SCROLL start details.
114 // Distance that caused the scroll to start. Generally redundant with 121 // Distance that caused the scroll to start. Generally redundant with
115 // the x/y values from the first scroll_update. 122 // the x/y values from the first scroll_update.
116 float x_hint; 123 float x_hint;
117 float y_hint; 124 float y_hint;
118 } scroll_begin; 125 } scroll_begin;
119 126
120 struct { // SCROLL delta. 127 struct { // SCROLL delta.
(...skipping 30 matching lines...) Expand all
151 int touch_points_; // Number of active touch points in the gesture. 158 int touch_points_; // Number of active touch points in the gesture.
152 159
153 // Bounding box is an axis-aligned rectangle that contains all the 160 // Bounding box is an axis-aligned rectangle that contains all the
154 // enclosing rectangles of the touch-points in the gesture. 161 // enclosing rectangles of the touch-points in the gesture.
155 gfx::RectF bounding_box_; 162 gfx::RectF bounding_box_;
156 }; 163 };
157 164
158 } // namespace ui 165 } // namespace ui
159 166
160 #endif // UI_EVENTS_GESTURE_DETECTION_GESTURE_EVENT_DETAILS_H_ 167 #endif // UI_EVENTS_GESTURE_DETECTION_GESTURE_EVENT_DETAILS_H_
OLDNEW
« no previous file with comments | « ui/events/gesture_detection/gesture_detector.cc ('k') | ui/events/gestures/gesture_provider_aura.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698