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..2b066d56188c5a7ae999492165d8e74b81b8734f 100644 |
| --- a/ui/events/gesture_event_details.h |
| +++ b/ui/events/gesture_event_details.h |
| @@ -17,9 +17,22 @@ namespace ui { |
| struct EVENTS_BASE_EXPORT GestureEventDetails { |
| public: |
| + // The definition of ScrollUnits below is consistent with that in |
| + // //src/third_party/WebKit/public/platform/WebGestureEvent.h |
| + enum class ScrollUnits { |
| + PRECISE_PIXELS = 0, // generated by high precision devices. |
| + PIXELS, // large pixel jump duration; should animate to delta. |
|
sky
2017/02/17 22:52:31
Are you sure this isn't DIPs and what you are call
chengx
2017/02/17 23:19:18
I agree the names here, which originate from WebGe
|
| + PAGE // page (visible viewport) based scrolling. |
| + }; |
| + |
| GestureEventDetails(); |
| explicit GestureEventDetails(EventType type); |
| - GestureEventDetails(EventType type, float delta_x, float delta_y); |
| + |
| + // ScrollUnits::PRECISE_PIXELS is the default in WebGestureEvent.h too. |
| + GestureEventDetails(EventType type, |
| + float delta_x, |
| + float delta_y, |
| + ScrollUnits units = ScrollUnits::PRECISE_PIXELS); |
| // 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 +71,11 @@ struct EVENTS_BASE_EXPORT GestureEventDetails { |
| return data_.scroll_begin.y_hint; |
| } |
| + ScrollUnits scroll_begin_units() const { |
| + DCHECK_EQ(ET_GESTURE_SCROLL_BEGIN, type_); |
| + return data_.scroll_begin.delta_hint_units; |
| + } |
| + |
| float scroll_x() const { |
| DCHECK_EQ(ET_GESTURE_SCROLL_UPDATE, type_); |
| return data_.scroll_update.x; |
| @@ -68,6 +86,11 @@ struct EVENTS_BASE_EXPORT GestureEventDetails { |
| return data_.scroll_update.y; |
| } |
| + ScrollUnits scroll_update_units() const { |
| + DCHECK_EQ(ET_GESTURE_SCROLL_UPDATE, type_); |
| + return data_.scroll_update.delta_units; |
| + } |
| + |
| float velocity_x() const { |
| DCHECK_EQ(ET_SCROLL_FLING_START, type_); |
| return data_.fling_velocity.x; |
| @@ -162,11 +185,13 @@ struct EVENTS_BASE_EXPORT GestureEventDetails { |
| // the x/y values from the first scroll_update. |
| float x_hint; |
| float y_hint; |
| + ScrollUnits delta_hint_units; |
| } scroll_begin; |
| struct { // SCROLL delta. |
| float x; |
| float y; |
| + ScrollUnits delta_units; |
| // Whether any previous scroll update in the current scroll sequence was |
| // suppressed because the underlying touch was consumed. |
| bool previous_update_in_sequence_prevented; |