Index: ui/events/event.cc |
diff --git a/ui/events/event.cc b/ui/events/event.cc |
index 953220d0a634f1de2ae7ec3ca738dfc34a879839..341b7b3462701c8de009cee6e04ad38a57af0739 100644 |
--- a/ui/events/event.cc |
+++ b/ui/events/event.cc |
@@ -330,9 +330,11 @@ MouseEvent::MouseEvent(EventType type, |
const gfx::PointF& root_location, |
base::TimeDelta time_stamp, |
int flags, |
- int changed_button_flags) |
+ int changed_button_flags, |
+ const PointerEventDetails& details) |
: LocatedEvent(type, location, root_location, time_stamp, flags), |
- changed_button_flags_(changed_button_flags) { |
+ changed_button_flags_(changed_button_flags), |
+ pointer_details_(details) { |
if (this->type() == ET_MOUSE_MOVED && IsAnyButton()) |
SetType(ET_MOUSE_DRAGGED); |
} |
@@ -494,9 +496,9 @@ MouseWheelEvent::MouseWheelEvent(const gfx::Vector2d& offset, |
root_location, |
time_stamp, |
flags, |
- changed_button_flags), |
- offset_(offset) { |
-} |
+ changed_button_flags, |
+ PointerEventDetails(EventPointerType::POINTER_TYPE_MOUSE)), |
+ offset_(offset) {} |
#if defined(OS_WIN) |
// This value matches windows WHEEL_DELTA. |
@@ -514,12 +516,15 @@ TouchEvent::TouchEvent(const base::NativeEvent& native_event) |
: LocatedEvent(native_event), |
touch_id_(GetTouchId(native_event)), |
unique_event_id_(ui::GetNextTouchEventId()), |
- radius_x_(GetTouchRadiusX(native_event)), |
- radius_y_(GetTouchRadiusY(native_event)), |
rotation_angle_(GetTouchAngle(native_event)), |
- force_(GetTouchForce(native_event)), |
may_cause_scrolling_(false), |
- should_remove_native_touch_id_mapping_(false) { |
+ should_remove_native_touch_id_mapping_(false), |
+ pointer_details_(PointerEventDetails(EventPointerType::POINTER_TYPE_TOUCH, |
+ GetTouchRadiusX(native_event), |
+ GetTouchRadiusY(native_event), |
+ GetTouchForce(native_event), |
+ /* tilt_x */ 0.0f, |
+ /* tilt_y */ 0.0f)) { |
latency()->AddLatencyNumberWithTimestamp( |
INPUT_EVENT_LATENCY_ORIGINAL_COMPONENT, 0, 0, |
base::TimeTicks::FromInternalValue(time_stamp().ToInternalValue()), 1); |
@@ -537,12 +542,11 @@ TouchEvent::TouchEvent(EventType type, |
: LocatedEvent(type, location, location, time_stamp, 0), |
touch_id_(touch_id), |
unique_event_id_(ui::GetNextTouchEventId()), |
- radius_x_(0.0f), |
- radius_y_(0.0f), |
rotation_angle_(0.0f), |
- force_(0.0f), |
may_cause_scrolling_(false), |
- should_remove_native_touch_id_mapping_(false) { |
+ should_remove_native_touch_id_mapping_(false), |
+ pointer_details_( |
+ PointerEventDetails(EventPointerType::POINTER_TYPE_TOUCH)) { |
latency()->AddLatencyNumber(INPUT_EVENT_LATENCY_UI_COMPONENT, 0, 0); |
} |
@@ -551,19 +555,15 @@ TouchEvent::TouchEvent(EventType type, |
int flags, |
int touch_id, |
base::TimeDelta time_stamp, |
- float radius_x, |
- float radius_y, |
float angle, |
- float force) |
+ const PointerEventDetails& details) |
: LocatedEvent(type, location, location, time_stamp, flags), |
touch_id_(touch_id), |
unique_event_id_(ui::GetNextTouchEventId()), |
- radius_x_(radius_x), |
- radius_y_(radius_y), |
rotation_angle_(angle), |
- force_(force), |
may_cause_scrolling_(false), |
- should_remove_native_touch_id_mapping_(false) { |
+ should_remove_native_touch_id_mapping_(false), |
+ pointer_details_(details) { |
latency()->AddLatencyNumber(INPUT_EVENT_LATENCY_UI_COMPONENT, 0, 0); |
FixRotationAngle(); |
} |
@@ -572,12 +572,10 @@ TouchEvent::TouchEvent(const TouchEvent& copy) |
: LocatedEvent(copy), |
touch_id_(copy.touch_id_), |
unique_event_id_(copy.unique_event_id_), |
- radius_x_(copy.radius_x_), |
- radius_y_(copy.radius_y_), |
rotation_angle_(copy.rotation_angle_), |
- force_(copy.force_), |
may_cause_scrolling_(copy.may_cause_scrolling_), |
- should_remove_native_touch_id_mapping_(false) { |
+ should_remove_native_touch_id_mapping_(false), |
+ pointer_details_(copy.pointer_details_) { |
// Copied events should not remove touch id mapping, as this either causes the |
// mapping to be lost before the initial event has finished dispatching, or |
// the copy to attempt to remove the mapping from a null |native_event_|. |
@@ -601,9 +599,9 @@ void TouchEvent::UpdateForRootTransform( |
bool success = gfx::DecomposeTransform(&decomp, inverted_root_transform); |
DCHECK(success); |
if (decomp.scale[0]) |
- radius_x_ *= decomp.scale[0]; |
+ pointer_details_.radius_x_ *= decomp.scale[0]; |
if (decomp.scale[1]) |
- radius_y_ *= decomp.scale[1]; |
+ pointer_details_.radius_y_ *= decomp.scale[1]; |
} |
void TouchEvent::DisableSynchronousHandling() { |
@@ -944,7 +942,13 @@ ScrollEvent::ScrollEvent(EventType type, |
float x_offset_ordinal, |
float y_offset_ordinal, |
int finger_count) |
- : MouseEvent(type, location, location, time_stamp, flags, 0), |
+ : MouseEvent(type, |
+ location, |
+ location, |
+ time_stamp, |
+ flags, |
+ 0, |
+ PointerEventDetails(EventPointerType::POINTER_TYPE_MOUSE)), |
x_offset_(x_offset), |
y_offset_(y_offset), |
x_offset_ordinal_(x_offset_ordinal), |