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)); |
} |