Chromium Code Reviews| Index: ui/events/gesture_event_details.h |
| diff --git a/ui/events/gesture_event_details.h b/ui/events/gesture_event_details.h |
| index 377c4232c991e3c0d580002421667ce311b69bfa..2e4df3c03abc66cb3ccea5cf626201342fe8b5cc 100644 |
| --- a/ui/events/gesture_event_details.h |
| +++ b/ui/events/gesture_event_details.h |
| @@ -17,9 +17,13 @@ namespace ui { |
| struct EVENTS_BASE_EXPORT GestureEventDetails { |
| public: |
| + enum ScrollUnits { PrecisePixels = 0, Pixels, Page }; |
|
sky
2017/02/17 18:00:25
chrome style is ALL_CAPS. Also, use enum class.
A
chengx
2017/02/17 20:52:46
I copied this enum definition from WebGestureEvent
|
| GestureEventDetails(); |
| explicit GestureEventDetails(EventType type); |
| - GestureEventDetails(EventType type, float delta_x, float delta_y); |
| + GestureEventDetails(EventType type, |
| + float delta_x, |
| + float delta_y, |
| + ScrollUnits units = PrecisePixels); |
| // The caller is responsible for ensuring that the gesture data from |other| |
| // is compatible and sufficient for that expected by gestures of |type|. |
| @@ -58,6 +62,11 @@ struct EVENTS_BASE_EXPORT GestureEventDetails { |
| return data_.scroll_begin.y_hint; |
| } |
| + ScrollUnits scroll_units_hint() const { |
|
sky
2017/02/17 18:00:25
scroll_begin_units?
chengx
2017/02/17 20:52:46
Done.
|
| + DCHECK_EQ(ET_GESTURE_SCROLL_BEGIN, type_); |
| + return data_.scroll_begin.deltaHintUnits; |
| + } |
| + |
| float scroll_x() const { |
| DCHECK_EQ(ET_GESTURE_SCROLL_UPDATE, type_); |
| return data_.scroll_update.x; |
| @@ -68,6 +77,11 @@ struct EVENTS_BASE_EXPORT GestureEventDetails { |
| return data_.scroll_update.y; |
| } |
| + ScrollUnits scroll_units() const { |
|
sky
2017/02/17 18:00:25
scroll_update_units?
chengx
2017/02/17 20:52:46
Done.
|
| + DCHECK_EQ(ET_GESTURE_SCROLL_UPDATE, type_); |
| + return data_.scroll_update.deltaUnits; |
| + } |
| + |
| float velocity_x() const { |
| DCHECK_EQ(ET_SCROLL_FLING_START, type_); |
| return data_.fling_velocity.x; |
| @@ -162,11 +176,13 @@ struct EVENTS_BASE_EXPORT GestureEventDetails { |
| // the x/y values from the first scroll_update. |
| float x_hint; |
| float y_hint; |
| + ScrollUnits deltaHintUnits; |
|
sky
2017/02/17 18:00:25
delta_hint_units.
chengx
2017/02/17 20:52:46
Done.
|
| } scroll_begin; |
| struct { // SCROLL delta. |
| float x; |
| float y; |
| + ScrollUnits deltaUnits; |
|
sky
2017/02/17 18:00:25
delta_units.
chengx
2017/02/17 20:52:46
Done.
|
| // Whether any previous scroll update in the current scroll sequence was |
| // suppressed because the underlying touch was consumed. |
| bool previous_update_in_sequence_prevented; |