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

Unified Diff: ui/events/test/event_generator.cc

Issue 2786693002: Add PointerDetails to ui::MouseEvent's constructors (Closed)
Patch Set: mouse event constructor Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: ui/events/test/event_generator.cc
diff --git a/ui/events/test/event_generator.cc b/ui/events/test/event_generator.cc
index 212afc73281d4e239a6a1354cb381448129a6931..3579f8b30d0f13a8477db41ea73e8d4b98d49e0c 100644
--- a/ui/events/test/event_generator.cc
+++ b/ui/events/test/event_generator.cc
@@ -169,16 +169,22 @@ void EventGenerator::MoveMouseWheel(int delta_x, int delta_y) {
void EventGenerator::SendMouseEnter() {
gfx::Point enter_location(current_location_);
delegate()->ConvertPointToTarget(current_target_, &enter_location);
- ui::MouseEvent mouseev(ui::ET_MOUSE_ENTERED, enter_location, enter_location,
- ui::EventTimeForNow(), flags_, 0);
+ ui::MouseEvent mouseev(
+ ui::ET_MOUSE_ENTERED, enter_location, enter_location,
+ ui::EventTimeForNow(), flags_, 0,
+ ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_MOUSE,
+ ui::PointerEvent::kMousePointerId));
Dispatch(&mouseev);
}
void EventGenerator::SendMouseExit() {
gfx::Point exit_location(current_location_);
delegate()->ConvertPointToTarget(current_target_, &exit_location);
- ui::MouseEvent mouseev(ui::ET_MOUSE_EXITED, exit_location, exit_location,
- ui::EventTimeForNow(), flags_, 0);
+ ui::MouseEvent mouseev(
+ ui::ET_MOUSE_EXITED, exit_location, exit_location, ui::EventTimeForNow(),
+ flags_, 0,
+ ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_MOUSE,
+ ui::PointerEvent::kMousePointerId));
Dispatch(&mouseev);
}
@@ -195,14 +201,19 @@ void EventGenerator::MoveMouseToWithNative(const gfx::Point& point_in_host,
// Create a fake event with the point in host, which will be passed
// to the non native event, then update the native event with the native
// (root) one.
- std::unique_ptr<ui::MouseEvent> native_event(
- new ui::MouseEvent(ui::ET_MOUSE_MOVED, point_in_host, point_in_host,
- ui::EventTimeForNow(), flags_, 0));
+ std::unique_ptr<ui::MouseEvent> native_event(new ui::MouseEvent(
+ ui::ET_MOUSE_MOVED, point_in_host, point_in_host, ui::EventTimeForNow(),
+ flags_, 0,
+ ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_MOUSE,
+ ui::PointerEvent::kMousePointerId)));
ui::MouseEvent mouseev(native_event.get());
native_event->set_location(point_for_native);
#else
- ui::MouseEvent mouseev(ui::ET_MOUSE_MOVED, point_in_host, point_for_native,
- ui::EventTimeForNow(), flags_, 0);
+ ui::MouseEvent mouseev(
+ ui::ET_MOUSE_MOVED, point_in_host, point_for_native,
+ ui::EventTimeForNow(), flags_, 0,
+ ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_MOUSE,
+ ui::PointerEvent::kMousePointerId));
LOG(FATAL)
<< "Generating a native motion event is not supported on this platform";
#endif
@@ -215,8 +226,11 @@ void EventGenerator::MoveMouseToWithNative(const gfx::Point& point_in_host,
void EventGenerator::MoveMouseToInHost(const gfx::Point& point_in_host) {
const ui::EventType event_type = (flags_ & ui::EF_LEFT_MOUSE_BUTTON) ?
ui::ET_MOUSE_DRAGGED : ui::ET_MOUSE_MOVED;
- ui::MouseEvent mouseev(event_type, point_in_host, point_in_host,
- ui::EventTimeForNow(), flags_, 0);
+ ui::MouseEvent mouseev(
+ event_type, point_in_host, point_in_host, ui::EventTimeForNow(), flags_,
+ 0,
+ ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_MOUSE,
+ ui::PointerEvent::kMousePointerId));
Dispatch(&mouseev);
current_location_ = point_in_host;
@@ -237,8 +251,10 @@ void EventGenerator::MoveMouseTo(const gfx::Point& point_in_screen,
if (!grab_)
UpdateCurrentDispatcher(move_point);
delegate()->ConvertPointToTarget(current_target_, &move_point);
- ui::MouseEvent mouseev(event_type, move_point, move_point,
- ui::EventTimeForNow(), flags_, 0);
+ ui::MouseEvent mouseev(
+ event_type, move_point, move_point, ui::EventTimeForNow(), flags_, 0,
+ ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_MOUSE,
+ ui::PointerEvent::kMousePointerId));
Dispatch(&mouseev);
}
current_location_ = point_in_screen;
@@ -664,8 +680,11 @@ void EventGenerator::PressButton(int flag) {
flags_ |= flag;
grab_ = (flags_ & kAllButtonMask) != 0;
gfx::Point location = GetLocationInCurrentRoot();
- ui::MouseEvent mouseev(ui::ET_MOUSE_PRESSED, location, location,
- ui::EventTimeForNow(), flags_, flag);
+ ui::MouseEvent mouseev(
+ ui::ET_MOUSE_PRESSED, location, location, ui::EventTimeForNow(), flags_,
+ flag,
+ ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_MOUSE,
+ ui::PointerEvent::kMousePointerId));
Dispatch(&mouseev);
}
}
@@ -673,8 +692,11 @@ void EventGenerator::PressButton(int flag) {
void EventGenerator::ReleaseButton(int flag) {
if (flags_ & flag) {
gfx::Point location = GetLocationInCurrentRoot();
- ui::MouseEvent mouseev(ui::ET_MOUSE_RELEASED, location, location,
- ui::EventTimeForNow(), flags_, flag);
+ ui::MouseEvent mouseev(
+ ui::ET_MOUSE_RELEASED, location, location, ui::EventTimeForNow(),
+ flags_, flag,
+ ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_MOUSE,
+ ui::PointerEvent::kMousePointerId));
Dispatch(&mouseev);
flags_ ^= flag;
}

Powered by Google App Engine
This is Rietveld 408576698