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

Unified Diff: ui/events/gesture_event_details.cc

Issue 565583005: Clean up GestureEventDetails constructors (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Alwasy set oldest_touch_id_ to -1 in the constructor Created 6 years, 3 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 side-by-side diff with in-line comments
Download patch
Index: ui/events/gesture_event_details.cc
diff --git a/ui/events/gesture_event_details.cc b/ui/events/gesture_event_details.cc
index 3f478e5aaabce15848e5b1fe6f733e689ad9e994..cfce0781eae61c1edc1cd209fd2aa9b70eb7d63d 100644
--- a/ui/events/gesture_event_details.cc
+++ b/ui/events/gesture_event_details.cc
@@ -10,10 +10,16 @@ GestureEventDetails::GestureEventDetails()
: type_(ET_UNKNOWN), touch_points_(0), oldest_touch_id_(-1) {
}
+GestureEventDetails::GestureEventDetails(ui::EventType type)
+ : type_(type), touch_points_(1), oldest_touch_id_(-1) {
+ DCHECK_GE(type, ET_GESTURE_TYPE_START);
+ DCHECK_LE(type, ET_GESTURE_TYPE_END);
+}
+
GestureEventDetails::GestureEventDetails(ui::EventType type,
float delta_x,
float delta_y)
- : type_(type), touch_points_(1), oldest_touch_id_(0) {
+ : type_(type), touch_points_(1), oldest_touch_id_(-1) {
DCHECK_GE(type, ET_GESTURE_TYPE_START);
DCHECK_LE(type, ET_GESTURE_TYPE_END);
switch (type_) {
@@ -37,11 +43,6 @@ GestureEventDetails::GestureEventDetails(ui::EventType type,
data.first_finger_enclosing_rectangle.height = delta_y;
break;
- case ui::ET_GESTURE_PINCH_UPDATE:
- data.scale = delta_x;
- CHECK_EQ(0.f, delta_y) << "Unknown data in delta_y for pinch";
- break;
-
case ui::ET_GESTURE_SWIPE:
data.swipe.left = delta_x < 0;
data.swipe.right = delta_x > 0;
@@ -49,19 +50,8 @@ GestureEventDetails::GestureEventDetails(ui::EventType type,
data.swipe.down = delta_y > 0;
break;
- case ui::ET_GESTURE_TAP:
- case ui::ET_GESTURE_DOUBLE_TAP:
- case ui::ET_GESTURE_TAP_UNCONFIRMED:
- data.tap_count = static_cast<int>(delta_x);
- CHECK_EQ(0.f, delta_y) << "Unknown data in delta_y for tap.";
- break;
-
default:
- if (delta_x != 0.f || delta_y != 0.f) {
- DLOG(WARNING) << "A gesture event (" << type << ") had unknown data: ("
- << delta_x << "," << delta_y;
- }
- break;
+ NOTREACHED();
jdduke (slow) 2014/09/12 15:02:04 It may be worth logging the type here, i.e., NOT
lanwei 2014/09/14 02:46:27 There is no public string converter function for E
}
}

Powered by Google App Engine
This is Rietveld 408576698