Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(940)

Unified Diff: ui/events/event.h

Issue 2256343003: Update ui::PointerEvent to support mouse wheel and capture change events. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: ui/events/event.h
diff --git a/ui/events/event.h b/ui/events/event.h
index 850c290489025ee615ad13b23e086d402fcd0cea..4c886ac1ec8d1da7f4b0ba80b006cbf58b6e6bdf 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,18 @@ struct EVENTS_EXPORT PointerDetails {
force(force),
tilt_x(tilt_x),
tilt_y(tilt_y) {}
+ PointerDetails(EventPointerType pointer_type, gfx::Vector2d offset)
sadrul 2016/08/19 16:38:59 const gfx::Vector2d&
riajiang 2016/08/22 16:03:05 Done.
+ : pointer_type(pointer_type),
+ force(std::numeric_limits<float>::quiet_NaN()),
+ offset(offset) {}
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 == other.offset;
}
// The type of pointer device.
@@ -441,6 +446,11 @@ 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: offset_.x() > 0/offset_.y() > 0 means scroll left/up.
+ gfx::Vector2d offset = gfx::Vector2d();
sadrul 2016/08/19 16:38:59 Don't need this. Just 'gfx::Vector2d offset;' (alt
riajiang 2016/08/19 17:23:42 https://cs.chromium.org/chromium/src/ui/events/eve
riajiang 2016/08/22 16:03:05 Changed to gfx::Vector2d offset;
};
class EVENTS_EXPORT MouseEvent : public LocatedEvent {
@@ -713,9 +723,8 @@ 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 a PointerEvent can be constructed from |event|. Currently,
+ // only mouse and touch events can be converted to pointer events.
static bool CanConvertFrom(const Event& event);
PointerEvent(const PointerEvent& pointer_event);

Powered by Google App Engine
This is Rietveld 408576698