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

Unified Diff: ui/events/gesture_event_details.cc

Issue 1287103004: Sync ui/events to chromium @ https://codereview.chromium.org/1210203002 (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: rebased Created 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/events/gesture_event_details.h ('k') | ui/events/gestures/fling_curve_unittest.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..e14fb17302ab12fd89050b62cd4a6e25c3f5423d 100644
--- a/ui/events/gesture_event_details.cc
+++ b/ui/events/gesture_event_details.cc
@@ -24,30 +24,30 @@ GestureEventDetails::GestureEventDetails(ui::EventType type,
DCHECK_LE(type, ET_GESTURE_TYPE_END);
switch (type_) {
case ui::ET_GESTURE_SCROLL_BEGIN:
- data.scroll_begin.x_hint = delta_x;
- data.scroll_begin.y_hint = delta_y;
+ data_.scroll_begin.x_hint = delta_x;
+ data_.scroll_begin.y_hint = delta_y;
break;
case ui::ET_GESTURE_SCROLL_UPDATE:
- data.scroll_update.x = delta_x;
- data.scroll_update.y = delta_y;
+ data_.scroll_update.x = delta_x;
+ data_.scroll_update.y = delta_y;
break;
case ui::ET_SCROLL_FLING_START:
- data.fling_velocity.x = delta_x;
- data.fling_velocity.y = delta_y;
+ data_.fling_velocity.x = delta_x;
+ data_.fling_velocity.y = delta_y;
break;
case ui::ET_GESTURE_TWO_FINGER_TAP:
- data.first_finger_enclosing_rectangle.width = delta_x;
- data.first_finger_enclosing_rectangle.height = delta_y;
+ data_.first_finger_enclosing_rectangle.width = delta_x;
+ data_.first_finger_enclosing_rectangle.height = delta_y;
break;
case ui::ET_GESTURE_SWIPE:
- data.swipe.left = delta_x < 0;
- data.swipe.right = delta_x > 0;
- data.swipe.up = delta_y < 0;
- data.swipe.down = delta_y > 0;
+ data_.swipe.left = delta_x < 0;
+ data_.swipe.right = delta_x > 0;
+ data_.swipe.up = delta_y < 0;
+ data_.swipe.down = delta_y > 0;
break;
default:
@@ -55,6 +55,33 @@ GestureEventDetails::GestureEventDetails(ui::EventType type,
}
}
+GestureEventDetails::GestureEventDetails(ui::EventType type,
+ const GestureEventDetails& other)
+ : type_(type),
+ data_(other.data_),
+ touch_points_(other.touch_points_),
+ bounding_box_(other.bounding_box_),
+ oldest_touch_id_(other.oldest_touch_id_) {
+ DCHECK_GE(type, ET_GESTURE_TYPE_START);
+ DCHECK_LE(type, ET_GESTURE_TYPE_END);
+ switch (type) {
+ case ui::ET_GESTURE_SCROLL_BEGIN:
+ // Synthetic creation of SCROLL_BEGIN from PINCH_BEGIN is explicitly
+ // allowed as an exception.
+ if (other.type() == ui::ET_GESTURE_PINCH_BEGIN)
+ break;
+ case ui::ET_GESTURE_SCROLL_UPDATE:
+ case ui::ET_SCROLL_FLING_START:
+ case ui::ET_GESTURE_SWIPE:
+ case ui::ET_GESTURE_PINCH_UPDATE:
+ DCHECK_EQ(type, other.type()) << " - Invalid gesture conversion from "
+ << other.type() << " to " << type;
+ break;
+ default:
+ break;
+ }
+}
+
GestureEventDetails::Details::Details() {
memset(this, 0, sizeof(Details));
}
« no previous file with comments | « ui/events/gesture_event_details.h ('k') | ui/events/gestures/fling_curve_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698