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. |