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

Unified Diff: ui/events/gesture_event_details.cc

Issue 572593002: Revert of Clean up GestureEventDetails constructors (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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
« no previous file with comments | « ui/events/gesture_event_details.h ('k') | ui/events/test/event_generator.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/events/gesture_event_details.cc
diff --git a/ui/events/gesture_event_details.cc b/ui/events/gesture_event_details.cc
index 780713118d348dfdd4e31814ae97b24385f818c6..3f478e5aaabce15848e5b1fe6f733e689ad9e994 100644
--- a/ui/events/gesture_event_details.cc
+++ b/ui/events/gesture_event_details.cc
@@ -10,16 +10,10 @@
: 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_(-1) {
+ : type_(type), touch_points_(1), oldest_touch_id_(0) {
DCHECK_GE(type, ET_GESTURE_TYPE_START);
DCHECK_LE(type, ET_GESTURE_TYPE_END);
switch (type_) {
@@ -43,6 +37,11 @@
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;
@@ -50,8 +49,19 @@
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:
- NOTREACHED() << "Invalid event type for constructor: " << type;
+ if (delta_x != 0.f || delta_y != 0.f) {
+ DLOG(WARNING) << "A gesture event (" << type << ") had unknown data: ("
+ << delta_x << "," << delta_y;
+ }
+ break;
}
}
« no previous file with comments | « ui/events/gesture_event_details.h ('k') | ui/events/test/event_generator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698