diff options
-rw-r--r-- | ash/display/root_window_transformers_unittest.cc | 4 | ||||
-rw-r--r-- | ash/display/window_tree_host_manager_unittest.cc | 4 | ||||
-rw-r--r-- | ash/touch/touch_hud_debug.cc | 6 | ||||
-rw-r--r-- | ash/touch/touch_uma.cc | 4 | ||||
-rw-r--r-- | components/arc/input/arc_input_bridge.cc | 6 | ||||
-rw-r--r-- | content/browser/renderer_host/web_input_event_aura.cc | 16 | ||||
-rw-r--r-- | mojo/converters/input_events/input_events_type_converters.cc | 6 | ||||
-rw-r--r-- | ui/events/event.cc | 4 | ||||
-rw-r--r-- | ui/events/event.h | 51 | ||||
-rw-r--r-- | ui/events/event_unittest.cc | 92 | ||||
-rw-r--r-- | ui/events/gestures/motion_event_aura.cc | 8 | ||||
-rw-r--r-- | ui/events/gestures/motion_event_aura_unittest.cc | 2 | ||||
-rw-r--r-- | ui/events/ozone/evdev/tablet_event_converter_evdev_unittest.cc | 14 | ||||
-rw-r--r-- | ui/events/x/events_x_unittest.cc | 20 | ||||
-rw-r--r-- | ui/ozone/platform/egltest/ozone_platform_egltest.cc | 4 |
15 files changed, 114 insertions, 127 deletions
diff --git a/ash/display/root_window_transformers_unittest.cc b/ash/display/root_window_transformers_unittest.cc index 1da6c92..968e9c4 100644 --- a/ash/display/root_window_transformers_unittest.cc +++ b/ash/display/root_window_transformers_unittest.cc @@ -59,8 +59,8 @@ class TestEventHandler : public ui::EventHandler { // entire root window. if (target->name() != kDesktopBackgroundView) return; - touch_radius_x_ = event->pointer_details().radius_x(); - touch_radius_y_ = event->pointer_details().radius_y(); + touch_radius_x_ = event->pointer_details().radius_x; + touch_radius_y_ = event->pointer_details().radius_y; event->StopPropagation(); } diff --git a/ash/display/window_tree_host_manager_unittest.cc b/ash/display/window_tree_host_manager_unittest.cc index 8481b19..7a2584f 100644 --- a/ash/display/window_tree_host_manager_unittest.cc +++ b/ash/display/window_tree_host_manager_unittest.cc @@ -300,8 +300,8 @@ class TestEventHandler : public ui::EventHandler { // entire root window. if (target->name() != kDesktopBackgroundView) return; - touch_radius_x_ = event->pointer_details().radius_x(); - touch_radius_y_ = event->pointer_details().radius_y(); + touch_radius_x_ = event->pointer_details().radius_x; + touch_radius_y_ = event->pointer_details().radius_y; event->StopPropagation(); } diff --git a/ash/touch/touch_hud_debug.cc b/ash/touch/touch_hud_debug.cc index 5c85f5f..099233b 100644 --- a/ash/touch/touch_hud_debug.cc +++ b/ash/touch/touch_hud_debug.cc @@ -93,9 +93,9 @@ struct TouchPointLog { type(touch.type()), location(touch.root_location()), timestamp(touch.time_stamp().InMillisecondsF()), - radius_x(touch.pointer_details().radius_x()), - radius_y(touch.pointer_details().radius_y()), - pressure(touch.pointer_details().force()), + radius_x(touch.pointer_details().radius_x), + radius_y(touch.pointer_details().radius_y), + pressure(touch.pointer_details().force), tracking_id(GetTrackingId(touch)), source_device(touch.source_device_id()) {} diff --git a/ash/touch/touch_uma.cc b/ash/touch/touch_uma.cc index 311fade..4dbb285 100644 --- a/ash/touch/touch_uma.cc +++ b/ash/touch/touch_uma.cc @@ -83,8 +83,8 @@ void TouchUMA::RecordTouchEvent(aura::Window* target, const ui::TouchEvent& event) { UMA_HISTOGRAM_CUSTOM_COUNTS( "Ash.TouchRadius", - static_cast<int>(std::max(event.pointer_details().radius_x(), - event.pointer_details().radius_y())), + static_cast<int>(std::max(event.pointer_details().radius_x, + event.pointer_details().radius_y)), 1, 500, 100); UpdateTouchState(event); diff --git a/components/arc/input/arc_input_bridge.cc b/components/arc/input/arc_input_bridge.cc index 74bd7a4..d4e8e8f 100644 --- a/components/arc/input/arc_input_bridge.cc +++ b/components/arc/input/arc_input_bridge.cc @@ -200,11 +200,11 @@ void ArcInputBridge::SendTouchEvent(ui::TouchEvent* event) { SendKernelEvent(touchscreen_fd_, time_stamp, EV_ABS, ABS_MT_POSITION_Y, event->y()); SendKernelEvent(touchscreen_fd_, time_stamp, EV_ABS, ABS_MT_TOUCH_MAJOR, - details.radius_x()); + details.radius_x); SendKernelEvent(touchscreen_fd_, time_stamp, EV_ABS, ABS_MT_TOUCH_MINOR, - details.radius_y()); + details.radius_y); SendKernelEvent(touchscreen_fd_, time_stamp, EV_ABS, ABS_MT_PRESSURE, - details.force() * kMaxPressure); + details.force * kMaxPressure); } SendSynReport(touchscreen_fd_, time_stamp); } diff --git a/content/browser/renderer_host/web_input_event_aura.cc b/content/browser/renderer_host/web_input_event_aura.cc index c4ed461..59bc129 100644 --- a/content/browser/renderer_host/web_input_event_aura.cc +++ b/content/browser/renderer_host/web_input_event_aura.cc @@ -399,11 +399,11 @@ blink::WebMouseEvent MakeWebMouseEventFromAuraEvent( break; } - webkit_event.tiltX = roundf(event.pointer_details().tilt_x()); - webkit_event.tiltY = roundf(event.pointer_details().tilt_y()); - webkit_event.force = event.pointer_details().force(); + webkit_event.tiltX = roundf(event.pointer_details().tilt_x); + webkit_event.tiltY = roundf(event.pointer_details().tilt_y); + webkit_event.force = event.pointer_details().force; webkit_event.pointerType = - EventPointerTypeToWebPointerType(event.pointer_details().pointer_type()); + EventPointerTypeToWebPointerType(event.pointer_details().pointer_type); return webkit_event; } @@ -428,11 +428,11 @@ blink::WebMouseWheelEvent MakeWebMouseWheelEventFromAuraEvent( webkit_event.wheelTicksX = webkit_event.deltaX / kPixelsPerTick; webkit_event.wheelTicksY = webkit_event.deltaY / kPixelsPerTick; - webkit_event.tiltX = roundf(event.pointer_details().tilt_x()); - webkit_event.tiltY = roundf(event.pointer_details().tilt_y()); - webkit_event.force = event.pointer_details().force(); + webkit_event.tiltX = roundf(event.pointer_details().tilt_x); + webkit_event.tiltY = roundf(event.pointer_details().tilt_y); + webkit_event.force = event.pointer_details().force; webkit_event.pointerType = - EventPointerTypeToWebPointerType(event.pointer_details().pointer_type()); + EventPointerTypeToWebPointerType(event.pointer_details().pointer_type); return webkit_event; } diff --git a/mojo/converters/input_events/input_events_type_converters.cc b/mojo/converters/input_events/input_events_type_converters.cc index 1751a6e..ce704ef 100644 --- a/mojo/converters/input_events/input_events_type_converters.cc +++ b/mojo/converters/input_events/input_events_type_converters.cc @@ -240,10 +240,10 @@ mus::mojom::EventPtr TypeConverter<mus::mojom::EventPtr, ui::Event>::Convert( mus::mojom::BrushDataPtr brush_data(mus::mojom::BrushData::New()); // TODO(rjk): this is in the wrong coordinate system - brush_data->width = touch_event->pointer_details().radius_x(); - brush_data->height = touch_event->pointer_details().radius_y(); + brush_data->width = touch_event->pointer_details().radius_x; + brush_data->height = touch_event->pointer_details().radius_y; // TODO(rjk): update for touch_event->rotation_angle(); - brush_data->pressure = touch_event->pointer_details().force(); + brush_data->pressure = touch_event->pointer_details().force; brush_data->tilt_y = 0; brush_data->tilt_z = 0; pointer_data->brush_data = std::move(brush_data); diff --git a/ui/events/event.cc b/ui/events/event.cc index 626c52c..4301737 100644 --- a/ui/events/event.cc +++ b/ui/events/event.cc @@ -613,9 +613,9 @@ void TouchEvent::UpdateForRootTransform( bool success = gfx::DecomposeTransform(&decomp, inverted_root_transform); DCHECK(success); if (decomp.scale[0]) - pointer_details_.radius_x_ *= decomp.scale[0]; + pointer_details_.radius_x *= decomp.scale[0]; if (decomp.scale[1]) - pointer_details_.radius_y_ *= decomp.scale[1]; + pointer_details_.radius_y *= decomp.scale[1]; } void TouchEvent::DisableSynchronousHandling() { diff --git a/ui/events/event.h b/ui/events/event.h index 781b0ef..da7cc98 100644 --- a/ui/events/event.h +++ b/ui/events/event.h @@ -327,57 +327,44 @@ class EVENTS_EXPORT LocatedEvent : public Event { // Structure for handling common fields between touch and mouse to support // PointerEvents API. -class EVENTS_EXPORT PointerDetails { +struct EVENTS_EXPORT PointerDetails { public: PointerDetails() {} explicit PointerDetails(EventPointerType pointer_type) - : pointer_type_(pointer_type), - force_(std::numeric_limits<float>::quiet_NaN()) {} + : pointer_type(pointer_type), + force(std::numeric_limits<float>::quiet_NaN()) {} PointerDetails(EventPointerType pointer_type, float radius_x, float radius_y, float force, float tilt_x, float tilt_y) - : pointer_type_(pointer_type), - radius_x_(radius_x), - radius_y_(radius_y), - force_(force), - tilt_x_(tilt_x), - tilt_y_(tilt_y) {} - - EventPointerType pointer_type() const { return pointer_type_; }; - - // If we aren't provided with a radius on one axis, use the - // information from the other axis. - float radius_x() const { return radius_x_ > 0 ? radius_x_ : radius_y_; } - float radius_y() const { return radius_y_ > 0 ? radius_y_ : radius_x_; } - float force() const { return force_; } - float tilt_x() const { return tilt_x_; } - float tilt_y() const { return tilt_y_; } - - private: - // For the mutators of the members on this class. - friend class TouchEvent; - friend class MouseEvent; + : pointer_type(pointer_type), + // If we aren't provided with a radius on one axis, use the + // information from the other axis. + radius_x(radius_x > 0 ? radius_x : radius_y), + radius_y(radius_y > 0 ? radius_y : radius_x), + force(force), + tilt_x(tilt_x), + tilt_y(tilt_y) {} // The type of pointer device. - EventPointerType pointer_type_ = EventPointerType::POINTER_TYPE_UNKNOWN; + EventPointerType pointer_type = EventPointerType::POINTER_TYPE_UNKNOWN; // Radius of the X (major) axis of the touch ellipse. 0.0 if unknown. - float radius_x_ = 0.0; + float radius_x = 0.0; // Radius of the Y (minor) axis of the touch ellipse. 0.0 if unknown. - float radius_y_ = 0.0; + float radius_y = 0.0; // Force (pressure) of the touch. Normalized to be [0, 1]. Default to be 0.0. - float force_ = 0.0; + float force = 0.0; // Angle of tilt of the X (major) axis. 0.0 if unknown. - float tilt_x_ = 0.0; + float tilt_x = 0.0; // Angle of tilt of the Y (minor) axis. 0.0 if unknown. - float tilt_y_ = 0.0; + float tilt_y = 0.0; }; class EVENTS_EXPORT MouseEvent : public LocatedEvent { @@ -590,8 +577,8 @@ class EVENTS_EXPORT TouchEvent : public LocatedEvent { // TODO(robert.bradford): ozone_platform_egltest.cc could use // UpdateForRootTransform() instead: crbug.com/519337 - void set_radius_x(const float r) { pointer_details_.radius_x_ = r; } - void set_radius_y(const float r) { pointer_details_.radius_y_ = r; } + void set_radius_x(const float r) { pointer_details_.radius_x = r; } + void set_radius_y(const float r) { pointer_details_.radius_y = r; } void set_should_remove_native_touch_id_mapping( bool should_remove_native_touch_id_mapping) { diff --git a/ui/events/event_unittest.cc b/ui/events/event_unittest.cc index 5f1ffdf..97e1628 100644 --- a/ui/events/event_unittest.cc +++ b/ui/events/event_unittest.cc @@ -560,13 +560,13 @@ TEST(EventTest, TouchEventRadiusDefaultsToOtherAxis) { TouchEvent event1(ui::ET_TOUCH_PRESSED, gfx::Point(0, 0), 0, 0, time, non_zero_length1, 0, 0, 0); - EXPECT_EQ(non_zero_length1, event1.pointer_details().radius_x()); - EXPECT_EQ(non_zero_length1, event1.pointer_details().radius_y()); + EXPECT_EQ(non_zero_length1, event1.pointer_details().radius_x); + EXPECT_EQ(non_zero_length1, event1.pointer_details().radius_y); TouchEvent event2(ui::ET_TOUCH_PRESSED, gfx::Point(0, 0), 0, 0, time, 0, non_zero_length2, 0, 0); - EXPECT_EQ(non_zero_length2, event2.pointer_details().radius_x()); - EXPECT_EQ(non_zero_length2, event2.pointer_details().radius_y()); + EXPECT_EQ(non_zero_length2, event2.pointer_details().radius_x); + EXPECT_EQ(non_zero_length2, event2.pointer_details().radius_y); } TEST(EventTest, TouchEventRotationAngleFixing) { @@ -622,33 +622,33 @@ TEST(EventTest, PointerEventDetailsTouch) { ui::EventTimeForNow()); EXPECT_EQ(EventPointerType::POINTER_TYPE_TOUCH, - touch_event_plain.pointer_details().pointer_type()); - EXPECT_EQ(0.0f, touch_event_plain.pointer_details().radius_x()); - EXPECT_EQ(0.0f, touch_event_plain.pointer_details().radius_y()); - EXPECT_TRUE(std::isnan(touch_event_plain.pointer_details().force())); - EXPECT_EQ(0.0f, touch_event_plain.pointer_details().tilt_x()); - EXPECT_EQ(0.0f, touch_event_plain.pointer_details().tilt_y()); + touch_event_plain.pointer_details().pointer_type); + EXPECT_EQ(0.0f, touch_event_plain.pointer_details().radius_x); + EXPECT_EQ(0.0f, touch_event_plain.pointer_details().radius_y); + EXPECT_TRUE(std::isnan(touch_event_plain.pointer_details().force)); + EXPECT_EQ(0.0f, touch_event_plain.pointer_details().tilt_x); + EXPECT_EQ(0.0f, touch_event_plain.pointer_details().tilt_y); ui::TouchEvent touch_event_with_details(ET_TOUCH_PRESSED, gfx::Point(0, 0), 0, 0, ui::EventTimeForNow(), 10.0f, 5.0f, 0.0f, 15.0f); EXPECT_EQ(EventPointerType::POINTER_TYPE_TOUCH, - touch_event_with_details.pointer_details().pointer_type()); - EXPECT_EQ(10.0f, touch_event_with_details.pointer_details().radius_x()); - EXPECT_EQ(5.0f, touch_event_with_details.pointer_details().radius_y()); - EXPECT_EQ(15.0f, touch_event_with_details.pointer_details().force()); - EXPECT_EQ(0.0f, touch_event_with_details.pointer_details().tilt_x()); - EXPECT_EQ(0.0f, touch_event_with_details.pointer_details().tilt_y()); + touch_event_with_details.pointer_details().pointer_type); + EXPECT_EQ(10.0f, touch_event_with_details.pointer_details().radius_x); + EXPECT_EQ(5.0f, touch_event_with_details.pointer_details().radius_y); + EXPECT_EQ(15.0f, touch_event_with_details.pointer_details().force); + EXPECT_EQ(0.0f, touch_event_with_details.pointer_details().tilt_x); + EXPECT_EQ(0.0f, touch_event_with_details.pointer_details().tilt_y); ui::TouchEvent touch_event_copy(touch_event_with_details); EXPECT_EQ(EventPointerType::POINTER_TYPE_TOUCH, - touch_event_copy.pointer_details().pointer_type()); - EXPECT_EQ(10.0f, touch_event_copy.pointer_details().radius_x()); - EXPECT_EQ(5.0f, touch_event_copy.pointer_details().radius_y()); - EXPECT_EQ(15.0f, touch_event_copy.pointer_details().force()); - EXPECT_EQ(0.0f, touch_event_copy.pointer_details().tilt_x()); - EXPECT_EQ(0.0f, touch_event_copy.pointer_details().tilt_y()); + touch_event_copy.pointer_details().pointer_type); + EXPECT_EQ(10.0f, touch_event_copy.pointer_details().radius_x); + EXPECT_EQ(5.0f, touch_event_copy.pointer_details().radius_y); + EXPECT_EQ(15.0f, touch_event_copy.pointer_details().force); + EXPECT_EQ(0.0f, touch_event_copy.pointer_details().tilt_x); + EXPECT_EQ(0.0f, touch_event_copy.pointer_details().tilt_y); } TEST(EventTest, PointerEventDetailsMouse) { @@ -656,21 +656,21 @@ TEST(EventTest, PointerEventDetailsMouse) { gfx::Point(0, 0), ui::EventTimeForNow(), 0, 0); EXPECT_EQ(EventPointerType::POINTER_TYPE_MOUSE, - mouse_event.pointer_details().pointer_type()); - EXPECT_EQ(0.0f, mouse_event.pointer_details().radius_x()); - EXPECT_EQ(0.0f, mouse_event.pointer_details().radius_y()); - EXPECT_TRUE(std::isnan(mouse_event.pointer_details().force())); - EXPECT_EQ(0.0f, mouse_event.pointer_details().tilt_x()); - EXPECT_EQ(0.0f, mouse_event.pointer_details().tilt_y()); + mouse_event.pointer_details().pointer_type); + EXPECT_EQ(0.0f, mouse_event.pointer_details().radius_x); + EXPECT_EQ(0.0f, mouse_event.pointer_details().radius_y); + EXPECT_TRUE(std::isnan(mouse_event.pointer_details().force)); + EXPECT_EQ(0.0f, mouse_event.pointer_details().tilt_x); + EXPECT_EQ(0.0f, mouse_event.pointer_details().tilt_y); ui::MouseEvent mouse_event_copy(mouse_event); EXPECT_EQ(EventPointerType::POINTER_TYPE_MOUSE, - mouse_event_copy.pointer_details().pointer_type()); - EXPECT_EQ(0.0f, mouse_event_copy.pointer_details().radius_x()); - EXPECT_EQ(0.0f, mouse_event_copy.pointer_details().radius_y()); - EXPECT_TRUE(std::isnan(mouse_event_copy.pointer_details().force())); - EXPECT_EQ(0.0f, mouse_event_copy.pointer_details().tilt_x()); - EXPECT_EQ(0.0f, mouse_event_copy.pointer_details().tilt_y()); + mouse_event_copy.pointer_details().pointer_type); + EXPECT_EQ(0.0f, mouse_event_copy.pointer_details().radius_x); + EXPECT_EQ(0.0f, mouse_event_copy.pointer_details().radius_y); + EXPECT_TRUE(std::isnan(mouse_event_copy.pointer_details().force)); + EXPECT_EQ(0.0f, mouse_event_copy.pointer_details().tilt_x); + EXPECT_EQ(0.0f, mouse_event_copy.pointer_details().tilt_y); } TEST(EventTest, PointerEventDetailsStylus) { @@ -685,21 +685,21 @@ TEST(EventTest, PointerEventDetailsStylus) { stylus_event.set_pointer_details(pointer_details); EXPECT_EQ(EventPointerType::POINTER_TYPE_PEN, - stylus_event.pointer_details().pointer_type()); - EXPECT_EQ(21.0f, stylus_event.pointer_details().force()); - EXPECT_EQ(45.0f, stylus_event.pointer_details().tilt_x()); - EXPECT_EQ(-45.0f, stylus_event.pointer_details().tilt_y()); - EXPECT_EQ(0.0f, stylus_event.pointer_details().radius_x()); - EXPECT_EQ(0.0f, stylus_event.pointer_details().radius_y()); + stylus_event.pointer_details().pointer_type); + EXPECT_EQ(21.0f, stylus_event.pointer_details().force); + EXPECT_EQ(45.0f, stylus_event.pointer_details().tilt_x); + EXPECT_EQ(-45.0f, stylus_event.pointer_details().tilt_y); + EXPECT_EQ(0.0f, stylus_event.pointer_details().radius_x); + EXPECT_EQ(0.0f, stylus_event.pointer_details().radius_y); ui::MouseEvent stylus_event_copy(stylus_event); EXPECT_EQ(EventPointerType::POINTER_TYPE_PEN, - stylus_event_copy.pointer_details().pointer_type()); - EXPECT_EQ(21.0f, stylus_event_copy.pointer_details().force()); - EXPECT_EQ(45.0f, stylus_event_copy.pointer_details().tilt_x()); - EXPECT_EQ(-45.0f, stylus_event_copy.pointer_details().tilt_y()); - EXPECT_EQ(0.0f, stylus_event_copy.pointer_details().radius_x()); - EXPECT_EQ(0.0f, stylus_event_copy.pointer_details().radius_y()); + stylus_event_copy.pointer_details().pointer_type); + EXPECT_EQ(21.0f, stylus_event_copy.pointer_details().force); + EXPECT_EQ(45.0f, stylus_event_copy.pointer_details().tilt_x); + EXPECT_EQ(-45.0f, stylus_event_copy.pointer_details().tilt_y); + EXPECT_EQ(0.0f, stylus_event_copy.pointer_details().radius_x); + EXPECT_EQ(0.0f, stylus_event_copy.pointer_details().radius_y); } } // namespace ui diff --git a/ui/events/gestures/motion_event_aura.cc b/ui/events/gestures/motion_event_aura.cc index 7b6e34e..eff71e1 100644 --- a/ui/events/gestures/motion_event_aura.cc +++ b/ui/events/gestures/motion_event_aura.cc @@ -33,11 +33,11 @@ PointerProperties GetPointerPropertiesFromTouchEvent(const TouchEvent& touch) { pointer_properties.raw_x = touch.root_location_f().x(); pointer_properties.raw_y = touch.root_location_f().y(); pointer_properties.id = touch.touch_id(); - pointer_properties.pressure = touch.pointer_details().force(); + pointer_properties.pressure = touch.pointer_details().force; pointer_properties.source_device_id = touch.source_device_id(); - pointer_properties.SetAxesAndOrientation(touch.pointer_details().radius_x(), - touch.pointer_details().radius_y(), + pointer_properties.SetAxesAndOrientation(touch.pointer_details().radius_x, + touch.pointer_details().radius_y, touch.rotation_angle()); if (!pointer_properties.touch_major) { pointer_properties.touch_major = @@ -48,7 +48,7 @@ PointerProperties GetPointerPropertiesFromTouchEvent(const TouchEvent& touch) { } pointer_properties.tool_type = EventPointerTypeToMotionEventToolType( - touch.pointer_details().pointer_type()); + touch.pointer_details().pointer_type); return pointer_properties; } diff --git a/ui/events/gestures/motion_event_aura_unittest.cc b/ui/events/gestures/motion_event_aura_unittest.cc index 75f49ff..2e35a23 100644 --- a/ui/events/gestures/motion_event_aura_unittest.cc +++ b/ui/events/gestures/motion_event_aura_unittest.cc @@ -432,7 +432,7 @@ TEST(MotionEventAuraTest, ToolType) { EXPECT_EQ(MotionEvent::TOOL_TYPE_FINGER, event.GetToolType(0)); // TODO(robert.bradford): crbug.com/575162: Test TOOL_TYPE_PEN when - // TouchEvents can have their PointerDetails::pointer_type() something other + // TouchEvents can have their PointerDetails::pointer_type something other // than POINTER_TYPE_TOUCH } diff --git a/ui/events/ozone/evdev/tablet_event_converter_evdev_unittest.cc b/ui/events/ozone/evdev/tablet_event_converter_evdev_unittest.cc index b7def52..d7a83df 100644 --- a/ui/events/ozone/evdev/tablet_event_converter_evdev_unittest.cc +++ b/ui/events/ozone/evdev/tablet_event_converter_evdev_unittest.cc @@ -418,20 +418,20 @@ TEST_F(TabletEventConverterEvdevTest, Tap) { ui::MouseEvent* event = dispatched_event(0); EXPECT_EQ(ui::ET_MOUSE_MOVED, event->type()); EXPECT_EQ(ui::EventPointerType::POINTER_TYPE_PEN, - event->pointer_details().pointer_type()); - EXPECT_FLOAT_EQ(5.625f, event->pointer_details().tilt_x()); - EXPECT_FLOAT_EQ(0.f, event->pointer_details().tilt_y()); + event->pointer_details().pointer_type); + EXPECT_FLOAT_EQ(5.625f, event->pointer_details().tilt_x); + EXPECT_FLOAT_EQ(0.f, event->pointer_details().tilt_y); event = dispatched_event(1); EXPECT_EQ(ui::ET_MOUSE_PRESSED, event->type()); EXPECT_EQ(ui::EventPointerType::POINTER_TYPE_PEN, - event->pointer_details().pointer_type()); - EXPECT_FLOAT_EQ((float)992 / 2047, event->pointer_details().force()); + event->pointer_details().pointer_type); + EXPECT_FLOAT_EQ((float)992 / 2047, event->pointer_details().force); EXPECT_EQ(true, event->IsLeftMouseButton()); event = dispatched_event(2); EXPECT_EQ(ui::EventPointerType::POINTER_TYPE_PEN, - event->pointer_details().pointer_type()); + event->pointer_details().pointer_type); EXPECT_EQ(ui::ET_MOUSE_RELEASED, event->type()); - EXPECT_FLOAT_EQ(0.0f, event->pointer_details().force()); + EXPECT_FLOAT_EQ(0.0f, event->pointer_details().force); EXPECT_EQ(true, event->IsLeftMouseButton()); } diff --git a/ui/events/x/events_x_unittest.cc b/ui/events/x/events_x_unittest.cc index 7ec0ee4..42f38a3 100644 --- a/ui/events/x/events_x_unittest.cc +++ b/ui/events/x/events_x_unittest.cc @@ -244,8 +244,8 @@ TEST_F(EventsXTest, TouchEventBasic) { EXPECT_FLOAT_EQ(GetTouchAngle(scoped_xevent), 0.15f); PointerDetails pointer_details = GetTouchPointerDetailsFromNative(scoped_xevent); - EXPECT_FLOAT_EQ(pointer_details.radius_x(), 10.0f); - EXPECT_FLOAT_EQ(pointer_details.force(), 0.1f); + EXPECT_FLOAT_EQ(pointer_details.radius_x, 10.0f); + EXPECT_FLOAT_EQ(pointer_details.force, 0.1f); // Touch update, with new orientation info. valuators.clear(); @@ -258,8 +258,8 @@ TEST_F(EventsXTest, TouchEventBasic) { EXPECT_EQ(GetTouchId(scoped_xevent), 0); EXPECT_FLOAT_EQ(GetTouchAngle(scoped_xevent), 0.25f); pointer_details = GetTouchPointerDetailsFromNative(scoped_xevent); - EXPECT_FLOAT_EQ(pointer_details.radius_x(), 10.0f); - EXPECT_FLOAT_EQ(pointer_details.force(), 0.1f); + EXPECT_FLOAT_EQ(pointer_details.radius_x, 10.0f); + EXPECT_FLOAT_EQ(pointer_details.force, 0.1f); // Another touch with tracking id 6, touch id 1. valuators.clear(); @@ -274,8 +274,8 @@ TEST_F(EventsXTest, TouchEventBasic) { EXPECT_EQ(GetTouchId(scoped_xevent), 1); EXPECT_FLOAT_EQ(GetTouchAngle(scoped_xevent), 0.45f); pointer_details = GetTouchPointerDetailsFromNative(scoped_xevent); - EXPECT_FLOAT_EQ(pointer_details.radius_x(), 50.0f); - EXPECT_FLOAT_EQ(pointer_details.force(), 0.5f); + EXPECT_FLOAT_EQ(pointer_details.radius_x, 50.0f); + EXPECT_FLOAT_EQ(pointer_details.force, 0.5f); // Touch with tracking id 5 should have old radius/angle value and new pressue // value. @@ -288,8 +288,8 @@ TEST_F(EventsXTest, TouchEventBasic) { EXPECT_EQ(GetTouchId(scoped_xevent), 0); EXPECT_FLOAT_EQ(GetTouchAngle(scoped_xevent), 0.25f); pointer_details = GetTouchPointerDetailsFromNative(scoped_xevent); - EXPECT_FLOAT_EQ(pointer_details.radius_x(), 10.0f); - EXPECT_FLOAT_EQ(pointer_details.force(), 0.05f); + EXPECT_FLOAT_EQ(pointer_details.radius_x, 10.0f); + EXPECT_FLOAT_EQ(pointer_details.force, 0.05f); // Touch with tracking id 6 should have old angle/pressure value and new // radius value. @@ -302,8 +302,8 @@ TEST_F(EventsXTest, TouchEventBasic) { EXPECT_EQ(GetTouchId(scoped_xevent), 1); EXPECT_FLOAT_EQ(GetTouchAngle(scoped_xevent), 0.45f); pointer_details = GetTouchPointerDetailsFromNative(scoped_xevent); - EXPECT_FLOAT_EQ(pointer_details.radius_x(), 25.0f); - EXPECT_FLOAT_EQ(pointer_details.force(), 0.5f); + EXPECT_FLOAT_EQ(pointer_details.radius_x, 25.0f); + EXPECT_FLOAT_EQ(pointer_details.force, 0.5f); } int GetTouchIdForTrackingId(uint32_t tracking_id) { diff --git a/ui/ozone/platform/egltest/ozone_platform_egltest.cc b/ui/ozone/platform/egltest/ozone_platform_egltest.cc index 94012a8..f74e9c4 100644 --- a/ui/ozone/platform/egltest/ozone_platform_egltest.cc +++ b/ui/ozone/platform/egltest/ozone_platform_egltest.cc @@ -70,8 +70,8 @@ void ScaleTouchEvent(TouchEvent* event, const gfx::SizeF& size) { double ratio = std::sqrt(size.GetArea() / touchscreen_size.GetArea()); event->set_location_f(location); - event->set_radius_x(event->pointer_details().radius_x() * ratio); - event->set_radius_y(event->pointer_details().radius_y() * ratio); + event->set_radius_x(event->pointer_details().radius_x * ratio); + event->set_radius_y(event->pointer_details().radius_y * ratio); return; } } |