Chromium Code Reviews| Index: ui/events/event.h |
| diff --git a/ui/events/event.h b/ui/events/event.h |
| index 850c290489025ee615ad13b23e086d402fcd0cea..50f4539355d8aa5eb1f388098d4b9da3ff2b3e2b 100644 |
| --- a/ui/events/event.h |
| +++ b/ui/events/event.h |
| @@ -131,7 +131,9 @@ class EVENTS_EXPORT Event { |
| bool IsPointerEvent() const { |
| return type_ == ET_POINTER_DOWN || type_ == ET_POINTER_MOVED || |
| type_ == ET_POINTER_UP || type_ == ET_POINTER_CANCELLED || |
| - type_ == ET_POINTER_ENTERED || type_ == ET_POINTER_EXITED; |
| + type_ == ET_POINTER_ENTERED || type_ == ET_POINTER_EXITED || |
| + type_ == ET_POINTER_WHEEL_CHANGED || |
| + type_ == ET_POINTER_CAPTURE_CHANGED; |
| } |
| // Convenience methods to check pointer type of |this|. Returns false if |
| @@ -412,15 +414,19 @@ struct EVENTS_EXPORT PointerDetails { |
| force(force), |
| tilt_x(tilt_x), |
| tilt_y(tilt_y) {} |
| + PointerDetails(EventPointerType pointer_type, int offset_x, int offset_y) |
| + : pointer_type(pointer_type), |
| + force(std::numeric_limits<float>::quiet_NaN()), |
| + offset_x(offset_x), |
| + offset_y(offset_y) {} |
| bool operator==(const PointerDetails& other) const { |
| - return pointer_type == other.pointer_type && |
| - radius_x == other.radius_x && |
| + return pointer_type == other.pointer_type && radius_x == other.radius_x && |
| radius_y == other.radius_y && |
| (force == other.force || |
| (std::isnan(force) && std::isnan(other.force))) && |
| - tilt_x == other.tilt_x && |
| - tilt_y == other.tilt_y; |
| + tilt_x == other.tilt_x && tilt_y == other.tilt_y && |
| + offset_x == other.offset_x && offset_y == other.offset_y; |
| } |
| // The type of pointer device. |
| @@ -441,6 +447,12 @@ struct EVENTS_EXPORT PointerDetails { |
| // is towards the user. 0.0 if unknown. |
| float tilt_x = 0.0; |
| float tilt_y = 0.0; |
| + |
| + // Only used by mouse wheel events. The amount to scroll. This is in multiples |
| + // of kWheelDelta. |
| + // Note: x_offset() > 0/y_offset() > 0 means scroll left/up. |
| + int offset_x = 0; |
| + int offset_y = 0; |
|
sadrul
2016/08/19 04:18:27
Maybe use a gfx::Vector2dF instead?
riajiang
2016/08/19 16:19:39
Done.
|
| }; |
| class EVENTS_EXPORT MouseEvent : public LocatedEvent { |
| @@ -713,9 +725,7 @@ class EVENTS_EXPORT PointerEvent : public LocatedEvent { |
| public: |
| static const int32_t kMousePointerId; |
| - // Returns true if a PointerEvent can be constructed from the given mouse or |
| - // touch event. For example, PointerEvent does not support ET_MOUSEWHEEL or |
| - // ET_MOUSE_CAPTURE_CHANGED. |
| + // Returns true if |event| is a MouseEvent or TouchEvent. |
|
sadrul
2016/08/19 04:18:27
Something more like: Returns true if a PointerEven
riajiang
2016/08/19 16:19:39
Done.
|
| static bool CanConvertFrom(const Event& event); |
| PointerEvent(const PointerEvent& pointer_event); |