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

Unified Diff: ui/events/event.cc

Issue 2287403002: Create MouseWheelEvent directly instead of through MouseEvent. (Closed)
Patch Set: test Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/events/event.h ('k') | ui/events/event_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/events/event.cc
diff --git a/ui/events/event.cc b/ui/events/event.cc
index 8ce2ae6941c0fa6fe097d5ac418df2deedebd900..7198a5dedf9626699b330aa87fcd2bcbf53dee93 100644
--- a/ui/events/event.cc
+++ b/ui/events/event.cc
@@ -522,6 +522,7 @@ MouseEvent::MouseEvent(EventType type,
flags),
changed_button_flags_(changed_button_flags),
pointer_details_(PointerDetails(EventPointerType::POINTER_TYPE_MOUSE)) {
+ DCHECK_NE(ET_MOUSEWHEEL, type);
latency()->AddLatencyNumber(INPUT_EVENT_LATENCY_UI_COMPONENT, 0, 0);
if (this->type() == ET_MOUSE_MOVED && IsAnyButton())
SetType(ET_MOUSE_DRAGGED);
@@ -679,13 +680,18 @@ MouseWheelEvent::MouseWheelEvent(const gfx::Vector2d& offset,
base::TimeTicks time_stamp,
int flags,
int changed_button_flags)
- : MouseEvent(ui::ET_MOUSEWHEEL,
+ : MouseEvent(ui::ET_UNKNOWN,
location,
root_location,
time_stamp,
flags,
changed_button_flags),
- offset_(offset) {}
+ offset_(offset) {
+ // Set event type to ET_UNKNOWN initially in MouseEvent() to pass the
+ // DCHECK for type to enforce that we use MouseWheelEvent() to create
+ // a MouseWheelEvent.
+ SetType(ui::ET_MOUSEWHEEL);
+}
#if defined(OS_WIN)
// This value matches windows WHEEL_DELTA.
« no previous file with comments | « ui/events/event.h ('k') | ui/events/event_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698