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_detection/gesture_event_data.h" | 5 #include "ui/events/gesture_detection/gesture_event_data.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 | 8 |
9 namespace ui { | 9 namespace ui { |
10 | 10 |
11 GestureEventData::GestureEventData(EventType type, | 11 GestureEventData::GestureEventData(const GestureEventDetails& details, |
12 int motion_event_id, | 12 int motion_event_id, |
13 base::TimeTicks time, | 13 base::TimeTicks time, |
14 float x, | 14 float x, |
15 float y, | 15 float y, |
16 int touch_point_count, | 16 int touch_point_count, |
17 const gfx::RectF& bounding_box, | 17 const gfx::RectF& bounding_box) |
18 const GestureEventDetails& details) | 18 : details(details), |
19 : type(type), | |
20 motion_event_id(motion_event_id), | 19 motion_event_id(motion_event_id), |
21 time(time), | 20 time(time), |
22 x(x), | 21 x(x), |
23 y(y), | 22 y(y) { |
24 details(details) { | |
25 DCHECK_GE(motion_event_id, 0); | 23 DCHECK_GE(motion_event_id, 0); |
26 DCHECK_NE(0, touch_point_count); | 24 DCHECK_NE(0, touch_point_count); |
27 DCHECK_GE(type, ET_GESTURE_TYPE_START); | 25 DCHECK_GE(details.type(), ET_GESTURE_TYPE_START); |
28 DCHECK_LE(type, ET_GESTURE_TYPE_END); | 26 DCHECK_LE(details.type(), ET_GESTURE_TYPE_END); |
tdresser
2014/06/09 13:36:37
We could move these DCHECKs to the GestureEventDet
jdduke (slow)
2014/06/09 15:40:57
Totally, done.
| |
29 DCHECK_EQ(type, details.type()); | |
30 this->details.set_touch_points(touch_point_count); | 27 this->details.set_touch_points(touch_point_count); |
31 this->details.set_bounding_box(bounding_box); | 28 this->details.set_bounding_box(bounding_box); |
32 } | 29 } |
33 | 30 |
34 GestureEventData::GestureEventData(EventType type, | 31 GestureEventData::GestureEventData(EventType type, |
35 int motion_event_id, | 32 int motion_event_id, |
36 base::TimeTicks time, | 33 base::TimeTicks time, |
37 float x, | 34 float x, |
38 float y, | 35 float y, |
39 int touch_point_count, | 36 int touch_point_count, |
40 const gfx::RectF& bounding_box) | 37 const gfx::RectF& bounding_box) |
41 : type(type), | 38 : details(GestureEventDetails(type, 0, 0)), |
42 motion_event_id(motion_event_id), | 39 motion_event_id(motion_event_id), |
43 time(time), | 40 time(time), |
44 x(x), | 41 x(x), |
45 y(y), | 42 y(y) { |
46 details(GestureEventDetails(type, 0, 0)) { | |
47 DCHECK_GE(motion_event_id, 0); | 43 DCHECK_GE(motion_event_id, 0); |
48 DCHECK_NE(0, touch_point_count); | 44 DCHECK_NE(0, touch_point_count); |
49 DCHECK_GE(type, ET_GESTURE_TYPE_START); | 45 DCHECK_GE(type, ET_GESTURE_TYPE_START); |
50 DCHECK_LE(type, ET_GESTURE_TYPE_END); | 46 DCHECK_LE(type, ET_GESTURE_TYPE_END); |
51 details.set_touch_points(touch_point_count); | 47 details.set_touch_points(touch_point_count); |
52 details.set_bounding_box(bounding_box); | 48 details.set_bounding_box(bounding_box); |
53 } | 49 } |
54 | 50 |
55 GestureEventData::GestureEventData() : type(ET_UNKNOWN), x(0), y(0) {} | 51 GestureEventData::GestureEventData() : x(0), y(0) { |
52 } | |
56 | 53 |
57 } // namespace ui | 54 } // namespace ui |
OLD | NEW |