| OLD | NEW |
| 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 #include "ui/events/gesture_event_details.h" | 5 #include "ui/events/gesture_event_details.h" |
| 6 | 6 |
| 7 namespace ui { | 7 namespace ui { |
| 8 | 8 |
| 9 GestureEventDetails::GestureEventDetails() | 9 GestureEventDetails::GestureEventDetails() |
| 10 : type_(ET_UNKNOWN), | 10 : type_(ET_UNKNOWN), |
| 11 device_type_(GestureDeviceType::DEVICE_UNKNOWN), | 11 device_type_(GestureDeviceType::DEVICE_UNKNOWN), |
| 12 touch_points_(0) {} | 12 touch_points_(0) {} |
| 13 | 13 |
| 14 GestureEventDetails::GestureEventDetails(ui::EventType type) | 14 GestureEventDetails::GestureEventDetails(ui::EventType type) |
| 15 : type_(type), | 15 : type_(type), |
| 16 device_type_(GestureDeviceType::DEVICE_UNKNOWN), | 16 device_type_(GestureDeviceType::DEVICE_UNKNOWN), |
| 17 touch_points_(1) { | 17 touch_points_(1) { |
| 18 DCHECK_GE(type, ET_GESTURE_TYPE_START); | 18 DCHECK_GE(type, ET_GESTURE_TYPE_START); |
| 19 DCHECK_LE(type, ET_GESTURE_TYPE_END); | 19 DCHECK_LE(type, ET_GESTURE_TYPE_END); |
| 20 } | 20 } |
| 21 | 21 |
| 22 GestureEventDetails::GestureEventDetails(ui::EventType type, | 22 GestureEventDetails::GestureEventDetails(ui::EventType type, |
| 23 float delta_x, | 23 float delta_x, |
| 24 float delta_y) | 24 float delta_y, |
| 25 ScrollUnits units) |
| 25 : type_(type), | 26 : type_(type), |
| 26 device_type_(GestureDeviceType::DEVICE_UNKNOWN), | 27 device_type_(GestureDeviceType::DEVICE_UNKNOWN), |
| 27 touch_points_(1) { | 28 touch_points_(1) { |
| 28 DCHECK_GE(type, ET_GESTURE_TYPE_START); | 29 DCHECK_GE(type, ET_GESTURE_TYPE_START); |
| 29 DCHECK_LE(type, ET_GESTURE_TYPE_END); | 30 DCHECK_LE(type, ET_GESTURE_TYPE_END); |
| 30 switch (type_) { | 31 switch (type_) { |
| 31 case ui::ET_GESTURE_SCROLL_BEGIN: | 32 case ui::ET_GESTURE_SCROLL_BEGIN: |
| 32 data_.scroll_begin.x_hint = delta_x; | 33 data_.scroll_begin.x_hint = delta_x; |
| 33 data_.scroll_begin.y_hint = delta_y; | 34 data_.scroll_begin.y_hint = delta_y; |
| 35 data_.scroll_begin.delta_hint_units = units; |
| 34 break; | 36 break; |
| 35 | 37 |
| 36 case ui::ET_GESTURE_SCROLL_UPDATE: | 38 case ui::ET_GESTURE_SCROLL_UPDATE: |
| 37 data_.scroll_update.x = delta_x; | 39 data_.scroll_update.x = delta_x; |
| 38 data_.scroll_update.y = delta_y; | 40 data_.scroll_update.y = delta_y; |
| 41 data_.scroll_update.delta_units = units; |
| 39 break; | 42 break; |
| 40 | 43 |
| 41 case ui::ET_SCROLL_FLING_START: | 44 case ui::ET_SCROLL_FLING_START: |
| 42 data_.fling_velocity.x = delta_x; | 45 data_.fling_velocity.x = delta_x; |
| 43 data_.fling_velocity.y = delta_y; | 46 data_.fling_velocity.y = delta_y; |
| 44 break; | 47 break; |
| 45 | 48 |
| 46 case ui::ET_GESTURE_TWO_FINGER_TAP: | 49 case ui::ET_GESTURE_TWO_FINGER_TAP: |
| 47 data_.first_finger_enclosing_rectangle.width = delta_x; | 50 data_.first_finger_enclosing_rectangle.width = delta_x; |
| 48 data_.first_finger_enclosing_rectangle.height = delta_y; | 51 data_.first_finger_enclosing_rectangle.height = delta_y; |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 default: | 88 default: |
| 86 break; | 89 break; |
| 87 } | 90 } |
| 88 } | 91 } |
| 89 | 92 |
| 90 GestureEventDetails::Details::Details() { | 93 GestureEventDetails::Details::Details() { |
| 91 memset(this, 0, sizeof(Details)); | 94 memset(this, 0, sizeof(Details)); |
| 92 } | 95 } |
| 93 | 96 |
| 94 } // namespace ui | 97 } // namespace ui |
| OLD | NEW |