summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordanakj <danakj@chromium.org>2015-11-02 14:52:33 -0800
committerCommit bot <commit-bot@chromium.org>2015-11-02 22:53:36 +0000
commit089746fb7612de40d86dcb5f440a45b4d8164e95 (patch)
tree43bad02895cc754b4f62edfb999de163f156b1b2
parent2f87c9f46eb1ea6dc47a4030129a57bdaabfe210 (diff)
downloadchromium_src-089746fb7612de40d86dcb5f440a45b4d8164e95.zip
chromium_src-089746fb7612de40d86dcb5f440a45b4d8164e95.tar.gz
chromium_src-089746fb7612de40d86dcb5f440a45b4d8164e95.tar.bz2
gfx: Make conversions from gfx::Point to PointF explicit.
R=sky@chromium.org, vmpstr BUG=342848 CQ_INCLUDE_TRYBOTS=tryserver.blink:linux_blink_rel Review URL: https://codereview.chromium.org/1372253002 Cr-Commit-Position: refs/heads/master@{#357460}
-rw-r--r--ash/drag_drop/drag_drop_controller.cc31
-rw-r--r--cc/trees/layer_tree_impl_unittest.cc4
-rw-r--r--chrome/browser/android/compositor/layer/toolbar_layer.cc3
-rw-r--r--chrome/browser/ui/views/ash/tab_scrubber_browsertest.cc8
-rw-r--r--chrome/browser/ui/views/link_disambiguation/link_disambiguation_popup.cc8
-rw-r--r--components/html_viewer/input_events_unittest.cc6
-rw-r--r--components/mus/example/wm/move_loop_unittest.cc4
-rw-r--r--components/mus/ws/event_dispatcher_unittest.cc82
-rw-r--r--content/browser/accessibility/touch_accessibility_aura_browsertest.cc4
-rw-r--r--content/browser/renderer_host/input/input_router_impl_unittest.cc18
-rw-r--r--content/browser/renderer_host/input/synthetic_gesture_target_aura.cc14
-rw-r--r--content/browser/renderer_host/input/touch_selection_controller_client_aura_browsertest.cc4
-rw-r--r--content/browser/renderer_host/render_widget_host_view_aura_unittest.cc55
-rw-r--r--content/browser/renderer_host/ui_events_helper.cc14
-rw-r--r--content/browser/renderer_host/web_input_event_aura_unittest.cc63
-rw-r--r--content/browser/web_contents/web_contents_view_aura_browsertest.cc40
-rw-r--r--content/common/cursors/webcursor_mac.mm4
-rw-r--r--mojo/converters/input_events/input_events_type_converters.cc13
-rw-r--r--ui/app_list/folder_image.cc1
-rw-r--r--ui/aura/gestures/gesture_recognizer_unittest.cc80
-rw-r--r--ui/aura/test/ui_controls_factory_ozone.cc4
-rw-r--r--ui/aura/window_event_dispatcher_unittest.cc10
-rw-r--r--ui/aura/window_tree_host.cc4
-rw-r--r--ui/base/dragdrop/drop_target_event.cc8
-rw-r--r--ui/base/dragdrop/drop_target_event.h4
-rw-r--r--ui/base/touch/selection_bound_unittest.cc28
-rw-r--r--ui/chromeos/touch_exploration_controller.cc113
-rw-r--r--ui/chromeos/touch_exploration_controller.h4
-rw-r--r--ui/events/event.cc35
-rw-r--r--ui/events/event.h24
-rw-r--r--ui/events/event_unittest.cc8
-rw-r--r--ui/events/gestures/gesture_provider_aura_unittest.cc86
-rw-r--r--ui/events/gestures/gesture_recognizer_impl.cc15
-rw-r--r--ui/events/gestures/motion_event_aura.cc4
-rw-r--r--ui/events/gestures/motion_event_aura_unittest.cc39
-rw-r--r--ui/events/ozone/evdev/event_factory_evdev.cc20
-rw-r--r--ui/events/test/event_generator.cc10
-rw-r--r--ui/events/test/events_test_utils.h7
-rw-r--r--ui/gfx/geometry/point.cc1
-rw-r--r--ui/gfx/geometry/point.h5
-rw-r--r--ui/gfx/geometry/point_f.h4
-rw-r--r--ui/gfx/geometry/point_unittest.cc27
-rw-r--r--ui/ozone/platform/drm/host/drm_cursor.cc9
-rw-r--r--ui/ozone/platform/drm/host/drm_window_host.cc12
-rw-r--r--ui/ozone/platform/egltest/ozone_platform_egltest.cc4
-rw-r--r--ui/platform_window/android/platform_window_android.cc8
-rw-r--r--ui/views/controls/textfield/textfield.cc4
-rw-r--r--ui/views/mus/window_manager_connection.cc4
-rw-r--r--ui/views/touchui/touch_selection_controller_impl_unittest.cc2
-rw-r--r--ui/views/widget/desktop_aura/desktop_window_tree_host_x11.cc2
-rw-r--r--win8/metro_driver/chrome_app_view_ash.cc5
51 files changed, 485 insertions, 481 deletions
diff --git a/ash/drag_drop/drag_drop_controller.cc b/ash/drag_drop/drag_drop_controller.cc
index a863fa3..3882ea3 100644
--- a/ash/drag_drop/drag_drop_controller.cc
+++ b/ash/drag_drop/drag_drop_controller.cc
@@ -51,15 +51,16 @@ gfx::Rect AdjustDragImageBoundsForScaleAndOffset(
int vertical_offset,
float scale,
gfx::Vector2d* drag_image_offset) {
- gfx::PointF final_origin = drag_image_bounds.origin();
+ gfx::Point final_origin = drag_image_bounds.origin();
gfx::SizeF final_size = gfx::SizeF(drag_image_bounds.size());
final_size.Scale(scale);
drag_image_offset->set_x(drag_image_offset->x() * scale);
drag_image_offset->set_y(drag_image_offset->y() * scale);
- float total_x_offset = drag_image_offset->x();
- float total_y_offset = drag_image_offset->y() - vertical_offset;
+ int total_x_offset = drag_image_offset->x();
+ int total_y_offset = drag_image_offset->y() - vertical_offset;
final_origin.Offset(-total_x_offset, -total_y_offset);
- return gfx::ToEnclosingRect(gfx::RectF(final_origin, final_size));
+ return gfx::ToEnclosingRect(
+ gfx::RectF(gfx::PointF(final_origin), final_size));
}
void DispatchGestureEndToWindow(aura::Window* window) {
@@ -263,8 +264,10 @@ void DragDropController::DragUpdate(aura::Window* target,
aura::client::DragDropDelegate* delegate =
aura::client::GetDragDropDelegate(drag_window_);
if (delegate) {
- ui::DropTargetEvent e(*drag_data_, event.location_f(),
- event.root_location_f(), drag_operation_);
+ ui::DropTargetEvent e(*drag_data_, gfx::Point(), gfx::Point(),
+ drag_operation_);
+ e.set_location_f(event.location_f());
+ e.set_root_location_f(event.root_location_f());
e.set_flags(event.flags());
delegate->OnDragEntered(e);
}
@@ -272,8 +275,10 @@ void DragDropController::DragUpdate(aura::Window* target,
aura::client::DragDropDelegate* delegate =
aura::client::GetDragDropDelegate(drag_window_);
if (delegate) {
- ui::DropTargetEvent e(*drag_data_, event.location_f(),
- event.root_location_f(), drag_operation_);
+ ui::DropTargetEvent e(*drag_data_, gfx::Point(), gfx::Point(),
+ drag_operation_);
+ e.set_location_f(event.location_f());
+ e.set_root_location_f(event.root_location_f());
e.set_flags(event.flags());
op = delegate->OnDragUpdated(e);
gfx::NativeCursor cursor = ui::kCursorNoDrop;
@@ -312,8 +317,10 @@ void DragDropController::Drop(aura::Window* target,
aura::client::DragDropDelegate* delegate =
aura::client::GetDragDropDelegate(target);
if (delegate) {
- ui::DropTargetEvent e(*drag_data_, event.location_f(),
- event.root_location_f(), drag_operation_);
+ ui::DropTargetEvent e(*drag_data_, gfx::Point(), gfx::Point(),
+ drag_operation_);
+ e.set_location_f(event.location_f());
+ e.set_root_location_f(event.root_location_f());
e.set_flags(event.flags());
drag_operation_ = delegate->OnPerformDrop(e);
if (drag_operation_ == 0)
@@ -420,8 +427,8 @@ void DragDropController::OnGestureEvent(ui::GestureEvent* event) {
gfx::PointF touch_offset_root_location = touch_offset_event.root_location_f();
touch_offset_location.Offset(0, kTouchDragImageVerticalOffset);
touch_offset_root_location.Offset(0, kTouchDragImageVerticalOffset);
- touch_offset_event.set_location(touch_offset_location);
- touch_offset_event.set_root_location(touch_offset_root_location);
+ touch_offset_event.set_location_f(touch_offset_location);
+ touch_offset_event.set_root_location_f(touch_offset_root_location);
aura::Window* translated_target =
drag_drop_tracker_->GetTarget(touch_offset_event);
diff --git a/cc/trees/layer_tree_impl_unittest.cc b/cc/trees/layer_tree_impl_unittest.cc
index 14c6135..34942c2 100644
--- a/cc/trees/layer_tree_impl_unittest.cc
+++ b/cc/trees/layer_tree_impl_unittest.cc
@@ -1636,7 +1636,7 @@ TEST_F(LayerTreeImplTest,
EXPECT_EQ(host_impl().active_tree()->root_layer(),
host_impl().active_tree()->PageScaleLayer());
- test_point = gfx::Point(35, 35);
+ test_point = gfx::PointF(35.f, 35.f);
test_point =
gfx::ScalePoint(test_point, device_scale_factor * page_scale_factor);
result_layer =
@@ -1645,7 +1645,7 @@ TEST_F(LayerTreeImplTest,
ASSERT_TRUE(result_layer);
EXPECT_EQ(12345, result_layer->id());
- test_point = gfx::Point(64, 64);
+ test_point = gfx::PointF(64.f, 64.f);
test_point =
gfx::ScalePoint(test_point, device_scale_factor * page_scale_factor);
result_layer =
diff --git a/chrome/browser/android/compositor/layer/toolbar_layer.cc b/chrome/browser/android/compositor/layer/toolbar_layer.cc
index 8f7b3a0..ea88538 100644
--- a/chrome/browser/android/compositor/layer/toolbar_layer.cc
+++ b/chrome/browser/android/compositor/layer/toolbar_layer.cc
@@ -54,7 +54,8 @@ void ToolbarLayer::PushResource(
layer_->SetBounds(size);
toolbar_background_layer_->SetBounds(resource->padding.size());
- toolbar_background_layer_->SetPosition(resource->padding.origin());
+ toolbar_background_layer_->SetPosition(
+ gfx::PointF(resource->padding.origin()));
toolbar_background_layer_->SetBackgroundColor(toolbar_background_color);
bool url_bar_visible = (resource->aperture.width() != 0);
diff --git a/chrome/browser/ui/views/ash/tab_scrubber_browsertest.cc b/chrome/browser/ui/views/ash/tab_scrubber_browsertest.cc
index 7bb69db..0b99e8d 100644
--- a/chrome/browser/ui/views/ash/tab_scrubber_browsertest.cc
+++ b/chrome/browser/ui/views/ash/tab_scrubber_browsertest.cc
@@ -108,12 +108,8 @@ class TabScrubberTest : public InProcessBrowserTest,
float offset = GetTabCenter(browser, index) -
GetStartX(browser, active_index, direction);
- ui::ScrollEvent scroll_event(ui::ET_SCROLL,
- gfx::PointF(0, 0),
- ui::EventTimeForNow(),
- 0,
- offset, 0,
- offset, 0,
+ ui::ScrollEvent scroll_event(ui::ET_SCROLL, gfx::Point(0, 0),
+ ui::EventTimeForNow(), 0, offset, 0, offset, 0,
3);
event_generator.Dispatch(&scroll_event);
}
diff --git a/chrome/browser/ui/views/link_disambiguation/link_disambiguation_popup.cc b/chrome/browser/ui/views/link_disambiguation/link_disambiguation_popup.cc
index 7186ab3..41742d9 100644
--- a/chrome/browser/ui/views/link_disambiguation/link_disambiguation_popup.cc
+++ b/chrome/browser/ui/views/link_disambiguation/link_disambiguation_popup.cc
@@ -85,12 +85,14 @@ void LinkDisambiguationPopup::ZoomBubbleView::OnMouseEvent(
ui::MouseEvent* event) {
// Transform mouse event back to coordinate system of the web content window
// before providing to the callback.
+ ui::MouseEvent xform_event(event->type(), gfx::Point(), gfx::Point(),
+ ui::EventTimeForNow(), event->flags(),
+ event->changed_button_flags());
gfx::PointF xform_location(
(event->location().x() / scale_) + target_rect_.x(),
(event->location().y() / scale_) + target_rect_.y());
- ui::MouseEvent xform_event(event->type(), xform_location, xform_location,
- ui::EventTimeForNow(), event->flags(),
- event->changed_button_flags());
+ xform_event.set_location_f(xform_location);
+ xform_event.set_root_location_f(xform_location);
mouse_cb_.Run(&xform_event);
event->SetHandled();
diff --git a/components/html_viewer/input_events_unittest.cc b/components/html_viewer/input_events_unittest.cc
index 66ffe26..afaf724 100644
--- a/components/html_viewer/input_events_unittest.cc
+++ b/components/html_viewer/input_events_unittest.cc
@@ -46,9 +46,9 @@ TEST(InputEventLibTest, MouseEventConversion) {
TEST(InputEventLibTest, MouseWheelEventConversionNonPrecise) {
scoped_ptr<ui::Event> original_wheel(new ui::MouseWheelEvent(
- gfx::Vector2d(-1.0 * ui::MouseWheelEvent::kWheelDelta,
- -2.0 * ui::MouseWheelEvent::kWheelDelta),
- gfx::PointF(1.0, 2.0), gfx::PointF(3.0, 4.0), EventTimeForNow(), 0, 0));
+ gfx::Vector2d(-1 * ui::MouseWheelEvent::kWheelDelta,
+ -2 * ui::MouseWheelEvent::kWheelDelta),
+ gfx::Point(1, 2), gfx::Point(3, 4), EventTimeForNow(), 0, 0));
mus::mojom::EventPtr mojo_event(mus::mojom::Event::From(*original_wheel));
diff --git a/components/mus/example/wm/move_loop_unittest.cc b/components/mus/example/wm/move_loop_unittest.cc
index d53b862..175e6cf 100644
--- a/components/mus/example/wm/move_loop_unittest.cc
+++ b/components/mus/example/wm/move_loop_unittest.cc
@@ -29,13 +29,13 @@ void SetClientArea(mus::Window* window) {
}
mus::mojom::EventPtr CreatePointerDownEvent(const gfx::Point& location) {
- const ui::TouchEvent event(ui::ET_TOUCH_PRESSED, gfx::PointF(location), 1,
+ const ui::TouchEvent event(ui::ET_TOUCH_PRESSED, location, 1,
base::TimeDelta());
return mus::mojom::Event::From(static_cast<const ui::Event&>(event));
}
mus::mojom::EventPtr CreatePointerMove(const gfx::Point& location) {
- const ui::TouchEvent event(ui::ET_TOUCH_MOVED, gfx::PointF(location), 1,
+ const ui::TouchEvent event(ui::ET_TOUCH_MOVED, location, 1,
base::TimeDelta());
return mus::mojom::Event::From(static_cast<const ui::Event&>(event));
}
diff --git a/components/mus/ws/event_dispatcher_unittest.cc b/components/mus/ws/event_dispatcher_unittest.cc
index e925d67..2dec66c 100644
--- a/components/mus/ws/event_dispatcher_unittest.cc
+++ b/components/mus/ws/event_dispatcher_unittest.cc
@@ -144,7 +144,7 @@ TEST(EventDispatcherTest, OnEvent) {
// Send event that is over child.
const ui::MouseEvent ui_event(
- ui::ET_MOUSE_PRESSED, gfx::PointF(20.f, 25.f), gfx::PointF(20.f, 25.f),
+ ui::ET_MOUSE_PRESSED, gfx::Point(20, 25), gfx::Point(20, 25),
base::TimeDelta(), ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON);
dispatcher.OnEvent(
mojom::Event::From(static_cast<const ui::Event&>(ui_event)));
@@ -217,24 +217,24 @@ TEST(EventDispatcherTest, Capture) {
MouseEventTest tests[] = {
// Send a mouse down event over child.
- {ui::MouseEvent(ui::ET_MOUSE_PRESSED, gfx::PointF(20.f, 25.f),
- gfx::PointF(20.f, 25.f), base::TimeDelta(),
+ {ui::MouseEvent(ui::ET_MOUSE_PRESSED, gfx::Point(20, 25),
+ gfx::Point(20, 25), base::TimeDelta(),
ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON),
&child, gfx::Point(20, 25), gfx::Point(10, 15)},
// Capture should be activated. Let's send a mouse move outside the bounds
// of the child.
- {ui::MouseEvent(ui::ET_MOUSE_MOVED, gfx::PointF(50.f, 50.f),
- gfx::PointF(50.f, 50.f), base::TimeDelta(),
+ {ui::MouseEvent(ui::ET_MOUSE_MOVED, gfx::Point(50, 50),
+ gfx::Point(50, 50), base::TimeDelta(),
ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON),
&child, gfx::Point(50, 50), gfx::Point(40, 40)},
// Release the mouse and verify that the mouse up event goes to the child.
- {ui::MouseEvent(ui::ET_MOUSE_RELEASED, gfx::PointF(50.f, 50.f),
- gfx::PointF(50.f, 50.f), base::TimeDelta(),
+ {ui::MouseEvent(ui::ET_MOUSE_RELEASED, gfx::Point(50, 50),
+ gfx::Point(50, 50), base::TimeDelta(),
ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON),
&child, gfx::Point(50, 50), gfx::Point(40, 40)},
// A mouse move at (50, 50) should now go to the root window.
- {ui::MouseEvent(ui::ET_MOUSE_MOVED, gfx::PointF(50.f, 50.f),
- gfx::PointF(50.f, 50.f), base::TimeDelta(),
+ {ui::MouseEvent(ui::ET_MOUSE_MOVED, gfx::Point(50, 50),
+ gfx::Point(50, 50), base::TimeDelta(),
ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON),
&root, gfx::Point(50, 50), gfx::Point(50, 50)},
@@ -262,26 +262,26 @@ TEST(EventDispatcherTest, CaptureMultipleMouseButtons) {
MouseEventTest tests[] = {
// Send a mouse down event over child with a left mouse button
- {ui::MouseEvent(ui::ET_MOUSE_PRESSED, gfx::PointF(20.f, 25.f),
- gfx::PointF(20.f, 25.f), base::TimeDelta(),
+ {ui::MouseEvent(ui::ET_MOUSE_PRESSED, gfx::Point(20, 25),
+ gfx::Point(20, 25), base::TimeDelta(),
ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON),
&child, gfx::Point(20, 25), gfx::Point(10, 15)},
// Capture should be activated. Let's send a mouse move outside the bounds
// of the child and press the right mouse button too.
- {ui::MouseEvent(ui::ET_MOUSE_MOVED, gfx::PointF(50.f, 50.f),
- gfx::PointF(50.f, 50.f), base::TimeDelta(),
+ {ui::MouseEvent(ui::ET_MOUSE_MOVED, gfx::Point(50, 50),
+ gfx::Point(50, 50), base::TimeDelta(),
ui::EF_LEFT_MOUSE_BUTTON | ui::EF_RIGHT_MOUSE_BUTTON, 0),
&child, gfx::Point(50, 50), gfx::Point(40, 40)},
// Release the left mouse button and verify that the mouse up event goes
// to the child.
- {ui::MouseEvent(ui::ET_MOUSE_RELEASED, gfx::PointF(50.f, 50.f),
- gfx::PointF(50.f, 50.f), base::TimeDelta(),
+ {ui::MouseEvent(ui::ET_MOUSE_RELEASED, gfx::Point(50, 50),
+ gfx::Point(50, 50), base::TimeDelta(),
ui::EF_LEFT_MOUSE_BUTTON | ui::EF_RIGHT_MOUSE_BUTTON,
ui::EF_RIGHT_MOUSE_BUTTON),
&child, gfx::Point(50, 50), gfx::Point(40, 40)},
// A mouse move at (50, 50) should still go to the child.
- {ui::MouseEvent(ui::ET_MOUSE_MOVED, gfx::PointF(50.f, 50.f),
- gfx::PointF(50.f, 50.f), base::TimeDelta(),
+ {ui::MouseEvent(ui::ET_MOUSE_MOVED, gfx::Point(50, 50),
+ gfx::Point(50, 50), base::TimeDelta(),
ui::EF_LEFT_MOUSE_BUTTON, 0),
&child, gfx::Point(50, 50), gfx::Point(40, 40)},
@@ -311,7 +311,7 @@ TEST(EventDispatcherTest, ClientAreaGoesToOwner) {
// Start move loop by sending mouse event over non-client area.
const ui::MouseEvent press_event(
- ui::ET_MOUSE_PRESSED, gfx::PointF(12.f, 12.f), gfx::PointF(12.f, 12.f),
+ ui::ET_MOUSE_PRESSED, gfx::Point(12, 12), gfx::Point(12, 12),
base::TimeDelta(), ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON);
dispatcher.OnEvent(
mojom::Event::From(static_cast<const ui::Event&>(press_event)));
@@ -321,8 +321,8 @@ TEST(EventDispatcherTest, ClientAreaGoesToOwner) {
EXPECT_TRUE(event_dispatcher_delegate.GetAndClearLastInNonclientArea());
// Move the mouse 5,6 pixels and target is the same.
- const ui::MouseEvent move_event(ui::ET_MOUSE_MOVED, gfx::PointF(17.f, 18.f),
- gfx::PointF(17.f, 18.f), base::TimeDelta(),
+ const ui::MouseEvent move_event(ui::ET_MOUSE_MOVED, gfx::Point(17, 18),
+ gfx::Point(17, 18), base::TimeDelta(),
ui::EF_LEFT_MOUSE_BUTTON, 0);
dispatcher.OnEvent(
mojom::Event::From(static_cast<const ui::Event&>(move_event)));
@@ -333,7 +333,7 @@ TEST(EventDispatcherTest, ClientAreaGoesToOwner) {
// Release the mouse.
const ui::MouseEvent release_event(
- ui::ET_MOUSE_RELEASED, gfx::PointF(17.f, 18.f), gfx::PointF(17.f, 18.f),
+ ui::ET_MOUSE_RELEASED, gfx::Point(17, 18), gfx::Point(17, 18),
base::TimeDelta(), ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON);
dispatcher.OnEvent(
mojom::Event::From(static_cast<const ui::Event&>(release_event)));
@@ -344,7 +344,7 @@ TEST(EventDispatcherTest, ClientAreaGoesToOwner) {
// Press in the client area and verify target/client area.
const ui::MouseEvent press_event2(
- ui::ET_MOUSE_PRESSED, gfx::PointF(21.f, 22.f), gfx::PointF(21.f, 22.f),
+ ui::ET_MOUSE_PRESSED, gfx::Point(21, 22), gfx::Point(21, 22),
base::TimeDelta(), ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON);
dispatcher.OnEvent(
mojom::Event::From(static_cast<const ui::Event&>(press_event2)));
@@ -376,7 +376,7 @@ TEST(EventDispatcherTest, DontFocusOnSecondDown) {
// Press on child1. First press event should change focus.
const ui::MouseEvent press_event(
- ui::ET_MOUSE_PRESSED, gfx::PointF(12.f, 12.f), gfx::PointF(12.f, 12.f),
+ ui::ET_MOUSE_PRESSED, gfx::Point(12, 12), gfx::Point(12, 12),
base::TimeDelta(), ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON);
dispatcher.OnEvent(
mojom::Event::From(static_cast<const ui::Event&>(press_event)));
@@ -385,8 +385,8 @@ TEST(EventDispatcherTest, DontFocusOnSecondDown) {
// Press (with a different pointer id) on child2. Event should go to child2,
// but focus should not change.
- const ui::TouchEvent touch_event(
- ui::ET_TOUCH_PRESSED, gfx::PointF(53.f, 54.f), 2, base::TimeDelta());
+ const ui::TouchEvent touch_event(ui::ET_TOUCH_PRESSED, gfx::Point(53, 54), 2,
+ base::TimeDelta());
dispatcher.OnEvent(
mojom::Event::From(static_cast<const ui::Event&>(touch_event)));
EXPECT_EQ(&child2, event_dispatcher_delegate.last_target());
@@ -416,29 +416,29 @@ TEST(EventDispatcherTest, TwoPointersActive) {
dispatcher.set_root(&root);
// Press on child1.
- const ui::TouchEvent touch_event1(
- ui::ET_TOUCH_PRESSED, gfx::PointF(12.f, 13.f), 1, base::TimeDelta());
+ const ui::TouchEvent touch_event1(ui::ET_TOUCH_PRESSED, gfx::Point(12, 13), 1,
+ base::TimeDelta());
dispatcher.OnEvent(
mojom::Event::From(static_cast<const ui::Event&>(touch_event1)));
EXPECT_EQ(&child1, event_dispatcher_delegate.GetAndClearLastTarget());
// Drag over child2, child1 should get the drag.
- const ui::TouchEvent drag_event1(ui::ET_TOUCH_MOVED, gfx::PointF(53.f, 54.f),
- 1, base::TimeDelta());
+ const ui::TouchEvent drag_event1(ui::ET_TOUCH_MOVED, gfx::Point(53, 54), 1,
+ base::TimeDelta());
dispatcher.OnEvent(
mojom::Event::From(static_cast<const ui::Event&>(drag_event1)));
EXPECT_EQ(&child1, event_dispatcher_delegate.GetAndClearLastTarget());
// Press on child2 with a different touch id.
- const ui::TouchEvent touch_event2(
- ui::ET_TOUCH_PRESSED, gfx::PointF(54.f, 55.f), 2, base::TimeDelta());
+ const ui::TouchEvent touch_event2(ui::ET_TOUCH_PRESSED, gfx::Point(54, 55), 2,
+ base::TimeDelta());
dispatcher.OnEvent(
mojom::Event::From(static_cast<const ui::Event&>(touch_event2)));
EXPECT_EQ(&child2, event_dispatcher_delegate.GetAndClearLastTarget());
// Drag over child1 with id 2, child2 should continue to get the drag.
- const ui::TouchEvent drag_event2(ui::ET_TOUCH_MOVED, gfx::PointF(13.f, 14.f),
- 2, base::TimeDelta());
+ const ui::TouchEvent drag_event2(ui::ET_TOUCH_MOVED, gfx::Point(13, 14), 2,
+ base::TimeDelta());
dispatcher.OnEvent(
mojom::Event::From(static_cast<const ui::Event&>(drag_event2)));
EXPECT_EQ(&child2, event_dispatcher_delegate.GetAndClearLastTarget());
@@ -449,13 +449,13 @@ TEST(EventDispatcherTest, TwoPointersActive) {
EXPECT_EQ(&child1, event_dispatcher_delegate.GetAndClearLastTarget());
// Release touch id 1, and click on 2. 2 should get it.
- const ui::TouchEvent touch_release(
- ui::ET_TOUCH_RELEASED, gfx::PointF(54.f, 55.f), 1, base::TimeDelta());
+ const ui::TouchEvent touch_release(ui::ET_TOUCH_RELEASED, gfx::Point(54, 55),
+ 1, base::TimeDelta());
dispatcher.OnEvent(
mojom::Event::From(static_cast<const ui::Event&>(touch_release)));
EXPECT_EQ(&child1, event_dispatcher_delegate.GetAndClearLastTarget());
- const ui::TouchEvent touch_event3(
- ui::ET_TOUCH_PRESSED, gfx::PointF(54.f, 55.f), 2, base::TimeDelta());
+ const ui::TouchEvent touch_event3(ui::ET_TOUCH_PRESSED, gfx::Point(54, 55), 2,
+ base::TimeDelta());
dispatcher.OnEvent(
mojom::Event::From(static_cast<const ui::Event&>(touch_event3)));
EXPECT_EQ(&child2, event_dispatcher_delegate.GetAndClearLastTarget());
@@ -480,8 +480,8 @@ TEST(EventDispatcherTest, DestroyWindowWhileGettingEvents) {
dispatcher.set_root(&root);
// Press on child.
- const ui::TouchEvent touch_event1(
- ui::ET_TOUCH_PRESSED, gfx::PointF(12.f, 13.f), 1, base::TimeDelta());
+ const ui::TouchEvent touch_event1(ui::ET_TOUCH_PRESSED, gfx::Point(12, 13), 1,
+ base::TimeDelta());
dispatcher.OnEvent(
mojom::Event::From(static_cast<const ui::Event&>(touch_event1)));
EXPECT_EQ(child.get(), event_dispatcher_delegate.GetAndClearLastTarget());
@@ -491,8 +491,8 @@ TEST(EventDispatcherTest, DestroyWindowWhileGettingEvents) {
// Delete child, and continue the drag. Event should not be dispatched.
child.reset();
- const ui::TouchEvent drag_event1(ui::ET_TOUCH_MOVED, gfx::PointF(53.f, 54.f),
- 1, base::TimeDelta());
+ const ui::TouchEvent drag_event1(ui::ET_TOUCH_MOVED, gfx::Point(53, 54), 1,
+ base::TimeDelta());
dispatcher.OnEvent(
mojom::Event::From(static_cast<const ui::Event&>(drag_event1)));
EXPECT_EQ(nullptr, event_dispatcher_delegate.GetAndClearLastTarget());
diff --git a/content/browser/accessibility/touch_accessibility_aura_browsertest.cc b/content/browser/accessibility/touch_accessibility_aura_browsertest.cc
index fe92e3b..58407e5 100644
--- a/content/browser/accessibility/touch_accessibility_aura_browsertest.cc
+++ b/content/browser/accessibility/touch_accessibility_aura_browsertest.cc
@@ -80,8 +80,8 @@ IN_PROC_BROWSER_TEST_F(TouchAccessibilityBrowserTest,
// cell. A touch exploration event is just a mouse move event with
// the ui::EF_TOUCH_ACCESSIBILITY flag set.
gfx::Rect bounds = window->GetBoundsInRootWindow();
- gfx::PointF location(bounds.x() + 50 * col + 25,
- bounds.y() + 50 * row + 25);
+ gfx::Point location(bounds.x() + 50 * col + 25,
+ bounds.y() + 50 * row + 25);
int flags = ui::EF_TOUCH_ACCESSIBILITY;
scoped_ptr<ui::Event> mouse_move_event(new ui::MouseEvent(
ui::ET_MOUSE_MOVED, location, location, ui::EventTimeForNow(),
diff --git a/content/browser/renderer_host/input/input_router_impl_unittest.cc b/content/browser/renderer_host/input/input_router_impl_unittest.cc
index 2460f3f..554ce74a 100644
--- a/content/browser/renderer_host/input/input_router_impl_unittest.cc
+++ b/content/browser/renderer_host/input/input_router_impl_unittest.cc
@@ -858,8 +858,8 @@ TEST_F(InputRouterImplTest, AckedTouchEventState) {
SetTouchTimestamp(timestamp);
uint32 touch_press_event_id1 = SendTouchEvent();
EXPECT_EQ(1U, GetSentMessageCountAndResetSink());
- expected_events.push_back(new ui::TouchEvent(
- ui::ET_TOUCH_PRESSED, gfx::PointF(1.f, 1.f), 0, timestamp));
+ expected_events.push_back(
+ new ui::TouchEvent(ui::ET_TOUCH_PRESSED, gfx::Point(1, 1), 0, timestamp));
// Move the finger.
timestamp += base::TimeDelta::FromSeconds(10);
@@ -868,7 +868,7 @@ TEST_F(InputRouterImplTest, AckedTouchEventState) {
uint32 touch_move_event_id1 = SendTouchEvent();
EXPECT_FALSE(TouchEventQueueEmpty());
expected_events.push_back(new ui::TouchEvent(
- ui::ET_TOUCH_MOVED, gfx::PointF(500.f, 500.f), 0, timestamp));
+ ui::ET_TOUCH_MOVED, gfx::Point(500, 500), 0, timestamp));
// Now press a second finger.
timestamp += base::TimeDelta::FromSeconds(10);
@@ -876,8 +876,8 @@ TEST_F(InputRouterImplTest, AckedTouchEventState) {
SetTouchTimestamp(timestamp);
uint32 touch_press_event_id2 = SendTouchEvent();
EXPECT_FALSE(TouchEventQueueEmpty());
- expected_events.push_back(new ui::TouchEvent(
- ui::ET_TOUCH_PRESSED, gfx::PointF(2.f, 2.f), 1, timestamp));
+ expected_events.push_back(
+ new ui::TouchEvent(ui::ET_TOUCH_PRESSED, gfx::Point(2, 2), 1, timestamp));
// Move both fingers.
timestamp += base::TimeDelta::FromSeconds(10);
@@ -886,10 +886,10 @@ TEST_F(InputRouterImplTest, AckedTouchEventState) {
SetTouchTimestamp(timestamp);
uint32 touch_move_event_id2 = SendTouchEvent();
EXPECT_FALSE(TouchEventQueueEmpty());
- expected_events.push_back(new ui::TouchEvent(
- ui::ET_TOUCH_MOVED, gfx::PointF(10.f, 10.f), 0, timestamp));
- expected_events.push_back(new ui::TouchEvent(
- ui::ET_TOUCH_MOVED, gfx::PointF(20.f, 20.f), 1, timestamp));
+ expected_events.push_back(
+ new ui::TouchEvent(ui::ET_TOUCH_MOVED, gfx::Point(10, 10), 0, timestamp));
+ expected_events.push_back(
+ new ui::TouchEvent(ui::ET_TOUCH_MOVED, gfx::Point(20, 20), 1, timestamp));
// Receive the ACKs and make sure the generated events from the acked events
// are correct.
diff --git a/content/browser/renderer_host/input/synthetic_gesture_target_aura.cc b/content/browser/renderer_host/input/synthetic_gesture_target_aura.cc
index 8bcda99..334a3d1 100644
--- a/content/browser/renderer_host/input/synthetic_gesture_target_aura.cc
+++ b/content/browser/renderer_host/input/synthetic_gesture_target_aura.cc
@@ -57,10 +57,12 @@ void SyntheticGestureTargetAura::DispatchWebTouchEventToPlatform(
void SyntheticGestureTargetAura::DispatchWebMouseWheelEventToPlatform(
const blink::WebMouseWheelEvent& web_wheel,
const ui::LatencyInfo&) {
+ ui::MouseEvent mouse_event(ui::ET_MOUSEWHEEL, gfx::Point(), gfx::Point(),
+ ui::EventTimeForNow(), ui::EF_NONE, ui::EF_NONE);
gfx::PointF location(web_wheel.x * device_scale_factor_,
web_wheel.y * device_scale_factor_);
- ui::MouseEvent mouse_event(ui::ET_MOUSEWHEEL, location, location,
- ui::EventTimeForNow(), ui::EF_NONE, ui::EF_NONE);
+ mouse_event.set_location_f(location);
+ mouse_event.set_root_location_f(location);
ui::MouseWheelEvent wheel_event(
mouse_event, web_wheel.deltaX, web_wheel.deltaY);
@@ -126,12 +128,14 @@ int WebMouseEventButtonToFlags(blink::WebMouseEvent::Button button) {
void SyntheticGestureTargetAura::DispatchWebMouseEventToPlatform(
const blink::WebMouseEvent& web_mouse,
const ui::LatencyInfo& latency_info) {
- gfx::PointF location(web_mouse.x * device_scale_factor_,
- web_mouse.y * device_scale_factor_);
ui::EventType event_type = WebMouseEventTypeToEventType(web_mouse.type);
int flags = WebMouseEventButtonToFlags(web_mouse.button);
- ui::MouseEvent mouse_event(event_type, location, location,
+ ui::MouseEvent mouse_event(event_type, gfx::Point(), gfx::Point(),
ui::EventTimeForNow(), flags, flags);
+ gfx::PointF location(web_mouse.x * device_scale_factor_,
+ web_mouse.y * device_scale_factor_);
+ mouse_event.set_location_f(location);
+ mouse_event.set_root_location_f(location);
aura::Window* window = GetWindow();
mouse_event.ConvertLocationToTarget(window, window->GetRootWindow());
diff --git a/content/browser/renderer_host/input/touch_selection_controller_client_aura_browsertest.cc b/content/browser/renderer_host/input/touch_selection_controller_client_aura_browsertest.cc
index c8b2cee..437c5e5 100644
--- a/content/browser/renderer_host/input/touch_selection_controller_client_aura_browsertest.cc
+++ b/content/browser/renderer_host/input/touch_selection_controller_client_aura_browsertest.cc
@@ -355,7 +355,7 @@ IN_PROC_BROWSER_TEST_F(TouchSelectionControllerClientAuraTest, HiddenOnScroll) {
// Put a finger down: the quick menu should go away, while touch handles stay
// there.
- ui::TouchEvent touch_down(ui::ET_TOUCH_PRESSED, gfx::PointF(10, 10), 0,
+ ui::TouchEvent touch_down(ui::ET_TOUCH_PRESSED, gfx::Point(10, 10), 0,
ui::EventTimeForNow());
rwhva->OnTouchEvent(&touch_down);
EXPECT_EQ(ui::TouchSelectionController::SELECTION_ACTIVE,
@@ -385,7 +385,7 @@ IN_PROC_BROWSER_TEST_F(TouchSelectionControllerClientAuraTest, HiddenOnScroll) {
EXPECT_FALSE(ui::TouchSelectionMenuRunner::GetInstance()->IsRunning());
// Lift the finger up: the quick menu should re-appear.
- ui::TouchEvent touch_up(ui::ET_TOUCH_RELEASED, gfx::PointF(10, 10), 0,
+ ui::TouchEvent touch_up(ui::ET_TOUCH_RELEASED, gfx::Point(10, 10), 0,
ui::EventTimeForNow());
rwhva->OnTouchEvent(&touch_up);
EXPECT_EQ(ui::TouchSelectionController::SELECTION_ACTIVE,
diff --git a/content/browser/renderer_host/render_widget_host_view_aura_unittest.cc b/content/browser/renderer_host/render_widget_host_view_aura_unittest.cc
index 3453201..61a42bb 100644
--- a/content/browser/renderer_host/render_widget_host_view_aura_unittest.cc
+++ b/content/browser/renderer_host/render_widget_host_view_aura_unittest.cc
@@ -1083,7 +1083,7 @@ TEST_F(RenderWidgetHostViewAuraTest, FinishCompositionByMouse) {
sink_->ClearMessages();
// Simulates the mouse press.
- ui::MouseEvent mouse_event(ui::ET_MOUSE_PRESSED, gfx::PointF(), gfx::PointF(),
+ ui::MouseEvent mouse_event(ui::ET_MOUSE_PRESSED, gfx::Point(), gfx::Point(),
ui::EventTimeForNow(), ui::EF_LEFT_MOUSE_BUTTON,
0);
view_->OnMouseEvent(&mouse_event);
@@ -1110,11 +1110,11 @@ TEST_F(RenderWidgetHostViewAuraTest, TouchEventState) {
// Start with no touch-event handler in the renderer.
widget_host_->OnMessageReceived(ViewHostMsg_HasTouchEventHandlers(0, false));
- ui::TouchEvent press(ui::ET_TOUCH_PRESSED, gfx::PointF(30.f, 30.f), 0,
+ ui::TouchEvent press(ui::ET_TOUCH_PRESSED, gfx::Point(30, 30), 0,
ui::EventTimeForNow());
- ui::TouchEvent move(ui::ET_TOUCH_MOVED, gfx::PointF(20.f, 20.f), 0,
+ ui::TouchEvent move(ui::ET_TOUCH_MOVED, gfx::Point(20, 20), 0,
ui::EventTimeForNow());
- ui::TouchEvent release(ui::ET_TOUCH_RELEASED, gfx::PointF(20.f, 20.f), 0,
+ ui::TouchEvent release(ui::ET_TOUCH_RELEASED, gfx::Point(20, 20), 0,
ui::EventTimeForNow());
// The touch events should get forwarded from the view, but they should not
@@ -1169,14 +1169,14 @@ TEST_F(RenderWidgetHostViewAuraTest, TouchEventState) {
widget_host_->OnMessageReceived(InputHostMsg_HandleInputEvent_ACK(0, ack));
EXPECT_EQ(0U, GetSentMessageCountAndResetSink());
- ui::TouchEvent move2(ui::ET_TOUCH_MOVED, gfx::PointF(20.f, 20.f), 0,
+ ui::TouchEvent move2(ui::ET_TOUCH_MOVED, gfx::Point(20, 20), 0,
base::Time::NowFromSystemTime() - base::Time());
view_->OnTouchEvent(&move2);
EXPECT_TRUE(press.synchronous_handling_disabled());
EXPECT_EQ(ui::MotionEvent::ACTION_MOVE, pointer_state().GetAction());
EXPECT_EQ(1U, pointer_state().GetPointerCount());
- ui::TouchEvent release2(ui::ET_TOUCH_RELEASED, gfx::PointF(20.f, 20.f), 0,
+ ui::TouchEvent release2(ui::ET_TOUCH_RELEASED, gfx::Point(20, 20), 0,
base::Time::NowFromSystemTime() - base::Time());
view_->OnTouchEvent(&release2);
EXPECT_TRUE(press.synchronous_handling_disabled());
@@ -1191,7 +1191,7 @@ TEST_F(RenderWidgetHostViewAuraTest, MultiTouchPointsStates) {
view_->UseFakeDispatcher();
GetSentMessageCountAndResetSink();
- ui::TouchEvent press0(ui::ET_TOUCH_PRESSED, gfx::PointF(30.f, 30.f), 0,
+ ui::TouchEvent press0(ui::ET_TOUCH_PRESSED, gfx::Point(30, 30), 0,
ui::EventTimeForNow());
view_->OnTouchEvent(&press0);
@@ -1202,7 +1202,7 @@ TEST_F(RenderWidgetHostViewAuraTest, MultiTouchPointsStates) {
EXPECT_EQ(1U, pointer_state().GetPointerCount());
EXPECT_EQ(1U, view_->dispatcher_->GetAndResetProcessedTouchEventCount());
- ui::TouchEvent move0(ui::ET_TOUCH_MOVED, gfx::PointF(20.f, 20.f), 0,
+ ui::TouchEvent move0(ui::ET_TOUCH_MOVED, gfx::Point(20, 20), 0,
ui::EventTimeForNow());
view_->OnTouchEvent(&move0);
@@ -1215,7 +1215,7 @@ TEST_F(RenderWidgetHostViewAuraTest, MultiTouchPointsStates) {
// For the second touchstart, only the state of the second touch point is
// StatePressed, the state of the first touch point is StateStationary.
- ui::TouchEvent press1(ui::ET_TOUCH_PRESSED, gfx::PointF(10.f, 10.f), 1,
+ ui::TouchEvent press1(ui::ET_TOUCH_PRESSED, gfx::Point(10, 10), 1,
ui::EventTimeForNow());
view_->OnTouchEvent(&press1);
@@ -1229,7 +1229,7 @@ TEST_F(RenderWidgetHostViewAuraTest, MultiTouchPointsStates) {
// For the touchmove of second point, the state of the second touch point is
// StateMoved, the state of the first touch point is StateStationary.
- ui::TouchEvent move1(ui::ET_TOUCH_MOVED, gfx::PointF(30.f, 30.f), 1,
+ ui::TouchEvent move1(ui::ET_TOUCH_MOVED, gfx::Point(30, 30), 1,
ui::EventTimeForNow());
view_->OnTouchEvent(&move1);
@@ -1242,7 +1242,7 @@ TEST_F(RenderWidgetHostViewAuraTest, MultiTouchPointsStates) {
// For the touchmove of first point, the state of the first touch point is
// StateMoved, the state of the second touch point is StateStationary.
- ui::TouchEvent move2(ui::ET_TOUCH_MOVED, gfx::PointF(10.f, 10.f), 0,
+ ui::TouchEvent move2(ui::ET_TOUCH_MOVED, gfx::Point(10, 10), 0,
ui::EventTimeForNow());
view_->OnTouchEvent(&move2);
@@ -1253,7 +1253,7 @@ TEST_F(RenderWidgetHostViewAuraTest, MultiTouchPointsStates) {
EXPECT_EQ(2U, pointer_state().GetPointerCount());
EXPECT_EQ(1U, view_->dispatcher_->GetAndResetProcessedTouchEventCount());
- ui::TouchEvent cancel0(ui::ET_TOUCH_CANCELLED, gfx::PointF(10.f, 10.f), 0,
+ ui::TouchEvent cancel0(ui::ET_TOUCH_CANCELLED, gfx::Point(10, 10), 0,
ui::EventTimeForNow());
// For the touchcancel, only the state of the current touch point is
@@ -1262,7 +1262,7 @@ TEST_F(RenderWidgetHostViewAuraTest, MultiTouchPointsStates) {
EXPECT_EQ(1U, pointer_state().GetPointerCount());
EXPECT_EQ(1U, view_->dispatcher_->GetAndResetProcessedTouchEventCount());
- ui::TouchEvent cancel1(ui::ET_TOUCH_CANCELLED, gfx::PointF(30.f, 30.f), 1,
+ ui::TouchEvent cancel1(ui::ET_TOUCH_CANCELLED, gfx::Point(30, 30), 1,
ui::EventTimeForNow());
view_->OnTouchEvent(&cancel1);
@@ -1278,11 +1278,11 @@ TEST_F(RenderWidgetHostViewAuraTest, TouchEventSyncAsync) {
widget_host_->OnMessageReceived(ViewHostMsg_HasTouchEventHandlers(0, true));
- ui::TouchEvent press(ui::ET_TOUCH_PRESSED, gfx::PointF(30.f, 30.f), 0,
+ ui::TouchEvent press(ui::ET_TOUCH_PRESSED, gfx::Point(30, 30), 0,
ui::EventTimeForNow());
- ui::TouchEvent move(ui::ET_TOUCH_MOVED, gfx::PointF(20.f, 20.f), 0,
+ ui::TouchEvent move(ui::ET_TOUCH_MOVED, gfx::Point(20, 20), 0,
ui::EventTimeForNow());
- ui::TouchEvent release(ui::ET_TOUCH_RELEASED, gfx::PointF(20.f, 20.f), 0,
+ ui::TouchEvent release(ui::ET_TOUCH_RELEASED, gfx::Point(20, 20), 0,
ui::EventTimeForNow());
view_->OnTouchEvent(&press);
@@ -2485,10 +2485,10 @@ TEST_F(RenderWidgetHostViewAuraTest, TouchEventPositionsArentRounded) {
view_->InitAsChild(NULL);
view_->Show();
- ui::TouchEvent press(ui::ET_TOUCH_PRESSED,
- gfx::PointF(kX, kY),
- 0,
+ ui::TouchEvent press(ui::ET_TOUCH_PRESSED, gfx::Point(), 0,
ui::EventTimeForNow());
+ press.set_location_f(gfx::PointF(kX, kY));
+ press.set_root_location_f(gfx::PointF(kX, kY));
view_->OnTouchEvent(&press);
EXPECT_EQ(ui::MotionEvent::ACTION_DOWN, pointer_state().GetAction());
@@ -3429,11 +3429,11 @@ TEST_F(RenderWidgetHostViewAuraTest,
widget_host_->OnMessageReceived(ViewHostMsg_HasTouchEventHandlers(0, true));
- ui::TouchEvent press(ui::ET_TOUCH_PRESSED, gfx::PointF(30.f, 30.f), 0,
+ ui::TouchEvent press(ui::ET_TOUCH_PRESSED, gfx::Point(30, 30), 0,
ui::EventTimeForNow());
// Construct a move with a touch id which doesn't exist.
- ui::TouchEvent invalid_move(ui::ET_TOUCH_MOVED, gfx::PointF(30.f, 30.f), 1,
+ ui::TouchEvent invalid_move(ui::ET_TOUCH_MOVED, gfx::Point(30, 30), 1,
ui::EventTimeForNow());
// Valid press is handled asynchronously.
@@ -3475,7 +3475,7 @@ TEST_F(RenderWidgetHostViewAuraTest, SetCanScrollForWebMouseWheelEvent) {
sink_->ClearMessages();
// Simulates the mouse wheel event with ctrl modifier applied.
- ui::MouseWheelEvent event(gfx::Vector2d(1, 1), gfx::PointF(), gfx::PointF(),
+ ui::MouseWheelEvent event(gfx::Vector2d(1, 1), gfx::Point(), gfx::Point(),
ui::EventTimeForNow(), ui::EF_CONTROL_DOWN, 0);
view_->OnMouseEvent(&event);
@@ -3493,7 +3493,7 @@ TEST_F(RenderWidgetHostViewAuraTest, SetCanScrollForWebMouseWheelEvent) {
INPUT_EVENT_ACK_STATE_CONSUMED);
// Simulates the mouse wheel event with no modifier applied.
- event = ui::MouseWheelEvent(gfx::Vector2d(1, 1), gfx::PointF(), gfx::PointF(),
+ event = ui::MouseWheelEvent(gfx::Vector2d(1, 1), gfx::Point(), gfx::Point(),
ui::EventTimeForNow(), ui::EF_NONE, 0);
view_->OnMouseEvent(&event);
@@ -3509,9 +3509,8 @@ TEST_F(RenderWidgetHostViewAuraTest, SetCanScrollForWebMouseWheelEvent) {
INPUT_EVENT_ACK_STATE_CONSUMED);
// Simulates the scroll event with ctrl modifier applied.
- ui::ScrollEvent scroll(ui::ET_SCROLL, gfx::PointF(2.f, 2.f),
- ui::EventTimeForNow(), ui::EF_CONTROL_DOWN, 0, 5, 0, 5,
- 2);
+ ui::ScrollEvent scroll(ui::ET_SCROLL, gfx::Point(2, 2), ui::EventTimeForNow(),
+ ui::EF_CONTROL_DOWN, 0, 5, 0, 5, 2);
view_->OnScrollEvent(&scroll);
input_event = GetInputEventFromMessage(*sink_->GetMessageAt(0));
@@ -3528,14 +3527,14 @@ TEST_F(RenderWidgetHostViewAuraTest, CorrectNumberOfAcksAreDispatched) {
view_->Show();
view_->UseFakeDispatcher();
- ui::TouchEvent press1(ui::ET_TOUCH_PRESSED, gfx::PointF(30.f, 30.f), 0,
+ ui::TouchEvent press1(ui::ET_TOUCH_PRESSED, gfx::Point(30, 30), 0,
ui::EventTimeForNow());
view_->OnTouchEvent(&press1);
SendTouchEventACK(blink::WebInputEvent::TouchStart,
INPUT_EVENT_ACK_STATE_CONSUMED, press1.unique_event_id());
- ui::TouchEvent press2(ui::ET_TOUCH_PRESSED, gfx::PointF(20.f, 20.f), 1,
+ ui::TouchEvent press2(ui::ET_TOUCH_PRESSED, gfx::Point(20, 20), 1,
ui::EventTimeForNow());
view_->OnTouchEvent(&press2);
SendTouchEventACK(blink::WebInputEvent::TouchStart,
diff --git a/content/browser/renderer_host/ui_events_helper.cc b/content/browser/renderer_host/ui_events_helper.cc
index 7aa038e..e3dc565 100644
--- a/content/browser/renderer_host/ui_events_helper.cc
+++ b/content/browser/renderer_host/ui_events_helper.cc
@@ -74,15 +74,11 @@ bool MakeUITouchEventsFromWebTouchEvents(
location = point.position;
else
location = point.screenPosition;
- ui::TouchEvent* uievent = new ui::TouchEvent(type,
- location,
- flags,
- point.id,
- timestamp,
- point.radiusX,
- point.radiusY,
- point.rotationAngle,
- point.force);
+ ui::TouchEvent* uievent = new ui::TouchEvent(
+ type, gfx::Point(), flags, point.id, timestamp, point.radiusX,
+ point.radiusY, point.rotationAngle, point.force);
+ uievent->set_location_f(location);
+ uievent->set_root_location_f(location);
uievent->set_latency(touch_with_latency.latency);
list->push_back(uievent);
}
diff --git a/content/browser/renderer_host/web_input_event_aura_unittest.cc b/content/browser/renderer_host/web_input_event_aura_unittest.cc
index 4303753..ae4a99c 100644
--- a/content/browser/renderer_host/web_input_event_aura_unittest.cc
+++ b/content/browser/renderer_host/web_input_event_aura_unittest.cc
@@ -250,10 +250,9 @@ TEST(WebInputEventAuraTest, TestMakeWebMouseEvent) {
{
// Left pressed.
base::TimeDelta timestamp = ui::EventTimeForNow();
- ui::MouseEvent aura_event(ui::ET_MOUSE_PRESSED, gfx::PointF(123.0, 321.0),
- gfx::PointF(123.0, 321.0), timestamp,
- ui::EF_LEFT_MOUSE_BUTTON,
- ui::EF_LEFT_MOUSE_BUTTON);
+ ui::MouseEvent aura_event(
+ ui::ET_MOUSE_PRESSED, gfx::Point(123, 321), gfx::Point(123, 321),
+ timestamp, ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON);
blink::WebMouseEvent webkit_event = MakeWebMouseEvent(aura_event);
EXPECT_EQ(ui::EventFlagsToWebEventModifiers(aura_event.flags()),
webkit_event.modifiers);
@@ -269,8 +268,8 @@ TEST(WebInputEventAuraTest, TestMakeWebMouseEvent) {
{
// Left released.
base::TimeDelta timestamp = ui::EventTimeForNow();
- ui::MouseEvent aura_event(ui::ET_MOUSE_RELEASED, gfx::PointF(123.0, 321.0),
- gfx::PointF(123.0, 321.0), timestamp, 0,
+ ui::MouseEvent aura_event(ui::ET_MOUSE_RELEASED, gfx::Point(123, 321),
+ gfx::Point(123, 321), timestamp, 0,
ui::EF_LEFT_MOUSE_BUTTON);
blink::WebMouseEvent webkit_event = MakeWebMouseEvent(aura_event);
EXPECT_EQ(ui::EventFlagsToWebEventModifiers(aura_event.flags()),
@@ -287,10 +286,9 @@ TEST(WebInputEventAuraTest, TestMakeWebMouseEvent) {
{
// Middle pressed.
base::TimeDelta timestamp = ui::EventTimeForNow();
- ui::MouseEvent aura_event(ui::ET_MOUSE_PRESSED, gfx::PointF(123.0, 321.0),
- gfx::PointF(123.0, 321.0), timestamp,
- ui::EF_MIDDLE_MOUSE_BUTTON,
- ui::EF_MIDDLE_MOUSE_BUTTON);
+ ui::MouseEvent aura_event(
+ ui::ET_MOUSE_PRESSED, gfx::Point(123, 321), gfx::Point(123, 321),
+ timestamp, ui::EF_MIDDLE_MOUSE_BUTTON, ui::EF_MIDDLE_MOUSE_BUTTON);
blink::WebMouseEvent webkit_event = MakeWebMouseEvent(aura_event);
EXPECT_EQ(ui::EventFlagsToWebEventModifiers(aura_event.flags()),
webkit_event.modifiers);
@@ -306,8 +304,8 @@ TEST(WebInputEventAuraTest, TestMakeWebMouseEvent) {
{
// Middle released.
base::TimeDelta timestamp = ui::EventTimeForNow();
- ui::MouseEvent aura_event(ui::ET_MOUSE_RELEASED, gfx::PointF(123.0, 321.0),
- gfx::PointF(123.0, 321.0), timestamp, 0,
+ ui::MouseEvent aura_event(ui::ET_MOUSE_RELEASED, gfx::Point(123, 321),
+ gfx::Point(123, 321), timestamp, 0,
ui::EF_MIDDLE_MOUSE_BUTTON);
blink::WebMouseEvent webkit_event = MakeWebMouseEvent(aura_event);
EXPECT_EQ(ui::EventFlagsToWebEventModifiers(aura_event.flags()),
@@ -324,10 +322,9 @@ TEST(WebInputEventAuraTest, TestMakeWebMouseEvent) {
{
// Right pressed.
base::TimeDelta timestamp = ui::EventTimeForNow();
- ui::MouseEvent aura_event(ui::ET_MOUSE_PRESSED, gfx::PointF(123.0, 321.0),
- gfx::PointF(123.0, 321.0), timestamp,
- ui::EF_RIGHT_MOUSE_BUTTON,
- ui::EF_RIGHT_MOUSE_BUTTON);
+ ui::MouseEvent aura_event(
+ ui::ET_MOUSE_PRESSED, gfx::Point(123, 321), gfx::Point(123, 321),
+ timestamp, ui::EF_RIGHT_MOUSE_BUTTON, ui::EF_RIGHT_MOUSE_BUTTON);
blink::WebMouseEvent webkit_event = MakeWebMouseEvent(aura_event);
EXPECT_EQ(ui::EventFlagsToWebEventModifiers(aura_event.flags()),
webkit_event.modifiers);
@@ -343,8 +340,8 @@ TEST(WebInputEventAuraTest, TestMakeWebMouseEvent) {
{
// Right released.
base::TimeDelta timestamp = ui::EventTimeForNow();
- ui::MouseEvent aura_event(ui::ET_MOUSE_RELEASED, gfx::PointF(123.0, 321.0),
- gfx::PointF(123.0, 321.0), timestamp, 0,
+ ui::MouseEvent aura_event(ui::ET_MOUSE_RELEASED, gfx::Point(123, 321),
+ gfx::Point(123, 321), timestamp, 0,
ui::EF_RIGHT_MOUSE_BUTTON);
blink::WebMouseEvent webkit_event = MakeWebMouseEvent(aura_event);
EXPECT_EQ(ui::EventFlagsToWebEventModifiers(aura_event.flags()),
@@ -361,8 +358,8 @@ TEST(WebInputEventAuraTest, TestMakeWebMouseEvent) {
{
// Moved
base::TimeDelta timestamp = ui::EventTimeForNow();
- ui::MouseEvent aura_event(ui::ET_MOUSE_MOVED, gfx::PointF(123.0, 321.0),
- gfx::PointF(123.0, 321.0), timestamp, 0, 0);
+ ui::MouseEvent aura_event(ui::ET_MOUSE_MOVED, gfx::Point(123, 321),
+ gfx::Point(123, 321), timestamp, 0, 0);
blink::WebMouseEvent webkit_event = MakeWebMouseEvent(aura_event);
EXPECT_EQ(ui::EventFlagsToWebEventModifiers(aura_event.flags()),
webkit_event.modifiers);
@@ -378,8 +375,8 @@ TEST(WebInputEventAuraTest, TestMakeWebMouseEvent) {
{
// Moved with left down
base::TimeDelta timestamp = ui::EventTimeForNow();
- ui::MouseEvent aura_event(ui::ET_MOUSE_MOVED, gfx::PointF(123.0, 321.0),
- gfx::PointF(123.0, 321.0), timestamp,
+ ui::MouseEvent aura_event(ui::ET_MOUSE_MOVED, gfx::Point(123, 321),
+ gfx::Point(123, 321), timestamp,
ui::EF_LEFT_MOUSE_BUTTON, 0);
blink::WebMouseEvent webkit_event = MakeWebMouseEvent(aura_event);
EXPECT_EQ(ui::EventFlagsToWebEventModifiers(aura_event.flags()),
@@ -396,8 +393,8 @@ TEST(WebInputEventAuraTest, TestMakeWebMouseEvent) {
{
// Left with shift pressed.
base::TimeDelta timestamp = ui::EventTimeForNow();
- ui::MouseEvent aura_event(ui::ET_MOUSE_PRESSED, gfx::PointF(123.0, 321.0),
- gfx::PointF(123.0, 321.0), timestamp,
+ ui::MouseEvent aura_event(ui::ET_MOUSE_PRESSED, gfx::Point(123, 321),
+ gfx::Point(123, 321), timestamp,
ui::EF_LEFT_MOUSE_BUTTON | ui::EF_SHIFT_DOWN,
ui::EF_LEFT_MOUSE_BUTTON);
blink::WebMouseEvent webkit_event = MakeWebMouseEvent(aura_event);
@@ -415,10 +412,9 @@ TEST(WebInputEventAuraTest, TestMakeWebMouseEvent) {
{
// Default values for PointerDetails.
base::TimeDelta timestamp = ui::EventTimeForNow();
- ui::MouseEvent aura_event(ui::ET_MOUSE_PRESSED, gfx::PointF(123.0, 321.0),
- gfx::PointF(123.0, 321.0), timestamp,
- ui::EF_LEFT_MOUSE_BUTTON,
- ui::EF_LEFT_MOUSE_BUTTON);
+ ui::MouseEvent aura_event(
+ ui::ET_MOUSE_PRESSED, gfx::Point(123, 321), gfx::Point(123, 321),
+ timestamp, ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON);
blink::WebMouseEvent webkit_event = MakeWebMouseEvent(aura_event);
EXPECT_EQ(blink::WebPointerProperties::PointerType::Mouse,
@@ -434,10 +430,9 @@ TEST(WebInputEventAuraTest, TestMakeWebMouseEvent) {
{
// Stylus values for PointerDetails.
base::TimeDelta timestamp = ui::EventTimeForNow();
- ui::MouseEvent aura_event(ui::ET_MOUSE_PRESSED, gfx::PointF(123.0, 321.0),
- gfx::PointF(123.0, 321.0), timestamp,
- ui::EF_LEFT_MOUSE_BUTTON,
- ui::EF_LEFT_MOUSE_BUTTON);
+ ui::MouseEvent aura_event(
+ ui::ET_MOUSE_PRESSED, gfx::Point(123, 321), gfx::Point(123, 321),
+ timestamp, ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON);
aura_event.set_pointer_details(
ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_PEN,
/* radius_x */ 0.0f,
@@ -466,7 +461,7 @@ TEST(WebInputEventAuraTest, TestMakeWebMouseWheelEvent) {
ui::MouseWheelEvent aura_event(
gfx::Vector2d(ui::MouseWheelEvent::kWheelDelta * 2,
-ui::MouseWheelEvent::kWheelDelta * 2),
- gfx::PointF(123.0, 321.0), gfx::PointF(123.0, 321.0), timestamp, 0, 0);
+ gfx::Point(123, 321), gfx::Point(123, 321), timestamp, 0, 0);
blink::WebMouseWheelEvent webkit_event = MakeWebMouseWheelEvent(aura_event);
EXPECT_EQ(ui::EventFlagsToWebEventModifiers(aura_event.flags()),
webkit_event.modifiers);
@@ -490,7 +485,7 @@ TEST(WebInputEventAuraTest, TestMakeWebMouseWheelEvent) {
base::TimeDelta timestamp = ui::EventTimeForNow();
ui::MouseWheelEvent aura_event(
gfx::Vector2d(0, -ui::MouseWheelEvent::kWheelDelta * 2),
- gfx::PointF(123.0, 321.0), gfx::PointF(123.0, 321.0), timestamp,
+ gfx::Point(123, 321), gfx::Point(123, 321), timestamp,
ui::EF_SHIFT_DOWN, 0);
blink::WebMouseWheelEvent webkit_event = MakeWebMouseWheelEvent(aura_event);
EXPECT_EQ(ui::EventFlagsToWebEventModifiers(aura_event.flags()),
diff --git a/content/browser/web_contents/web_contents_view_aura_browsertest.cc b/content/browser/web_contents/web_contents_view_aura_browsertest.cc
index e2e429e..f03a681 100644
--- a/content/browser/web_contents/web_contents_view_aura_browsertest.cc
+++ b/content/browser/web_contents/web_contents_view_aura_browsertest.cc
@@ -493,7 +493,7 @@ IN_PROC_BROWSER_TEST_F(WebContentsViewAuraTest,
base::TimeDelta timestamp = ui::EventTimeForNow();
ui::TouchEvent press(
ui::ET_TOUCH_PRESSED,
- gfx::PointF(bounds.x() + bounds.width() / 2.f, bounds.y() + 5.f), 0,
+ gfx::Point(bounds.x() + bounds.width() / 2, bounds.y() + 5), 0,
timestamp);
ui::EventDispatchDetails details = dispatcher->OnEventFromSource(&press);
ASSERT_FALSE(details.dispatcher_destroyed);
@@ -501,7 +501,7 @@ IN_PROC_BROWSER_TEST_F(WebContentsViewAuraTest,
timestamp += base::TimeDelta::FromMilliseconds(10);
ui::TouchEvent move1(ui::ET_TOUCH_MOVED,
- gfx::PointF(bounds.right() - 10.f, bounds.y() + 5.f), 0,
+ gfx::Point(bounds.right() - 10, bounds.y() + 5), 0,
timestamp);
details = dispatcher->OnEventFromSource(&move1);
ASSERT_FALSE(details.dispatcher_destroyed);
@@ -512,7 +512,7 @@ IN_PROC_BROWSER_TEST_F(WebContentsViewAuraTest,
for (int x = bounds.right() - 10; x >= bounds.x() + 10; x-= 10) {
timestamp += base::TimeDelta::FromMilliseconds(10);
- ui::TouchEvent inc(ui::ET_TOUCH_MOVED, gfx::PointF(x, bounds.y() + 5.f), 0,
+ ui::TouchEvent inc(ui::ET_TOUCH_MOVED, gfx::Point(x, bounds.y() + 5), 0,
timestamp);
details = dispatcher->OnEventFromSource(&inc);
ASSERT_FALSE(details.dispatcher_destroyed);
@@ -521,7 +521,7 @@ IN_PROC_BROWSER_TEST_F(WebContentsViewAuraTest,
for (int x = bounds.x() + 10; x <= bounds.width() - 10; x+= 10) {
timestamp += base::TimeDelta::FromMilliseconds(10);
- ui::TouchEvent inc(ui::ET_TOUCH_MOVED, gfx::PointF(x, bounds.y() + 5.f), 0,
+ ui::TouchEvent inc(ui::ET_TOUCH_MOVED, gfx::Point(x, bounds.y() + 5), 0,
timestamp);
details = dispatcher->OnEventFromSource(&inc);
ASSERT_FALSE(details.dispatcher_destroyed);
@@ -530,7 +530,7 @@ IN_PROC_BROWSER_TEST_F(WebContentsViewAuraTest,
for (int x = bounds.width() - 10; x >= bounds.x() + 10; x-= 10) {
timestamp += base::TimeDelta::FromMilliseconds(10);
- ui::TouchEvent inc(ui::ET_TOUCH_MOVED, gfx::PointF(x, bounds.y() + 5.f), 0,
+ ui::TouchEvent inc(ui::ET_TOUCH_MOVED, gfx::Point(x, bounds.y() + 5), 0,
timestamp);
details = dispatcher->OnEventFromSource(&inc);
ASSERT_FALSE(details.dispatcher_destroyed);
@@ -1034,8 +1034,7 @@ IN_PROC_BROWSER_TEST_F(WebContentsViewAuraTest, MAYBE_VerticalOverscroll) {
int kXStep = bounds.width() / 10;
gfx::Point location(bounds.right() - kXStep, bounds.y() + 5);
base::TimeDelta timestamp = ui::EventTimeForNow();
- ui::TouchEvent press(ui::ET_TOUCH_PRESSED, gfx::PointF(location), 0,
- timestamp);
+ ui::TouchEvent press(ui::ET_TOUCH_PRESSED, location, 0, timestamp);
ui::EventDispatchDetails details = dispatcher->OnEventFromSource(&press);
ASSERT_FALSE(details.dispatcher_destroyed);
WaitAFrame();
@@ -1043,8 +1042,7 @@ IN_PROC_BROWSER_TEST_F(WebContentsViewAuraTest, MAYBE_VerticalOverscroll) {
timestamp += base::TimeDelta::FromMilliseconds(10);
while (location.x() > bounds.x() + kXStep) {
- ui::TouchEvent inc(ui::ET_TOUCH_MOVED, gfx::PointF(location), 0,
- timestamp);
+ ui::TouchEvent inc(ui::ET_TOUCH_MOVED, location, 0, timestamp);
details = dispatcher->OnEventFromSource(&inc);
ASSERT_FALSE(details.dispatcher_destroyed);
WaitAFrame();
@@ -1052,8 +1050,7 @@ IN_PROC_BROWSER_TEST_F(WebContentsViewAuraTest, MAYBE_VerticalOverscroll) {
timestamp += base::TimeDelta::FromMilliseconds(10);
}
- ui::TouchEvent release(ui::ET_TOUCH_RELEASED, gfx::PointF(location), 0,
- timestamp);
+ ui::TouchEvent release(ui::ET_TOUCH_RELEASED, location, 0, timestamp);
details = dispatcher->OnEventFromSource(&release);
ASSERT_FALSE(details.dispatcher_destroyed);
WaitAFrame();
@@ -1069,8 +1066,7 @@ IN_PROC_BROWSER_TEST_F(WebContentsViewAuraTest, MAYBE_VerticalOverscroll) {
int kYStep = bounds.height() / 10;
gfx::Point location(bounds.x() + 10, bounds.y() + kYStep);
base::TimeDelta timestamp = ui::EventTimeForNow();
- ui::TouchEvent press(ui::ET_TOUCH_PRESSED, gfx::PointF(location), 0,
- timestamp);
+ ui::TouchEvent press(ui::ET_TOUCH_PRESSED, location, 0, timestamp);
ui::EventDispatchDetails details = dispatcher->OnEventFromSource(&press);
ASSERT_FALSE(details.dispatcher_destroyed);
WaitAFrame();
@@ -1078,8 +1074,7 @@ IN_PROC_BROWSER_TEST_F(WebContentsViewAuraTest, MAYBE_VerticalOverscroll) {
timestamp += base::TimeDelta::FromMilliseconds(10);
while (location.y() < bounds.bottom() - kYStep) {
- ui::TouchEvent inc(ui::ET_TOUCH_MOVED, gfx::PointF(location), 0,
- timestamp);
+ ui::TouchEvent inc(ui::ET_TOUCH_MOVED, location, 0, timestamp);
details = dispatcher->OnEventFromSource(&inc);
ASSERT_FALSE(details.dispatcher_destroyed);
WaitAFrame();
@@ -1087,8 +1082,7 @@ IN_PROC_BROWSER_TEST_F(WebContentsViewAuraTest, MAYBE_VerticalOverscroll) {
timestamp += base::TimeDelta::FromMilliseconds(10);
}
- ui::TouchEvent release(ui::ET_TOUCH_RELEASED, gfx::PointF(location), 0,
- timestamp);
+ ui::TouchEvent release(ui::ET_TOUCH_RELEASED, location, 0, timestamp);
details = dispatcher->OnEventFromSource(&release);
ASSERT_FALSE(details.dispatcher_destroyed);
WaitAFrame();
@@ -1106,8 +1100,7 @@ IN_PROC_BROWSER_TEST_F(WebContentsViewAuraTest, MAYBE_VerticalOverscroll) {
int kYStep = bounds.height() / 10;
gfx::Point location = bounds.origin() + gfx::Vector2d(0, kYStep);
base::TimeDelta timestamp = ui::EventTimeForNow();
- ui::TouchEvent press(ui::ET_TOUCH_PRESSED, gfx::PointF(location), 0,
- timestamp);
+ ui::TouchEvent press(ui::ET_TOUCH_PRESSED, location, 0, timestamp);
ui::EventDispatchDetails details = dispatcher->OnEventFromSource(&press);
ASSERT_FALSE(details.dispatcher_destroyed);
WaitAFrame();
@@ -1115,8 +1108,7 @@ IN_PROC_BROWSER_TEST_F(WebContentsViewAuraTest, MAYBE_VerticalOverscroll) {
timestamp += base::TimeDelta::FromMilliseconds(10);
for (size_t i = 0; i < 3; ++i) {
- ui::TouchEvent inc(ui::ET_TOUCH_MOVED, gfx::PointF(location), 0,
- timestamp);
+ ui::TouchEvent inc(ui::ET_TOUCH_MOVED, location, 0, timestamp);
details = dispatcher->OnEventFromSource(&inc);
ASSERT_FALSE(details.dispatcher_destroyed);
WaitAFrame();
@@ -1125,8 +1117,7 @@ IN_PROC_BROWSER_TEST_F(WebContentsViewAuraTest, MAYBE_VerticalOverscroll) {
}
while (location.x() < bounds.right() - kXStep) {
- ui::TouchEvent inc(ui::ET_TOUCH_MOVED, gfx::PointF(location), 0,
- timestamp);
+ ui::TouchEvent inc(ui::ET_TOUCH_MOVED, location, 0, timestamp);
details = dispatcher->OnEventFromSource(&inc);
ASSERT_FALSE(details.dispatcher_destroyed);
WaitAFrame();
@@ -1134,8 +1125,7 @@ IN_PROC_BROWSER_TEST_F(WebContentsViewAuraTest, MAYBE_VerticalOverscroll) {
timestamp += base::TimeDelta::FromMilliseconds(10);
}
- ui::TouchEvent release(ui::ET_TOUCH_RELEASED, gfx::PointF(location), 0,
- timestamp);
+ ui::TouchEvent release(ui::ET_TOUCH_RELEASED, location, 0, timestamp);
details = dispatcher->OnEventFromSource(&release);
ASSERT_FALSE(details.dispatcher_destroyed);
WaitAFrame();
diff --git a/content/common/cursors/webcursor_mac.mm b/content/common/cursors/webcursor_mac.mm
index be38f78..13c8c0b9 100644
--- a/content/common/cursors/webcursor_mac.mm
+++ b/content/common/cursors/webcursor_mac.mm
@@ -163,8 +163,8 @@ NSCursor* CreateCustomCursor(const std::vector<char>& custom_data,
custom_scale = 1;
NSSize dip_size = NSSizeFromCGSize(
gfx::ScaleToFlooredSize(custom_size, 1 / custom_scale).ToCGSize());
- NSPoint dip_hotspot = NSPointFromCGPoint(gfx::ToFlooredPoint(
- gfx::ScalePoint(hotspot, 1 / custom_scale)).ToCGPoint());
+ NSPoint dip_hotspot = NSPointFromCGPoint(
+ gfx::ScaleToFlooredPoint(hotspot, 1 / custom_scale).ToCGPoint());
// Both the image and its representation need to have the same size for
// cursors to appear in high resolution on retina displays. Note that the
diff --git a/mojo/converters/input_events/input_events_type_converters.cc b/mojo/converters/input_events/input_events_type_converters.cc
index 4ab9253..200a738 100644
--- a/mojo/converters/input_events/input_events_type_converters.cc
+++ b/mojo/converters/input_events/input_events_type_converters.cc
@@ -317,21 +317,24 @@ TypeConverter<scoped_ptr<ui::Event>, mus::mojom::EventPtr>::Convert(
case mus::mojom::POINTER_KIND_MOUSE: {
// TODO: last flags isn't right. Need to send changed_flags.
scoped_ptr<ui::MouseEvent> event(new ui::MouseEvent(
- MojoMouseEventTypeToUIEvent(input), location, screen_location,
+ MojoMouseEventTypeToUIEvent(input), gfx::Point(), gfx::Point(),
ui::EventTimeForNow(), ui::EventFlags(input->flags),
ui::EventFlags(input->flags)));
+ event->set_location_f(location);
+ event->set_root_location_f(screen_location);
return event.Pass();
} break;
case mus::mojom::POINTER_KIND_TOUCH: {
DCHECK(input->pointer_data->brush_data);
scoped_ptr<ui::TouchEvent> touch_event(new ui::TouchEvent(
- MojoTouchEventTypeToUIEvent(input), location,
+ MojoTouchEventTypeToUIEvent(input), gfx::Point(),
ui::EventFlags(input->flags), input->pointer_data->pointer_id,
base::TimeDelta::FromInternalValue(input->time_stamp),
input->pointer_data->brush_data->width,
input->pointer_data->brush_data->height, 0,
input->pointer_data->brush_data->pressure));
- touch_event->set_root_location(screen_location);
+ touch_event->set_location_f(location);
+ touch_event->set_root_location_f(screen_location);
return touch_event.Pass();
} break;
case mus::mojom::POINTER_KIND_PEN:
@@ -342,9 +345,11 @@ TypeConverter<scoped_ptr<ui::Event>, mus::mojom::EventPtr>::Convert(
case mus::mojom::EVENT_TYPE_WHEEL: {
DCHECK(input->pointer_data && input->pointer_data->wheel_data);
scoped_ptr<ui::MouseEvent> pre_wheel_event(new ui::MouseEvent(
- MojoWheelEventTypeToUIEvent(input), location, screen_location,
+ MojoWheelEventTypeToUIEvent(input), gfx::Point(), gfx::Point(),
ui::EventTimeForNow(), ui::EventFlags(input->flags),
ui::EventFlags(input->flags)));
+ pre_wheel_event->set_location_f(location);
+ pre_wheel_event->set_root_location_f(screen_location);
scoped_ptr<ui::MouseEvent> wheel_event(new ui::MouseWheelEvent(
*pre_wheel_event,
static_cast<int>(input->pointer_data->wheel_data->delta_x),
diff --git a/ui/app_list/folder_image.cc b/ui/app_list/folder_image.cc
index 0c9b958..f83030d 100644
--- a/ui/app_list/folder_image.cc
+++ b/ui/app_list/folder_image.cc
@@ -12,6 +12,7 @@
#include "ui/base/l10n/l10n_util.h"
#include "ui/gfx/canvas.h"
#include "ui/gfx/geometry/point.h"
+#include "ui/gfx/geometry/point_f.h"
#include "ui/gfx/geometry/rect.h"
#include "ui/gfx/geometry/size.h"
#include "ui/gfx/image/canvas_image_source.h"
diff --git a/ui/aura/gestures/gesture_recognizer_unittest.cc b/ui/aura/gestures/gesture_recognizer_unittest.cc
index 5404dd4..57b66bd 100644
--- a/ui/aura/gestures/gesture_recognizer_unittest.cc
+++ b/ui/aura/gestures/gesture_recognizer_unittest.cc
@@ -502,8 +502,8 @@ class TimedEvents {
}
void SendScrollEvents(ui::EventProcessor* dispatcher,
- float x_start,
- float y_start,
+ int x_start,
+ int y_start,
int dx,
int dy,
int touch_id,
@@ -516,8 +516,7 @@ class TimedEvents {
for (int i = 0; i < num_steps; i++) {
x += dx;
y += dy;
- ui::TouchEvent move(ui::ET_TOUCH_MOVED, gfx::PointF(x, y),
- touch_id,
+ ui::TouchEvent move(ui::ET_TOUCH_MOVED, gfx::Point(x, y), touch_id,
base::TimeDelta::FromMilliseconds(simulated_now_));
ui::EventDispatchDetails details = dispatcher->OnEventFromSource(&move);
ASSERT_FALSE(details.dispatcher_destroyed);
@@ -531,9 +530,10 @@ class TimedEvents {
int touch_id,
GestureEventConsumeDelegate* delegate) {
delegate->Reset();
- ui::TouchEvent move(ui::ET_TOUCH_MOVED, gfx::PointF(x, y),
- touch_id,
+ ui::TouchEvent move(ui::ET_TOUCH_MOVED, gfx::Point(), touch_id,
base::TimeDelta::FromMilliseconds(simulated_now_));
+ move.set_location_f(gfx::PointF(x, y));
+ move.set_root_location_f(gfx::PointF(x, y));
ui::EventDispatchDetails details = dispatcher->OnEventFromSource(&move);
ASSERT_FALSE(details.dispatcher_destroyed);
simulated_now_++;
@@ -562,7 +562,7 @@ class TestEventHandler : public ui::EventHandler {
touch_moved_count_++;
break;
case ui::ET_TOUCH_CANCELLED:
- cancelled_touch_points_.push_back(event->location());
+ cancelled_touch_points_.push_back(event->location_f());
break;
default:
break;
@@ -1116,12 +1116,11 @@ TEST_F(GestureRecognizerTest, GestureEventScrollBoundingBox) {
scoped_ptr<aura::Window> window(CreateTestWindowWithDelegate(
delegate.get(), -1234, bounds, root_window()));
- const float kPositionX = 101;
- const float kPositionY = 201;
+ const int kPositionX = 101;
+ const int kPositionY = 201;
delegate->Reset();
ui::TouchEvent press(ui::ET_TOUCH_PRESSED,
- gfx::PointF(kPositionX, kPositionY),
- kTouchId,
+ gfx::Point(kPositionX, kPositionY), kTouchId,
tes.Now());
DispatchEventUsingWindowDispatcher(&press);
EXPECT_EQ(gfx::Rect(kPositionX - radius, kPositionY - radius, radius * 2,
@@ -1140,11 +1139,10 @@ TEST_F(GestureRecognizerTest, GestureEventScrollBoundingBox) {
// Release the touch. This should end the scroll.
delegate->Reset();
- ui::TouchEvent release(ui::ET_TOUCH_RELEASED,
- gfx::PointF(kPositionX + kScrollAmount,
- kPositionY + kScrollAmount),
- kTouchId, press.time_stamp() +
- base::TimeDelta::FromMilliseconds(50));
+ ui::TouchEvent release(
+ ui::ET_TOUCH_RELEASED,
+ gfx::Point(kPositionX + kScrollAmount, kPositionY + kScrollAmount),
+ kTouchId, press.time_stamp() + base::TimeDelta::FromMilliseconds(50));
DispatchEventUsingWindowDispatcher(&release);
EXPECT_EQ(
gfx::Rect(kPositionX + kScrollAmount - radius,
@@ -1853,14 +1851,12 @@ TEST_F(GestureRecognizerTest, AsynchronousGestureRecognition) {
// should generate both SCROLL_BEGIN and PINCH_BEGIN gestures.
queued_delegate->Reset();
delegate->Reset();
- ui::TouchEvent move(
- ui::ET_TOUCH_MOVED,
- gfx::PointF(203 +
- ui::GestureConfiguration::GetInstance()
- ->max_touch_move_in_pixels_for_click(),
- 303),
- kTouchId2,
- tes.Now());
+ ui::TouchEvent move(ui::ET_TOUCH_MOVED,
+ gfx::Point(203 +
+ ui::GestureConfiguration::GetInstance()
+ ->max_touch_move_in_pixels_for_click(),
+ 303),
+ kTouchId2, tes.Now());
DispatchEventUsingWindowDispatcher(&move);
EXPECT_FALSE(delegate->tap());
EXPECT_FALSE(delegate->tap_down());
@@ -2184,13 +2180,17 @@ TEST_F(GestureRecognizerTest, GestureEventTouchLockSelectsCorrectWindow) {
// Touches should now be associated with the closest touch within
// ui::GestureConfiguration::max_separation_for_gesture_touches_in_pixels
- target = gesture_recognizer->GetTargetForLocation(gfx::Point(11, 11), -1);
+ target =
+ gesture_recognizer->GetTargetForLocation(gfx::PointF(11.f, 11.f), -1);
EXPECT_EQ("0", WindowIDAsString(target));
- target = gesture_recognizer->GetTargetForLocation(gfx::Point(511, 11), -1);
+ target =
+ gesture_recognizer->GetTargetForLocation(gfx::PointF(511.f, 11.f), -1);
EXPECT_EQ("1", WindowIDAsString(target));
- target = gesture_recognizer->GetTargetForLocation(gfx::Point(11, 511), -1);
+ target =
+ gesture_recognizer->GetTargetForLocation(gfx::PointF(11.f, 511.f), -1);
EXPECT_EQ("2", WindowIDAsString(target));
- target = gesture_recognizer->GetTargetForLocation(gfx::Point(511, 511), -1);
+ target =
+ gesture_recognizer->GetTargetForLocation(gfx::PointF(511.f, 511.f), -1);
EXPECT_EQ("3", WindowIDAsString(target));
// Add a touch in the middle associated with windows[2]
@@ -2201,20 +2201,24 @@ TEST_F(GestureRecognizerTest, GestureEventTouchLockSelectsCorrectWindow) {
kNumWindows, tes.Now());
DispatchEventUsingWindowDispatcher(&move);
- target = gesture_recognizer->GetTargetForLocation(gfx::Point(250, 250), -1);
+ target =
+ gesture_recognizer->GetTargetForLocation(gfx::PointF(250.f, 250.f), -1);
EXPECT_EQ("2", WindowIDAsString(target));
// Make sure that ties are broken by distance to a current touch
// Closer to the point in the bottom right.
- target = gesture_recognizer->GetTargetForLocation(gfx::Point(380, 380), -1);
+ target =
+ gesture_recognizer->GetTargetForLocation(gfx::PointF(380.f, 380.f), -1);
EXPECT_EQ("3", WindowIDAsString(target));
// This touch is closer to the point in the middle
- target = gesture_recognizer->GetTargetForLocation(gfx::Point(300, 300), -1);
+ target =
+ gesture_recognizer->GetTargetForLocation(gfx::PointF(300.f, 300.f), -1);
EXPECT_EQ("2", WindowIDAsString(target));
// A touch too far from other touches won't be locked to anything
- target = gesture_recognizer->GetTargetForLocation(gfx::Point(1000, 1000), -1);
+ target =
+ gesture_recognizer->GetTargetForLocation(gfx::PointF(1000.f, 1000.f), -1);
EXPECT_TRUE(target == NULL);
// Move a touch associated with windows[2] to 1000, 1000
@@ -2222,7 +2226,8 @@ TEST_F(GestureRecognizerTest, GestureEventTouchLockSelectsCorrectWindow) {
kNumWindows, tes.Now());
DispatchEventUsingWindowDispatcher(&move2);
- target = gesture_recognizer->GetTargetForLocation(gfx::Point(1000, 1000), -1);
+ target =
+ gesture_recognizer->GetTargetForLocation(gfx::PointF(1000.f, 1000.f), -1);
EXPECT_EQ("2", WindowIDAsString(target));
for (int i = 0; i < kNumWindows; ++i) {
@@ -3630,8 +3635,8 @@ TEST_F(GestureRecognizerTest, CancelAllActiveTouches) {
ui::ET_GESTURE_END);
const std::vector<gfx::PointF>& points = handler->cancelled_touch_points();
EXPECT_EQ(2U, points.size());
- EXPECT_EQ(gfx::Point(101, 201), points[0]);
- EXPECT_EQ(gfx::Point(350, 300), points[1]);
+ EXPECT_EQ(gfx::PointF(101.f, 201.f), points[0]);
+ EXPECT_EQ(gfx::PointF(350.f, 300.f), points[1]);
}
// Check that appropriate touch events generate show press events
@@ -3877,9 +3882,10 @@ TEST_F(GestureRecognizerTest, TestExceedingSlopSlowly) {
EXPECT_EQ(0, delegate->scroll_x_hint());
delegate->Reset();
-
- ui::TouchEvent move3(ui::ET_TOUCH_MOVED, gfx::PointF(13.1f, 10.f), kTouchId,
+ ui::TouchEvent move3(ui::ET_TOUCH_MOVED, gfx::Point(), kTouchId,
tes.LeapForward(40));
+ move3.set_location_f(gfx::PointF(13.1f, 10.f));
+ move3.set_root_location_f(gfx::PointF(13.1f, 10.f));
DispatchEventUsingWindowDispatcher(&move3);
EXPECT_TRUE(delegate->scroll_begin());
EXPECT_TRUE(delegate->scroll_update());
diff --git a/ui/aura/test/ui_controls_factory_ozone.cc b/ui/aura/test/ui_controls_factory_ozone.cc
index a928275..2f8fcb5 100644
--- a/ui/aura/test/ui_controls_factory_ozone.cc
+++ b/ui/aura/test/ui_controls_factory_ozone.cc
@@ -205,7 +205,7 @@ class UIControlsOzone : public ui_controls::UIControlsAura {
}
void PostMouseEvent(ui::EventType type,
- const gfx::PointF& host_location,
+ const gfx::Point& host_location,
int flags,
int changed_button_flags) {
base::MessageLoop::current()->PostTask(
@@ -215,7 +215,7 @@ class UIControlsOzone : public ui_controls::UIControlsAura {
}
void PostMouseEventTask(ui::EventType type,
- const gfx::PointF& host_location,
+ const gfx::Point& host_location,
int flags,
int changed_button_flags) {
ui::MouseEvent mouse_event(type, host_location, host_location,
diff --git a/ui/aura/window_event_dispatcher_unittest.cc b/ui/aura/window_event_dispatcher_unittest.cc
index db90159..38c5f2a 100644
--- a/ui/aura/window_event_dispatcher_unittest.cc
+++ b/ui/aura/window_event_dispatcher_unittest.cc
@@ -2513,8 +2513,10 @@ TEST_F(WindowEventDispatcherTest, GestureEventCoordinates) {
delegate.set_window(window.get());
- ui::TouchEvent touch_pressed_event(
- ui::ET_TOUCH_PRESSED, gfx::PointF(kX, kY), 0, ui::EventTimeForNow());
+ ui::TouchEvent touch_pressed_event(ui::ET_TOUCH_PRESSED, gfx::Point(), 0,
+ ui::EventTimeForNow());
+ touch_pressed_event.set_location_f(gfx::PointF(kX, kY));
+ touch_pressed_event.set_root_location_f(gfx::PointF(kX, kY));
DispatchEventUsingWindowDispatcher(&touch_pressed_event);
@@ -2564,9 +2566,7 @@ TEST_F(WindowEventDispatcherTest, TouchMovesMarkedWhenCausingScroll) {
// Delay the release to avoid fling generation.
ui::TouchEvent release(
- ui::ET_TOUCH_RELEASED,
- location + gfx::Vector2dF(200, 200),
- 0,
+ ui::ET_TOUCH_RELEASED, location + gfx::Vector2d(200, 200), 0,
ui::EventTimeForNow() + base::TimeDelta::FromSeconds(1));
DispatchEventUsingWindowDispatcher(&release);
EXPECT_FALSE(recorder.LastTouchMayCauseScrolling());
diff --git a/ui/aura/window_tree_host.cc b/ui/aura/window_tree_host.cc
index 1e0c0e0..5c9f25c 100644
--- a/ui/aura/window_tree_host.cc
+++ b/ui/aura/window_tree_host.cc
@@ -122,13 +122,13 @@ void WindowTreeHost::ConvertPointFromNativeScreen(gfx::Point* point) const {
}
void WindowTreeHost::ConvertPointToHost(gfx::Point* point) const {
- gfx::Point3F point_3f(*point);
+ auto point_3f = gfx::Point3F(gfx::PointF(*point));
GetRootTransform().TransformPoint(&point_3f);
*point = gfx::ToFlooredPoint(point_3f.AsPointF());
}
void WindowTreeHost::ConvertPointFromHost(gfx::Point* point) const {
- gfx::Point3F point_3f(*point);
+ auto point_3f = gfx::Point3F(gfx::PointF(*point));
GetInverseRootTransform().TransformPoint(&point_3f);
*point = gfx::ToFlooredPoint(point_3f.AsPointF());
}
diff --git a/ui/base/dragdrop/drop_target_event.cc b/ui/base/dragdrop/drop_target_event.cc
index 8ae61d4f..213fbee 100644
--- a/ui/base/dragdrop/drop_target_event.cc
+++ b/ui/base/dragdrop/drop_target_event.cc
@@ -12,12 +12,12 @@ namespace ui {
// DropTargetEvent
DropTargetEvent::DropTargetEvent(const OSExchangeData& data,
- const gfx::PointF& location,
- const gfx::PointF& root_location,
+ const gfx::Point& location,
+ const gfx::Point& root_location,
int source_operations)
: LocatedEvent(ET_DROP_TARGET_EVENT,
- location,
- root_location,
+ gfx::PointF(location),
+ gfx::PointF(root_location),
EventTimeForNow(),
0),
data_(data),
diff --git a/ui/base/dragdrop/drop_target_event.h b/ui/base/dragdrop/drop_target_event.h
index 27aabcd..18c0630 100644
--- a/ui/base/dragdrop/drop_target_event.h
+++ b/ui/base/dragdrop/drop_target_event.h
@@ -13,8 +13,8 @@ namespace ui {
class UI_BASE_EXPORT DropTargetEvent : public LocatedEvent {
public:
DropTargetEvent(const OSExchangeData& data,
- const gfx::PointF& location,
- const gfx::PointF& root_location,
+ const gfx::Point& location,
+ const gfx::Point& root_location,
int source_operations);
const OSExchangeData& data() const { return data_; }
diff --git a/ui/base/touch/selection_bound_unittest.cc b/ui/base/touch/selection_bound_unittest.cc
index 7a8e651..95ba5fb 100644
--- a/ui/base/touch/selection_bound_unittest.cc
+++ b/ui/base/touch/selection_bound_unittest.cc
@@ -12,8 +12,8 @@ namespace ui {
TEST(SelectionBoundTest, RectBetweenSelectionBounds) {
SelectionBound b1, b2;
// Simple case of aligned vertical bounds of equal height
- b1.SetEdge(gfx::Point(0, 20), gfx::Point(0, 25));
- b2.SetEdge(gfx::Point(110, 20), gfx::Point(110, 25));
+ b1.SetEdge(gfx::PointF(0.f, 20.f), gfx::PointF(0.f, 25.f));
+ b2.SetEdge(gfx::PointF(110.f, 20.f), gfx::PointF(110.f, 25.f));
gfx::Rect expected_rect(
b1.edge_top_rounded().x(),
b1.edge_top_rounded().y(),
@@ -23,8 +23,8 @@ TEST(SelectionBoundTest, RectBetweenSelectionBounds) {
EXPECT_EQ(expected_rect, RectBetweenSelectionBounds(b2, b1));
// Parallel vertical bounds of different heights
- b1.SetEdge(gfx::Point(10, 20), gfx::Point(10, 25));
- b2.SetEdge(gfx::Point(110, 0), gfx::Point(110, 35));
+ b1.SetEdge(gfx::PointF(10.f, 20.f), gfx::PointF(10.f, 25.f));
+ b2.SetEdge(gfx::PointF(110.f, 0.f), gfx::PointF(110.f, 35.f));
expected_rect = gfx::Rect(
b1.edge_top_rounded().x(),
b2.edge_top_rounded().y(),
@@ -33,8 +33,8 @@ TEST(SelectionBoundTest, RectBetweenSelectionBounds) {
EXPECT_EQ(expected_rect, RectBetweenSelectionBounds(b1, b2));
EXPECT_EQ(expected_rect, RectBetweenSelectionBounds(b2, b1));
- b1.SetEdge(gfx::Point(10, 20), gfx::Point(10, 30));
- b2.SetEdge(gfx::Point(110, 25), gfx::Point(110, 45));
+ b1.SetEdge(gfx::PointF(10.f, 20.f), gfx::PointF(10.f, 30.f));
+ b2.SetEdge(gfx::PointF(110.f, 25.f), gfx::PointF(110.f, 45.f));
expected_rect = gfx::Rect(
b1.edge_top_rounded().x(),
b1.edge_top_rounded().y(),
@@ -43,8 +43,8 @@ TEST(SelectionBoundTest, RectBetweenSelectionBounds) {
EXPECT_EQ(expected_rect, RectBetweenSelectionBounds(b1, b2));
EXPECT_EQ(expected_rect, RectBetweenSelectionBounds(b2, b1));
- b1.SetEdge(gfx::Point(10, 20), gfx::Point(10, 30));
- b2.SetEdge(gfx::Point(110, 40), gfx::Point(110, 60));
+ b1.SetEdge(gfx::PointF(10.f, 20.f), gfx::PointF(10.f, 30.f));
+ b2.SetEdge(gfx::PointF(110.f, 40.f), gfx::PointF(110.f, 60.f));
expected_rect = gfx::Rect(
b1.edge_top_rounded().x(),
b1.edge_top_rounded().y(),
@@ -54,8 +54,8 @@ TEST(SelectionBoundTest, RectBetweenSelectionBounds) {
EXPECT_EQ(expected_rect, RectBetweenSelectionBounds(b2, b1));
// Overlapping vertical bounds
- b1.SetEdge(gfx::Point(10, 20), gfx::Point(10, 30));
- b2.SetEdge(gfx::Point(10, 25), gfx::Point(10, 40));
+ b1.SetEdge(gfx::PointF(10.f, 20.f), gfx::PointF(10.f, 30.f));
+ b2.SetEdge(gfx::PointF(10.f, 25.f), gfx::PointF(10.f, 40.f));
expected_rect = gfx::Rect(
b1.edge_top_rounded().x(),
b1.edge_top_rounded().y(),
@@ -65,8 +65,8 @@ TEST(SelectionBoundTest, RectBetweenSelectionBounds) {
EXPECT_EQ(expected_rect, RectBetweenSelectionBounds(b2, b1));
// Non-vertical bounds: "\ \"
- b1.SetEdge(gfx::Point(10, 20), gfx::Point(20, 30));
- b2.SetEdge(gfx::Point(110, 40), gfx::Point(120, 60));
+ b1.SetEdge(gfx::PointF(10.f, 20.f), gfx::PointF(20.f, 30.f));
+ b2.SetEdge(gfx::PointF(110.f, 40.f), gfx::PointF(120.f, 60.f));
expected_rect = gfx::Rect(
b1.edge_top_rounded().x(),
b1.edge_top_rounded().y(),
@@ -76,8 +76,8 @@ TEST(SelectionBoundTest, RectBetweenSelectionBounds) {
EXPECT_EQ(expected_rect, RectBetweenSelectionBounds(b2, b1));
// Non-vertical bounds: "/ \"
- b1.SetEdge(gfx::Point(20, 30), gfx::Point(0, 40));
- b2.SetEdge(gfx::Point(110, 30), gfx::Point(120, 40));
+ b1.SetEdge(gfx::PointF(20.f, 30.f), gfx::PointF(0.f, 40.f));
+ b2.SetEdge(gfx::PointF(110.f, 30.f), gfx::PointF(120.f, 40.f));
expected_rect = gfx::Rect(
b1.edge_bottom_rounded().x(),
b1.edge_top_rounded().y(),
diff --git a/ui/chromeos/touch_exploration_controller.cc b/ui/chromeos/touch_exploration_controller.cc
index 5661d1d..89b36ac 100644
--- a/ui/chromeos/touch_exploration_controller.cc
+++ b/ui/chromeos/touch_exploration_controller.cc
@@ -365,15 +365,20 @@ ui::EventRewriteStatus TouchExplorationController::InDoubleTapPending(
return EVENT_REWRITE_DISCARD;
scoped_ptr<ui::TouchEvent> touch_press;
- touch_press.reset(new ui::TouchEvent(
- ui::ET_TOUCH_PRESSED, last_touch_exploration_->location_f(),
- initial_press_->touch_id(), event.time_stamp()));
+ touch_press.reset(new ui::TouchEvent(ui::ET_TOUCH_PRESSED, gfx::Point(),
+ initial_press_->touch_id(),
+ event.time_stamp()));
+ touch_press->set_location_f(last_touch_exploration_->location_f());
+ touch_press->set_root_location_f(last_touch_exploration_->location_f());
DispatchEvent(touch_press.get());
- rewritten_event->reset(new ui::TouchEvent(
- ui::ET_TOUCH_RELEASED, last_touch_exploration_->location_f(),
- initial_press_->touch_id(), event.time_stamp()));
- (*rewritten_event)->set_flags(event.flags());
+ scoped_ptr<ui::TouchEvent> new_event(
+ new ui::TouchEvent(ui::ET_TOUCH_RELEASED, gfx::Point(),
+ initial_press_->touch_id(), event.time_stamp()));
+ new_event->set_location_f(last_touch_exploration_->location_f());
+ new_event->set_root_location_f(last_touch_exploration_->location_f());
+ new_event->set_flags(event.flags());
+ *rewritten_event = new_event.Pass();
SET_STATE(NO_FINGERS_DOWN);
return ui::EVENT_REWRITE_REWRITTEN;
}
@@ -391,10 +396,13 @@ ui::EventRewriteStatus TouchExplorationController::InTouchReleasePending(
if (current_touch_ids_.size() != 0)
return EVENT_REWRITE_DISCARD;
- rewritten_event->reset(new ui::TouchEvent(
- ui::ET_TOUCH_RELEASED, last_touch_exploration_->location_f(),
- initial_press_->touch_id(), event.time_stamp()));
- (*rewritten_event)->set_flags(event.flags());
+ scoped_ptr<ui::TouchEvent> new_event(
+ new ui::TouchEvent(ui::ET_TOUCH_RELEASED, gfx::Point(),
+ initial_press_->touch_id(), event.time_stamp()));
+ new_event->set_location_f(last_touch_exploration_->location_f());
+ new_event->set_root_location_f(last_touch_exploration_->location_f());
+ new_event->set_flags(event.flags());
+ *rewritten_event = new_event.Pass();
SET_STATE(NO_FINGERS_DOWN);
return ui::EVENT_REWRITE_REWRITTEN;
}
@@ -410,10 +418,13 @@ ui::EventRewriteStatus TouchExplorationController::InTouchExploration(
// Handle split-tap.
initial_press_.reset(new TouchEvent(event));
tap_timer_.Stop();
- rewritten_event->reset(new ui::TouchEvent(
- ui::ET_TOUCH_PRESSED, last_touch_exploration_->location_f(),
- event.touch_id(), event.time_stamp()));
- (*rewritten_event)->set_flags(event.flags());
+ scoped_ptr<ui::TouchEvent> new_event(
+ new ui::TouchEvent(ui::ET_TOUCH_PRESSED, gfx::Point(), event.touch_id(),
+ event.time_stamp()));
+ new_event->set_location_f(last_touch_exploration_->location_f());
+ new_event->set_root_location_f(last_touch_exploration_->location_f());
+ new_event->set_flags(event.flags());
+ *rewritten_event = new_event.Pass();
SET_STATE(TOUCH_EXPLORE_SECOND_PRESS);
return ui::EVENT_REWRITE_REWRITTEN;
} else if (type == ui::ET_TOUCH_RELEASED || type == ui::ET_TOUCH_CANCELLED) {
@@ -465,9 +476,12 @@ ui::EventRewriteStatus TouchExplorationController::InCornerPassthrough(
return ui::EVENT_REWRITE_DISCARD;
}
- rewritten_event->reset(new ui::TouchEvent(
- type, event.location_f(), event.touch_id(), event.time_stamp()));
- (*rewritten_event)->set_flags(event.flags());
+ scoped_ptr<ui::TouchEvent> new_event(new ui::TouchEvent(
+ type, gfx::Point(), event.touch_id(), event.time_stamp()));
+ new_event->set_location_f(event.location_f());
+ new_event->set_root_location_f(event.location_f());
+ new_event->set_flags(event.flags());
+ *rewritten_event = new_event.Pass();
if (current_touch_ids_.size() == 0)
SET_STATE(NO_FINGERS_DOWN);
@@ -484,11 +498,12 @@ ui::EventRewriteStatus TouchExplorationController::InOneFingerPassthrough(
}
return ui::EVENT_REWRITE_DISCARD;
}
- rewritten_event->reset(
- new ui::TouchEvent(event.type(), event.location_f() - passthrough_offset_,
- event.touch_id(), event.time_stamp()));
-
- (*rewritten_event)->set_flags(event.flags());
+ scoped_ptr<ui::TouchEvent> new_event(new ui::TouchEvent(
+ event.type(), gfx::Point(), event.touch_id(), event.time_stamp()));
+ new_event->set_location_f(event.location_f() - passthrough_offset_);
+ new_event->set_root_location_f(event.location_f() - passthrough_offset_);
+ new_event->set_flags(event.flags());
+ *rewritten_event = new_event.Pass();
if (current_touch_ids_.size() == 0) {
SET_STATE(NO_FINGERS_DOWN);
}
@@ -505,10 +520,13 @@ ui::EventRewriteStatus TouchExplorationController::InTouchExploreSecondPress(
// through. The user enters the wait state, Since there has already been
// a press dispatched when split tap began, the touch needs to be
// cancelled.
- rewritten_event->reset(new ui::TouchEvent(
- ui::ET_TOUCH_CANCELLED, last_touch_exploration_->location_f(),
- initial_press_->touch_id(), event.time_stamp()));
- (*rewritten_event)->set_flags(event.flags());
+ scoped_ptr<ui::TouchEvent> new_event(
+ new ui::TouchEvent(ui::ET_TOUCH_CANCELLED, gfx::Point(),
+ initial_press_->touch_id(), event.time_stamp()));
+ new_event->set_location_f(last_touch_exploration_->location_f());
+ new_event->set_root_location_f(last_touch_exploration_->location_f());
+ new_event->set_flags(event.flags());
+ *rewritten_event = new_event.Pass();
SET_STATE(WAIT_FOR_NO_FINGERS);
return ui::EVENT_REWRITE_REWRITTEN;
} else if (type == ui::ET_TOUCH_MOVED) {
@@ -531,10 +549,13 @@ ui::EventRewriteStatus TouchExplorationController::InTouchExploreSecondPress(
// cancelled, and the user enters the wait state.
if ((event.location_f() - original_touch->location_f()).Length() >
GetSplitTapTouchSlop()) {
- rewritten_event->reset(new ui::TouchEvent(
- ui::ET_TOUCH_CANCELLED, last_touch_exploration_->location_f(),
- initial_press_->touch_id(), event.time_stamp()));
- (*rewritten_event)->set_flags(event.flags());
+ scoped_ptr<ui::TouchEvent> new_event(
+ new ui::TouchEvent(ui::ET_TOUCH_CANCELLED, gfx::Point(),
+ initial_press_->touch_id(), event.time_stamp()));
+ new_event->set_location_f(last_touch_exploration_->location_f());
+ new_event->set_root_location_f(last_touch_exploration_->location_f());
+ new_event->set_flags(event.flags());
+ *rewritten_event = new_event.Pass();
SET_STATE(WAIT_FOR_NO_FINGERS);
return ui::EVENT_REWRITE_REWRITTEN;
}
@@ -554,10 +575,13 @@ ui::EventRewriteStatus TouchExplorationController::InTouchExploreSecondPress(
return EVENT_REWRITE_DISCARD;
// Rewrite at location of last touch exploration.
- rewritten_event->reset(new ui::TouchEvent(
- ui::ET_TOUCH_RELEASED, last_touch_exploration_->location_f(),
- initial_press_->touch_id(), event.time_stamp()));
- (*rewritten_event)->set_flags(event.flags());
+ scoped_ptr<ui::TouchEvent> new_event(
+ new ui::TouchEvent(ui::ET_TOUCH_RELEASED, gfx::Point(),
+ initial_press_->touch_id(), event.time_stamp()));
+ new_event->set_location_f(last_touch_exploration_->location_f());
+ new_event->set_root_location_f(last_touch_exploration_->location_f());
+ new_event->set_flags(event.flags());
+ *rewritten_event = new_event.Pass();
SET_STATE(TOUCH_EXPLORATION);
EnterTouchToMouseMode();
return ui::EVENT_REWRITE_REWRITTEN;
@@ -692,9 +716,12 @@ void TouchExplorationController::OnTapTimerFired() {
SET_STATE(ONE_FINGER_PASSTHROUGH);
passthrough_offset_ = last_unused_finger_event_->location_f() -
last_touch_exploration_->location_f();
- scoped_ptr<ui::TouchEvent> passthrough_press(new ui::TouchEvent(
- ui::ET_TOUCH_PRESSED, last_touch_exploration_->location_f(),
- last_unused_finger_event_->touch_id(), Now()));
+ scoped_ptr<ui::TouchEvent> passthrough_press(
+ new ui::TouchEvent(ui::ET_TOUCH_PRESSED, gfx::Point(),
+ last_unused_finger_event_->touch_id(), Now()));
+ passthrough_press->set_location_f(last_touch_exploration_->location_f());
+ passthrough_press->set_root_location_f(
+ last_touch_exploration_->location_f());
DispatchEvent(passthrough_press.get());
return;
}
@@ -943,7 +970,7 @@ base::Closure TouchExplorationController::BindKeyEventWithFlags(
flags);
}
-scoped_ptr<ui::Event> TouchExplorationController::CreateMouseMoveEvent(
+scoped_ptr<ui::MouseEvent> TouchExplorationController::CreateMouseMoveEvent(
const gfx::PointF& location,
int flags) {
// The "synthesized" flag should be set on all events that don't have a
@@ -965,8 +992,12 @@ scoped_ptr<ui::Event> TouchExplorationController::CreateMouseMoveEvent(
// event to the new ChromeVox background page via the automation api.
flags |= ui::EF_COMMAND_DOWN;
- return make_scoped_ptr(new ui::MouseEvent(
- ui::ET_MOUSE_MOVED, location, location, ui::EventTimeForNow(), flags, 0));
+ scoped_ptr<ui::MouseEvent> event(
+ new ui::MouseEvent(ui::ET_MOUSE_MOVED, gfx::Point(), gfx::Point(),
+ ui::EventTimeForNow(), flags, 0));
+ event->set_location_f(location);
+ event->set_root_location_f(location);
+ return event;
}
void TouchExplorationController::EnterTouchToMouseMode() {
diff --git a/ui/chromeos/touch_exploration_controller.h b/ui/chromeos/touch_exploration_controller.h
index 96a7798..4872c2d 100644
--- a/ui/chromeos/touch_exploration_controller.h
+++ b/ui/chromeos/touch_exploration_controller.h
@@ -258,8 +258,8 @@ class UI_CHROMEOS_EXPORT TouchExplorationController
// Binds DispatchKeyWithFlags to a specific key and flags.
base::Closure BindKeyEventWithFlags(const ui::KeyboardCode key, int flags);
- scoped_ptr<ui::Event> CreateMouseMoveEvent(const gfx::PointF& location,
- int flags);
+ scoped_ptr<ui::MouseEvent> CreateMouseMoveEvent(const gfx::PointF& location,
+ int flags);
void EnterTouchToMouseMode();
diff --git a/ui/events/event.cc b/ui/events/event.cc
index b1f50a8..71f5e27 100644
--- a/ui/events/event.cc
+++ b/ui/events/event.cc
@@ -326,12 +326,16 @@ MouseEvent::MouseEvent(const base::NativeEvent& native_event)
}
MouseEvent::MouseEvent(EventType type,
- const gfx::PointF& location,
- const gfx::PointF& root_location,
+ const gfx::Point& location,
+ const gfx::Point& root_location,
base::TimeDelta time_stamp,
int flags,
int changed_button_flags)
- : LocatedEvent(type, location, root_location, time_stamp, flags),
+ : LocatedEvent(type,
+ gfx::PointF(location),
+ gfx::PointF(root_location),
+ time_stamp,
+ flags),
changed_button_flags_(changed_button_flags),
pointer_details_(PointerDetails(EventPointerType::POINTER_TYPE_MOUSE)) {
if (this->type() == ET_MOUSE_MOVED && IsAnyButton())
@@ -485,8 +489,8 @@ MouseWheelEvent::MouseWheelEvent(const MouseWheelEvent& mouse_wheel_event)
}
MouseWheelEvent::MouseWheelEvent(const gfx::Vector2d& offset,
- const gfx::PointF& location,
- const gfx::PointF& root_location,
+ const gfx::Point& location,
+ const gfx::Point& root_location,
base::TimeDelta time_stamp,
int flags,
int changed_button_flags)
@@ -496,8 +500,7 @@ MouseWheelEvent::MouseWheelEvent(const gfx::Vector2d& offset,
time_stamp,
flags,
changed_button_flags),
- offset_(offset) {
-}
+ offset_(offset) {}
#if defined(OS_WIN)
// This value matches windows WHEEL_DELTA.
@@ -535,10 +538,14 @@ TouchEvent::TouchEvent(const base::NativeEvent& native_event)
}
TouchEvent::TouchEvent(EventType type,
- const gfx::PointF& location,
+ const gfx::Point& location,
int touch_id,
base::TimeDelta time_stamp)
- : LocatedEvent(type, location, location, time_stamp, 0),
+ : LocatedEvent(type,
+ gfx::PointF(location),
+ gfx::PointF(location),
+ time_stamp,
+ 0),
touch_id_(touch_id),
unique_event_id_(ui::GetNextTouchEventId()),
rotation_angle_(0.0f),
@@ -549,7 +556,7 @@ TouchEvent::TouchEvent(EventType type,
}
TouchEvent::TouchEvent(EventType type,
- const gfx::PointF& location,
+ const gfx::Point& location,
int flags,
int touch_id,
base::TimeDelta time_stamp,
@@ -557,7 +564,11 @@ TouchEvent::TouchEvent(EventType type,
float radius_y,
float angle,
float force)
- : LocatedEvent(type, location, location, time_stamp, flags),
+ : LocatedEvent(type,
+ gfx::PointF(location),
+ gfx::PointF(location),
+ time_stamp,
+ flags),
touch_id_(touch_id),
unique_event_id_(ui::GetNextTouchEventId()),
rotation_angle_(angle),
@@ -926,7 +937,7 @@ ScrollEvent::ScrollEvent(const base::NativeEvent& native_event)
}
ScrollEvent::ScrollEvent(EventType type,
- const gfx::PointF& location,
+ const gfx::Point& location,
base::TimeDelta time_stamp,
int flags,
float x_offset,
diff --git a/ui/events/event.h b/ui/events/event.h
index e077ed3..c878a71 100644
--- a/ui/events/event.h
+++ b/ui/events/event.h
@@ -262,10 +262,16 @@ class EVENTS_EXPORT LocatedEvent : public Event {
float x() const { return location_.x(); }
float y() const { return location_.y(); }
- void set_location(const gfx::PointF& location) { location_ = location; }
+ void set_location(const gfx::Point& location) {
+ location_ = gfx::PointF(location);
+ }
+ void set_location_f(const gfx::PointF& location) { location_ = location; }
gfx::Point location() const { return gfx::ToFlooredPoint(location_); }
const gfx::PointF& location_f() const { return location_; }
- void set_root_location(const gfx::PointF& root_location) {
+ void set_root_location(const gfx::Point& root_location) {
+ root_location_ = gfx::PointF(root_location);
+ }
+ void set_root_location_f(const gfx::PointF& root_location) {
root_location_ = root_location;
}
gfx::Point root_location() const {
@@ -401,8 +407,8 @@ class EVENTS_EXPORT MouseEvent : public LocatedEvent {
// Used for synthetic events in testing, gesture recognizer and Ozone
MouseEvent(EventType type,
- const gfx::PointF& location,
- const gfx::PointF& root_location,
+ const gfx::Point& location,
+ const gfx::Point& root_location,
base::TimeDelta time_stamp,
int flags,
int changed_button_flags);
@@ -518,8 +524,8 @@ class EVENTS_EXPORT MouseWheelEvent : public MouseEvent {
// Used for synthetic events in testing and by the gesture recognizer.
MouseWheelEvent(const gfx::Vector2d& offset,
- const gfx::PointF& location,
- const gfx::PointF& root_location,
+ const gfx::Point& location,
+ const gfx::Point& root_location,
base::TimeDelta time_stamp,
int flags,
int changed_button_flags);
@@ -552,12 +558,12 @@ class EVENTS_EXPORT TouchEvent : public LocatedEvent {
pointer_details_(model.pointer_details_) {}
TouchEvent(EventType type,
- const gfx::PointF& location,
+ const gfx::Point& location,
int touch_id,
base::TimeDelta time_stamp);
TouchEvent(EventType type,
- const gfx::PointF& location,
+ const gfx::Point& location,
int flags,
int touch_id,
base::TimeDelta timestamp,
@@ -854,7 +860,7 @@ class EVENTS_EXPORT ScrollEvent : public MouseEvent {
// Used for tests.
ScrollEvent(EventType type,
- const gfx::PointF& location,
+ const gfx::Point& location,
base::TimeDelta time_stamp,
int flags,
float x_offset,
diff --git a/ui/events/event_unittest.cc b/ui/events/event_unittest.cc
index 0ebbce1..1c03c7b 100644
--- a/ui/events/event_unittest.cc
+++ b/ui/events/event_unittest.cc
@@ -642,8 +642,8 @@ TEST(EventTest, PointerEventDetailsTouch) {
}
TEST(EventTest, PointerEventDetailsMouse) {
- ui::MouseEvent mouse_event(ET_MOUSE_PRESSED, gfx::PointF(0, 0),
- gfx::PointF(0, 0), ui::EventTimeForNow(), 0, 0);
+ ui::MouseEvent mouse_event(ET_MOUSE_PRESSED, gfx::Point(0, 0),
+ gfx::Point(0, 0), ui::EventTimeForNow(), 0, 0);
EXPECT_EQ(EventPointerType::POINTER_TYPE_MOUSE,
mouse_event.pointer_details().pointer_type());
@@ -664,8 +664,8 @@ TEST(EventTest, PointerEventDetailsMouse) {
}
TEST(EventTest, PointerEventDetailsStylus) {
- ui::MouseEvent stylus_event(ET_MOUSE_PRESSED, gfx::PointF(0, 0),
- gfx::PointF(0, 0), ui::EventTimeForNow(), 0, 0);
+ ui::MouseEvent stylus_event(ET_MOUSE_PRESSED, gfx::Point(0, 0),
+ gfx::Point(0, 0), ui::EventTimeForNow(), 0, 0);
ui::PointerDetails pointer_details(EventPointerType::POINTER_TYPE_PEN,
/* radius_x */ 0.0f,
/* radius_y */ 0.0f,
diff --git a/ui/events/gestures/gesture_provider_aura_unittest.cc b/ui/events/gestures/gesture_provider_aura_unittest.cc
index 79e06a8..3dffa70 100644
--- a/ui/events/gestures/gesture_provider_aura_unittest.cc
+++ b/ui/events/gestures/gesture_provider_aura_unittest.cc
@@ -32,11 +32,11 @@ class GestureProviderAuraTest : public testing::Test,
TEST_F(GestureProviderAuraTest, IgnoresExtraPressEvents) {
base::TimeDelta time = ui::EventTimeForNow();
- TouchEvent press1(ET_TOUCH_PRESSED, gfx::PointF(10, 10), 0, time);
+ TouchEvent press1(ET_TOUCH_PRESSED, gfx::Point(10, 10), 0, time);
EXPECT_TRUE(provider()->OnTouchEvent(&press1));
time += base::TimeDelta::FromMilliseconds(10);
- TouchEvent press2(ET_TOUCH_PRESSED, gfx::PointF(30, 40), 0, time);
+ TouchEvent press2(ET_TOUCH_PRESSED, gfx::Point(30, 40), 0, time);
// TODO(tdresser): this redundant press with same id should be
// ignored; however, there is at least one case where we need to
// allow a touch press from a currently used touch id. See
@@ -46,19 +46,19 @@ TEST_F(GestureProviderAuraTest, IgnoresExtraPressEvents) {
TEST_F(GestureProviderAuraTest, IgnoresExtraMoveOrReleaseEvents) {
base::TimeDelta time = ui::EventTimeForNow();
- TouchEvent press1(ET_TOUCH_PRESSED, gfx::PointF(10, 10), 0, time);
+ TouchEvent press1(ET_TOUCH_PRESSED, gfx::Point(10, 10), 0, time);
EXPECT_TRUE(provider()->OnTouchEvent(&press1));
time += base::TimeDelta::FromMilliseconds(10);
- TouchEvent release1(ET_TOUCH_RELEASED, gfx::PointF(30, 40), 0, time);
+ TouchEvent release1(ET_TOUCH_RELEASED, gfx::Point(30, 40), 0, time);
EXPECT_TRUE(provider()->OnTouchEvent(&release1));
time += base::TimeDelta::FromMilliseconds(10);
- TouchEvent release2(ET_TOUCH_RELEASED, gfx::PointF(30, 45), 0, time);
+ TouchEvent release2(ET_TOUCH_RELEASED, gfx::Point(30, 45), 0, time);
EXPECT_FALSE(provider()->OnTouchEvent(&release1));
time += base::TimeDelta::FromMilliseconds(10);
- TouchEvent move1(ET_TOUCH_MOVED, gfx::PointF(70, 75), 0, time);
+ TouchEvent move1(ET_TOUCH_MOVED, gfx::Point(70, 75), 0, time);
EXPECT_FALSE(provider()->OnTouchEvent(&move1));
}
@@ -71,83 +71,45 @@ TEST_F(GestureProviderAuraTest, IgnoresIdenticalMoveEvents) {
const int kTouchId1 = 3;
base::TimeDelta time = ui::EventTimeForNow();
- TouchEvent press0_1(ET_TOUCH_PRESSED, gfx::PointF(9, 10), kTouchId0, time);
+ TouchEvent press0_1(ET_TOUCH_PRESSED, gfx::Point(9, 10), kTouchId0, time);
EXPECT_TRUE(provider()->OnTouchEvent(&press0_1));
- TouchEvent press1_1(ET_TOUCH_PRESSED, gfx::PointF(40, 40), kTouchId1, time);
+ TouchEvent press1_1(ET_TOUCH_PRESSED, gfx::Point(40, 40), kTouchId1, time);
EXPECT_TRUE(provider()->OnTouchEvent(&press1_1));
time += base::TimeDelta::FromMilliseconds(10);
- TouchEvent move0_1(ET_TOUCH_MOVED,
- gfx::PointF(10, 10),
- 0,
- kTouchId0,
- time,
- kRadiusX,
- kRadiusY,
- kAngle,
- kForce);
+ TouchEvent move0_1(ET_TOUCH_MOVED, gfx::Point(10, 10), 0, kTouchId0, time,
+ kRadiusX, kRadiusY, kAngle, kForce);
EXPECT_TRUE(provider()->OnTouchEvent(&move0_1));
- TouchEvent move1_1(ET_TOUCH_MOVED,
- gfx::PointF(100, 200),
- 0,
- kTouchId1,
- time,
- kRadiusX,
- kRadiusY,
- kAngle,
- kForce);
+ TouchEvent move1_1(ET_TOUCH_MOVED, gfx::Point(100, 200), 0, kTouchId1, time,
+ kRadiusX, kRadiusY, kAngle, kForce);
EXPECT_TRUE(provider()->OnTouchEvent(&move1_1));
time += base::TimeDelta::FromMilliseconds(10);
- TouchEvent move0_2(ET_TOUCH_MOVED,
- gfx::PointF(10, 10),
- 0,
- kTouchId0,
- time,
- kRadiusX,
- kRadiusY,
- kAngle,
- kForce);
+ TouchEvent move0_2(ET_TOUCH_MOVED, gfx::Point(10, 10), 0, kTouchId0, time,
+ kRadiusX, kRadiusY, kAngle, kForce);
// Nothing has changed, so ignore the move.
EXPECT_FALSE(provider()->OnTouchEvent(&move0_2));
- TouchEvent move1_2(ET_TOUCH_MOVED,
- gfx::PointF(100, 200),
- 0,
- kTouchId1,
- time,
- kRadiusX,
- kRadiusY,
- kAngle,
- kForce);
+ TouchEvent move1_2(ET_TOUCH_MOVED, gfx::Point(100, 200), 0, kTouchId1, time,
+ kRadiusX, kRadiusY, kAngle, kForce);
// Nothing has changed, so ignore the move.
EXPECT_FALSE(provider()->OnTouchEvent(&move1_2));
time += base::TimeDelta::FromMilliseconds(10);
- TouchEvent move0_3(ET_TOUCH_MOVED,
- gfx::PointF(70, 75.1f),
- 0,
- kTouchId0,
- time,
- kRadiusX,
- kRadiusY,
- kAngle,
- kForce);
+ TouchEvent move0_3(ET_TOUCH_MOVED, gfx::Point(), 0, kTouchId0, time, kRadiusX,
+ kRadiusY, kAngle, kForce);
+ move0_3.set_location_f(gfx::PointF(70, 75.1f));
+ move0_3.set_root_location_f(gfx::PointF(70, 75.1f));
// Position has changed, so don't ignore the move.
EXPECT_TRUE(provider()->OnTouchEvent(&move0_3));
time += base::TimeDelta::FromMilliseconds(10);
- TouchEvent move0_4(ET_TOUCH_MOVED,
- gfx::PointF(70, 75.1f),
- 0,
- kTouchId0,
- time,
- kRadiusX,
- kRadiusY + 1,
- kAngle,
- kForce);
+ TouchEvent move0_4(ET_TOUCH_MOVED, gfx::Point(), 0, kTouchId0, time, kRadiusX,
+ kRadiusY + 1, kAngle, kForce);
+ move0_4.set_location_f(gfx::PointF(70, 75.1f));
+ move0_4.set_root_location_f(gfx::PointF(70, 75.1f));
}
// TODO(jdduke): Test whether event marked as scroll trigger.
diff --git a/ui/events/gestures/gesture_recognizer_impl.cc b/ui/events/gestures/gesture_recognizer_impl.cc
index df2c354..3fe5918 100644
--- a/ui/events/gestures/gesture_recognizer_impl.cc
+++ b/ui/events/gestures/gesture_recognizer_impl.cc
@@ -172,17 +172,14 @@ bool GestureRecognizerImpl::CancelActiveTouches(GestureConsumer* consumer) {
// pointer_state is modified every time after DispatchCancelTouchEvent.
scoped_ptr<MotionEvent> pointer_state_clone = pointer_state.Clone();
for (size_t i = 0; i < pointer_state_clone->GetPointerCount(); ++i) {
- gfx::PointF point(pointer_state_clone->GetX(i),
- pointer_state_clone->GetY(i));
- TouchEvent touch_event(ui::ET_TOUCH_CANCELLED,
- point,
+ TouchEvent touch_event(ui::ET_TOUCH_CANCELLED, gfx::Point(),
ui::EF_IS_SYNTHESIZED,
pointer_state_clone->GetPointerId(i),
- ui::EventTimeForNow(),
- 0.0f,
- 0.0f,
- 0.0f,
- 0.0f);
+ ui::EventTimeForNow(), 0.0f, 0.0f, 0.0f, 0.0f);
+ gfx::PointF point(pointer_state_clone->GetX(i),
+ pointer_state_clone->GetY(i));
+ touch_event.set_location_f(point);
+ touch_event.set_root_location_f(point);
GestureEventHelper* helper = FindDispatchHelperForConsumer(consumer);
if (helper)
helper->DispatchCancelTouchEvent(&touch_event);
diff --git a/ui/events/gestures/motion_event_aura.cc b/ui/events/gestures/motion_event_aura.cc
index 6890753..60f9854 100644
--- a/ui/events/gestures/motion_event_aura.cc
+++ b/ui/events/gestures/motion_event_aura.cc
@@ -54,8 +54,10 @@ bool MotionEventAura::OnTouch(const TouchEvent& touch) {
// crbug.com/446852 for details.
// Cancel the existing touch, before handling the touch press.
- TouchEvent cancel(ET_TOUCH_CANCELLED, touch.location_f(), touch.touch_id(),
+ TouchEvent cancel(ET_TOUCH_CANCELLED, gfx::Point(), touch.touch_id(),
touch.time_stamp());
+ cancel.set_location_f(touch.location_f());
+ cancel.set_root_location_f(touch.location_f());
OnTouch(cancel);
CleanupRemovedTouchPoints(cancel);
DCHECK_EQ(-1, FindPointerIndexOfId(touch.touch_id()));
diff --git a/ui/events/gestures/motion_event_aura_unittest.cc b/ui/events/gestures/motion_event_aura_unittest.cc
index 6cd5a27..0ff715b9 100644
--- a/ui/events/gestures/motion_event_aura_unittest.cc
+++ b/ui/events/gestures/motion_event_aura_unittest.cc
@@ -15,8 +15,8 @@
namespace {
ui::TouchEvent TouchWithType(ui::EventType type, int id) {
- return ui::TouchEvent(
- type, gfx::PointF(0, 0), id, base::TimeDelta::FromMilliseconds(0));
+ return ui::TouchEvent(type, gfx::Point(0, 0), id,
+ base::TimeDelta::FromMilliseconds(0));
}
ui::TouchEvent TouchWithPosition(ui::EventType type,
@@ -25,16 +25,10 @@ ui::TouchEvent TouchWithPosition(ui::EventType type,
float y,
float raw_x,
float raw_y) {
- ui::TouchEvent event(type,
- gfx::PointF(x, y),
- 0,
- id,
- base::TimeDelta::FromMilliseconds(0),
- 0,
- 0,
- 0,
- 0);
- event.set_root_location(gfx::PointF(raw_x, raw_y));
+ ui::TouchEvent event(type, gfx::Point(), 0, id,
+ base::TimeDelta::FromMilliseconds(0), 0, 0, 0, 0);
+ event.set_location_f(gfx::PointF(x, y));
+ event.set_root_location_f(gfx::PointF(raw_x, raw_y));
return event;
}
@@ -44,22 +38,15 @@ ui::TouchEvent TouchWithTapParams(ui::EventType type,
float radius_y,
float rotation_angle,
float pressure) {
- ui::TouchEvent event(type,
- gfx::PointF(1, 1),
- 0,
- id,
- base::TimeDelta::FromMilliseconds(0),
- radius_x,
- radius_y,
- rotation_angle,
- pressure);
- event.set_root_location(gfx::PointF(1, 1));
+ ui::TouchEvent event(type, gfx::Point(1, 1), 0, id,
+ base::TimeDelta::FromMilliseconds(0), radius_x, radius_y,
+ rotation_angle, pressure);
return event;
}
ui::TouchEvent TouchWithTime(ui::EventType type, int id, int ms) {
- return ui::TouchEvent(
- type, gfx::PointF(0, 0), id, base::TimeDelta::FromMilliseconds(ms));
+ return ui::TouchEvent(type, gfx::Point(0, 0), id,
+ base::TimeDelta::FromMilliseconds(ms));
}
base::TimeTicks MsToTicks(int ms) {
@@ -360,7 +347,7 @@ TEST(MotionEventAuraTest, Timestamps) {
TouchEvent move0 = TouchWithTime(
ui::ET_TOUCH_MOVED, ids[0], times_in_ms[2]);
- move0.set_location(gfx::PointF(12, 21));
+ move0.set_location(gfx::Point(12, 21));
EXPECT_TRUE(event.OnTouch(move0));
EXPECT_EQ(MsToTicks(times_in_ms[2]), event.GetEventTime());
@@ -391,7 +378,7 @@ TEST(MotionEventAuraTest, CachedAction) {
EXPECT_EQ(1, clone->GetActionIndex());
TouchEvent move0 = TouchWithType(ET_TOUCH_MOVED, ids[0]);
- move0.set_location(gfx::PointF(10, 12));
+ move0.set_location(gfx::Point(10, 12));
EXPECT_TRUE(event.OnTouch(move0));
EXPECT_EQ(MotionEvent::ACTION_MOVE, event.GetAction());
EXPECT_EQ(2U, event.GetPointerCount());
diff --git a/ui/events/ozone/evdev/event_factory_evdev.cc b/ui/events/ozone/evdev/event_factory_evdev.cc
index 79a628f..32dd7c5 100644
--- a/ui/events/ozone/evdev/event_factory_evdev.cc
+++ b/ui/events/ozone/evdev/event_factory_evdev.cc
@@ -169,9 +169,11 @@ void EventFactoryEvdev::DispatchMouseMoveEvent(
const MouseMoveEventParams& params) {
TRACE_EVENT1("evdev", "EventFactoryEvdev::DispatchMouseMoveEvent", "device",
params.device_id);
- MouseEvent event(ui::ET_MOUSE_MOVED, params.location, params.location,
+ MouseEvent event(ui::ET_MOUSE_MOVED, gfx::Point(), gfx::Point(),
params.timestamp, modifiers_.GetModifierFlags(),
/* changed_button_flags */ 0);
+ event.set_location_f(params.location);
+ event.set_root_location_f(params.location);
event.set_source_device_id(params.device_id);
event.set_pointer_details(params.pointer_details);
DispatchUiEvent(&event);
@@ -219,9 +221,11 @@ void EventFactoryEvdev::DispatchMouseButtonEvent(
return;
MouseEvent event(params.down ? ui::ET_MOUSE_PRESSED : ui::ET_MOUSE_RELEASED,
- params.location, params.location, params.timestamp,
+ gfx::Point(), gfx::Point(), params.timestamp,
modifiers_.GetModifierFlags() | flag,
/* changed_button_flags */ flag);
+ event.set_location_f(params.location);
+ event.set_root_location_f(params.location);
event.set_source_device_id(params.device_id);
event.set_pointer_details(params.pointer_details);
DispatchUiEvent(&event);
@@ -231,9 +235,11 @@ void EventFactoryEvdev::DispatchMouseWheelEvent(
const MouseWheelEventParams& params) {
TRACE_EVENT1("evdev", "EventFactoryEvdev::DispatchMouseWheelEvent", "device",
params.device_id);
- MouseWheelEvent event(params.delta, params.location, params.location,
+ MouseWheelEvent event(params.delta, gfx::Point(), gfx::Point(),
params.timestamp, modifiers_.GetModifierFlags(),
0 /* changed_button_flags */);
+ event.set_location_f(params.location);
+ event.set_root_location_f(params.location);
event.set_source_device_id(params.device_id);
DispatchUiEvent(&event);
}
@@ -252,10 +258,12 @@ void EventFactoryEvdev::DispatchPinchEvent(const PinchEventParams& params) {
void EventFactoryEvdev::DispatchScrollEvent(const ScrollEventParams& params) {
TRACE_EVENT1("evdev", "EventFactoryEvdev::DispatchScrollEvent", "device",
params.device_id);
- ScrollEvent event(params.type, params.location, params.timestamp,
+ ScrollEvent event(params.type, gfx::Point(), params.timestamp,
modifiers_.GetModifierFlags(), params.delta.x(),
params.delta.y(), params.ordinal_delta.x(),
params.ordinal_delta.y(), params.finger_count);
+ event.set_location_f(params.location);
+ event.set_root_location_f(params.location);
event.set_source_device_id(params.device_id);
DispatchUiEvent(&event);
}
@@ -280,10 +288,12 @@ void EventFactoryEvdev::DispatchTouchEvent(const TouchEventParams& params) {
// params.slot is guaranteed to be < kNumTouchEvdevSlots.
int touch_id = touch_id_generator_.GetGeneratedID(
params.device_id * kNumTouchEvdevSlots + params.slot);
- TouchEvent touch_event(params.type, gfx::PointF(x, y),
+ TouchEvent touch_event(params.type, gfx::Point(),
modifiers_.GetModifierFlags(), touch_id,
params.timestamp, radius_x, radius_y,
/* angle */ 0.f, params.pressure);
+ touch_event.set_location_f(gfx::PointF(x, y));
+ touch_event.set_root_location_f(gfx::PointF(x, y));
touch_event.set_source_device_id(params.device_id);
DispatchUiEvent(&touch_event);
diff --git a/ui/events/test/event_generator.cc b/ui/events/test/event_generator.cc
index 84b53ab..08c8d18 100644
--- a/ui/events/test/event_generator.cc
+++ b/ui/events/test/event_generator.cc
@@ -63,7 +63,7 @@ class TestTouchEvent : public ui::TouchEvent {
int flags,
base::TimeDelta timestamp)
: TouchEvent(type,
- gfx::PointF(root_location),
+ root_location,
flags,
touch_id,
timestamp,
@@ -164,7 +164,7 @@ void EventGenerator::ReleaseRightButton() {
}
void EventGenerator::MoveMouseWheel(int delta_x, int delta_y) {
- auto location = gfx::PointF(GetLocationInCurrentRoot());
+ gfx::Point location = GetLocationInCurrentRoot();
ui::MouseEvent mouseev(ui::ET_MOUSEWHEEL, location, location,
ui::EventTimeForNow(), flags_, 0);
ui::MouseWheelEvent wheelev(mouseev, delta_x, delta_y);
@@ -370,11 +370,13 @@ void EventGenerator::GestureScrollSequenceWithCallback(
float dx = static_cast<float>(end.x() - start.x()) / steps;
float dy = static_cast<float>(end.y() - start.y()) / steps;
- gfx::PointF location = start;
+ gfx::PointF location(start);
for (int i = 0; i < steps; ++i) {
location.Offset(dx, dy);
timestamp += step_delay;
- ui::TouchEvent move(ui::ET_TOUCH_MOVED, location, kTouchId, timestamp);
+ ui::TouchEvent move(ui::ET_TOUCH_MOVED, gfx::Point(), kTouchId, timestamp);
+ move.set_location_f(location);
+ move.set_root_location_f(location);
Dispatch(&move);
callback.Run(ui::ET_GESTURE_SCROLL_UPDATE, gfx::Vector2dF(dx, dy));
}
diff --git a/ui/events/test/events_test_utils.h b/ui/events/test/events_test_utils.h
index c9bd55d..833748a 100644
--- a/ui/events/test/events_test_utils.h
+++ b/ui/events/test/events_test_utils.h
@@ -39,8 +39,11 @@ class LocatedEventTestApi : public EventTestApi {
explicit LocatedEventTestApi(LocatedEvent* located_event);
~LocatedEventTestApi() override;
- void set_location(const gfx::PointF& location) {
- located_event_->location_ = location;
+ void set_location(const gfx::Point& location) {
+ located_event_->set_location(location);
+ }
+ void set_location_f(const gfx::PointF& location) {
+ located_event_->set_location_f(location);
}
private:
diff --git a/ui/gfx/geometry/point.cc b/ui/gfx/geometry/point.cc
index 0893550..0f18afd 100644
--- a/ui/gfx/geometry/point.cc
+++ b/ui/gfx/geometry/point.cc
@@ -14,6 +14,7 @@
#include "base/strings/stringprintf.h"
#include "ui/gfx/geometry/point_conversions.h"
+#include "ui/gfx/geometry/point_f.h"
namespace gfx {
diff --git a/ui/gfx/geometry/point.h b/ui/gfx/geometry/point.h
index 1dcf1d6..d3be2ac 100644
--- a/ui/gfx/geometry/point.h
+++ b/ui/gfx/geometry/point.h
@@ -8,7 +8,6 @@
#include <iosfwd>
#include <string>
-#include "ui/gfx/geometry/point_f.h"
#include "ui/gfx/geometry/vector2d.h"
#include "ui/gfx/gfx_export.h"
@@ -87,10 +86,6 @@ class GFX_EXPORT Point {
return (y_ == rhs.y_) ? (x_ < rhs.x_) : (y_ < rhs.y_);
}
- operator PointF() const {
- return PointF(static_cast<float>(x()), static_cast<float>(y()));
- }
-
// Returns a string representation of point.
std::string ToString() const;
diff --git a/ui/gfx/geometry/point_f.h b/ui/gfx/geometry/point_f.h
index f900c1c..d3a99f1 100644
--- a/ui/gfx/geometry/point_f.h
+++ b/ui/gfx/geometry/point_f.h
@@ -8,6 +8,7 @@
#include <iosfwd>
#include <string>
+#include "ui/gfx/geometry/point.h"
#include "ui/gfx/geometry/vector2d_f.h"
#include "ui/gfx/gfx_export.h"
@@ -20,6 +21,9 @@ class GFX_EXPORT PointF {
PointF(float x, float y) : x_(x), y_(y) {}
~PointF() {}
+ explicit PointF(const Point& p)
+ : PointF(static_cast<float>(p.x()), static_cast<float>(p.y())) {}
+
float x() const { return x_; }
float y() const { return y_; }
void set_x(float x) { x_ = x; }
diff --git a/ui/gfx/geometry/point_unittest.cc b/ui/gfx/geometry/point_unittest.cc
index 07a5d5b..dd5ea1d 100644
--- a/ui/gfx/geometry/point_unittest.cc
+++ b/ui/gfx/geometry/point_unittest.cc
@@ -10,23 +10,13 @@
namespace gfx {
-namespace {
-
-int TestPointF(const PointF& p) {
- return p.x();
-}
-
-} // namespace
-
TEST(PointTest, ToPointF) {
- // Check that implicit conversion from integer to float compiles.
+ // Check that explicit conversion from integer to float compiles.
Point a(10, 20);
- float x = TestPointF(a);
- EXPECT_EQ(x, a.x());
+ PointF b = PointF(a);
- PointF b(10, 20);
- EXPECT_EQ(a, b);
- EXPECT_EQ(b, a);
+ EXPECT_EQ(static_cast<float>(a.x()), b.x());
+ EXPECT_EQ(static_cast<float>(a.y()), b.y());
}
TEST(PointTest, IsOrigin) {
@@ -96,13 +86,12 @@ TEST(PointTest, ToRoundedPoint) {
}
TEST(PointTest, Scale) {
- EXPECT_EQ(PointF().ToString(), ScalePoint(Point(), 2).ToString());
- EXPECT_EQ(PointF().ToString(), ScalePoint(Point(), 2, 2).ToString());
+ EXPECT_EQ(PointF().ToString(), ScalePoint(PointF(), 2).ToString());
+ EXPECT_EQ(PointF().ToString(), ScalePoint(PointF(), 2, 2).ToString());
+ EXPECT_EQ(PointF(2, -2).ToString(), ScalePoint(PointF(1, -1), 2).ToString());
EXPECT_EQ(PointF(2, -2).ToString(),
- ScalePoint(Point(1, -1), 2).ToString());
- EXPECT_EQ(PointF(2, -2).ToString(),
- ScalePoint(Point(1, -1), 2, 2).ToString());
+ ScalePoint(PointF(1, -1), 2, 2).ToString());
PointF zero;
PointF one(1, -1);
diff --git a/ui/ozone/platform/drm/host/drm_cursor.cc b/ui/ozone/platform/drm/host/drm_cursor.cc
index ecbbe52..f8d399d 100644
--- a/ui/ozone/platform/drm/host/drm_cursor.cc
+++ b/ui/ozone/platform/drm/host/drm_cursor.cc
@@ -58,7 +58,7 @@ void DrmCursor::OnWindowAdded(gfx::AcceleratedWidget window,
state_.window = window;
state_.display_bounds_in_screen = bounds_in_screen;
state_.confined_bounds = cursor_confined_bounds;
- SetCursorLocationLocked(cursor_confined_bounds.CenterPoint());
+ SetCursorLocationLocked(gfx::PointF(cursor_confined_bounds.CenterPoint()));
}
}
@@ -74,13 +74,14 @@ void DrmCursor::OnWindowRemoved(gfx::AcceleratedWidget window) {
state_.window = dest_window->GetAcceleratedWidget();
state_.display_bounds_in_screen = dest_window->GetBounds();
state_.confined_bounds = dest_window->GetCursorConfinedBounds();
- SetCursorLocationLocked(state_.confined_bounds.CenterPoint());
+ SetCursorLocationLocked(
+ gfx::PointF(state_.confined_bounds.CenterPoint()));
SendCursorShowLocked();
} else {
state_.window = gfx::kNullAcceleratedWidget;
state_.display_bounds_in_screen = gfx::Rect();
state_.confined_bounds = gfx::Rect();
- state_.location = gfx::Point();
+ state_.location = gfx::PointF();
}
}
}
@@ -206,7 +207,7 @@ void DrmCursor::SetCursorLocationLocked(const gfx::PointF& location) {
state_.lock.AssertAcquired();
gfx::PointF clamped_location = location;
- clamped_location.SetToMax(state_.confined_bounds.origin());
+ clamped_location.SetToMax(gfx::PointF(state_.confined_bounds.origin()));
// Right and bottom edges are exclusive.
clamped_location.SetToMin(gfx::PointF(state_.confined_bounds.right() - 1,
state_.confined_bounds.bottom() - 1));
diff --git a/ui/ozone/platform/drm/host/drm_window_host.cc b/ui/ozone/platform/drm/host/drm_window_host.cc
index 183322d..4255904 100644
--- a/ui/ozone/platform/drm/host/drm_window_host.cc
+++ b/ui/ozone/platform/drm/host/drm_window_host.cc
@@ -113,7 +113,7 @@ void DrmWindowHost::SetCursor(PlatformCursor cursor) {
}
void DrmWindowHost::MoveCursorTo(const gfx::Point& location) {
- event_factory_->WarpCursorTo(widget_, location);
+ event_factory_->WarpCursorTo(widget_, gfx::PointF(location));
}
void DrmWindowHost::ConfineCursorToBounds(const gfx::Rect& bounds) {
@@ -162,7 +162,7 @@ bool DrmWindowHost::CanDispatchEvent(const PlatformEvent& ne) {
return display_bounds == bounds_;
} else if (event->IsLocatedEvent()) {
LocatedEvent* located_event = static_cast<LocatedEvent*>(event);
- return bounds_.Contains(gfx::ToFlooredPoint(located_event->location()));
+ return bounds_.Contains(located_event->location());
}
// TODO(spang): For non-ash builds we would need smarter keyboard focus.
@@ -176,10 +176,10 @@ uint32_t DrmWindowHost::DispatchEvent(const PlatformEvent& native_event) {
if (event->IsLocatedEvent()) {
// Make the event location relative to this window's origin.
LocatedEvent* located_event = static_cast<LocatedEvent*>(event);
- gfx::PointF location = located_event->location();
- location -= bounds_.OffsetFromOrigin();
- located_event->set_location(location);
- located_event->set_root_location(location);
+ gfx::PointF location = located_event->location_f();
+ location -= gfx::Vector2dF(bounds_.OffsetFromOrigin());
+ located_event->set_location_f(location);
+ located_event->set_root_location_f(location);
}
DispatchEventFromNativeUiEvent(
native_event, base::Bind(&PlatformWindowDelegate::DispatchEvent,
diff --git a/ui/ozone/platform/egltest/ozone_platform_egltest.cc b/ui/ozone/platform/egltest/ozone_platform_egltest.cc
index 371ba33..cae3695 100644
--- a/ui/ozone/platform/egltest/ozone_platform_egltest.cc
+++ b/ui/ozone/platform/egltest/ozone_platform_egltest.cc
@@ -66,7 +66,7 @@ void ScaleTouchEvent(TouchEvent* event, const gfx::SizeF& size) {
size.height() / touchscreen_size.height());
double ratio = std::sqrt(size.GetArea() / touchscreen_size.GetArea());
- event->set_location(location);
+ 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);
return;
@@ -177,7 +177,7 @@ void EgltestWindow::SetCursor(PlatformCursor cursor) {
}
void EgltestWindow::MoveCursorTo(const gfx::Point& location) {
- event_factory_->WarpCursorTo(window_id_, location);
+ event_factory_->WarpCursorTo(window_id_, gfx::PointF(location));
}
void EgltestWindow::ConfineCursorToBounds(const gfx::Rect& bounds) {
diff --git a/ui/platform_window/android/platform_window_android.cc b/ui/platform_window/android/platform_window_android.cc
index 50e6b86..49b6ba7 100644
--- a/ui/platform_window/android/platform_window_android.cc
+++ b/ui/platform_window/android/platform_window_android.cc
@@ -118,9 +118,11 @@ bool PlatformWindowAndroid::TouchEvent(JNIEnv* env,
ui::EventType event_type = MotionEventActionToEventType(masked_action);
if (event_type == ui::ET_UNKNOWN)
return false;
- ui::TouchEvent touch(event_type, gfx::PointF(x, y), ui::EF_NONE, pointer_id,
- base::TimeDelta::FromMilliseconds(time_ms),
- touch_major, touch_minor, orientation, pressure);
+ ui::TouchEvent touch(event_type, gfx::Point(), ui::EF_NONE, pointer_id,
+ base::TimeDelta::FromMilliseconds(time_ms), touch_major,
+ touch_minor, orientation, pressure);
+ touch.set_location_f(gfx::PointF(x, y));
+ touch.set_root_location_f(gfx::PointF(x, y));
delegate_->DispatchEvent(&touch);
return true;
}
diff --git a/ui/views/controls/textfield/textfield.cc b/ui/views/controls/textfield/textfield.cc
index 039102b..4e8ec87 100644
--- a/ui/views/controls/textfield/textfield.cc
+++ b/ui/views/controls/textfield/textfield.cc
@@ -1157,8 +1157,8 @@ void Textfield::GetSelectionEndPoints(ui::SelectionBound* anchor,
gfx::Rect r1 = render_text->GetCursorBounds(start_sel, true);
gfx::Rect r2 = render_text->GetCursorBounds(sel, true);
- anchor->SetEdge(r1.origin(), r1.bottom_left());
- focus->SetEdge(r2.origin(), r2.bottom_left());
+ anchor->SetEdge(gfx::PointF(r1.origin()), gfx::PointF(r1.bottom_left()));
+ focus->SetEdge(gfx::PointF(r2.origin()), gfx::PointF(r2.bottom_left()));
// Determine the SelectionBound's type for focus and anchor.
// TODO(mfomitchev): Ideally we should have different logical directions for
diff --git a/ui/views/mus/window_manager_connection.cc b/ui/views/mus/window_manager_connection.cc
index 97d9765..c57b20e 100644
--- a/ui/views/mus/window_manager_connection.cc
+++ b/ui/views/mus/window_manager_connection.cc
@@ -43,9 +43,9 @@ struct TypeConverter<gfx::Display, mus::mojom::DisplayPtr> {
result.SetScaleAndBounds(input->device_pixel_ratio,
input->bounds.To<gfx::Rect>());
gfx::Rect work_area(
- gfx::ToFlooredPoint(gfx::ScalePoint(
+ gfx::ScaleToFlooredPoint(
gfx::Point(input->work_area->x, input->work_area->y),
- 1.0f / input->device_pixel_ratio)),
+ 1.0f / input->device_pixel_ratio),
gfx::ScaleToFlooredSize(
gfx::Size(input->work_area->width, input->work_area->height),
1.0f / input->device_pixel_ratio));
diff --git a/ui/views/touchui/touch_selection_controller_impl_unittest.cc b/ui/views/touchui/touch_selection_controller_impl_unittest.cc
index 95c5161..8b668c7 100644
--- a/ui/views/touchui/touch_selection_controller_impl_unittest.cc
+++ b/ui/views/touchui/touch_selection_controller_impl_unittest.cc
@@ -733,7 +733,7 @@ TEST_F(TouchSelectionControllerImplTest, HandlesStackAboveParent) {
// Start touch editing, check that the handle is above the first window, and
// end touch editing.
StartTouchEditing();
- auto test_point = gfx::PointF(GetCursorHandleDragPoint());
+ gfx::Point test_point = GetCursorHandleDragPoint();
ui::MouseEvent test_event1(ui::ET_MOUSE_MOVED, test_point, test_point,
ui::EventTimeForNow(), ui::EF_NONE, ui::EF_NONE);
EXPECT_EQ(GetCursorHandleNativeView(),
diff --git a/ui/views/widget/desktop_aura/desktop_window_tree_host_x11.cc b/ui/views/widget/desktop_aura/desktop_window_tree_host_x11.cc
index 082d8b3..298c92b 100644
--- a/ui/views/widget/desktop_aura/desktop_window_tree_host_x11.cc
+++ b/ui/views/widget/desktop_aura/desktop_window_tree_host_x11.cc
@@ -1545,7 +1545,7 @@ void DesktopWindowTreeHostX11::ConvertEventToDifferentHost(
host->GetLocationOnNativeScreen();
gfx::PointF location_in_pixel_in_host =
located_event->location_f() + gfx::Vector2dF(offset);
- located_event->set_location(location_in_pixel_in_host);
+ located_event->set_location_f(location_in_pixel_in_host);
}
void DesktopWindowTreeHostX11::ResetWindowRegion() {
diff --git a/win8/metro_driver/chrome_app_view_ash.cc b/win8/metro_driver/chrome_app_view_ash.cc
index 55335a4..15158dd 100644
--- a/win8/metro_driver/chrome_app_view_ash.cc
+++ b/win8/metro_driver/chrome_app_view_ash.cc
@@ -388,10 +388,9 @@ class ChromeAppViewAsh::PointerInfoHandler {
// via the win32 scale factor which achieves the needful.
gfx::Point dip_point_metro(point.X, point.Y);
gfx::Point scaled_point_metro =
- gfx::ToCeiledPoint(gfx::ScalePoint(dip_point_metro, metro_dpi_scale_));
+ gfx::ScaleToCeiledPoint(dip_point_metro, metro_dpi_scale_);
gfx::Point dip_point_win32 =
- gfx::ToCeiledPoint(gfx::ScalePoint(scaled_point_metro,
- 1.0 / win32_dpi_scale_));
+ gfx::ScaleToCeiledPoint(scaled_point_metro, 1.0 / win32_dpi_scale_);
x_ = dip_point_win32.x();
y_ = dip_point_win32.y();