diff options
author | msw <msw@chromium.org> | 2015-09-22 16:45:15 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-09-22 23:46:32 +0000 |
commit | b143a367f667fa8608ab3286a74fc78fd704323d (patch) | |
tree | 680b5f9b081add532b69549d2ed88e6780fdcf34 /mojo/converters | |
parent | 46ce5e6bc615a0f23207130ea2a06bff589ad2c0 (diff) | |
download | chromium_src-b143a367f667fa8608ab3286a74fc78fd704323d.zip chromium_src-b143a367f667fa8608ab3286a74fc78fd704323d.tar.gz chromium_src-b143a367f667fa8608ab3286a74fc78fd704323d.tar.bz2 |
Construct and check for mojo::Event's LocationData as needed.
The location struct replaced |x| and |y| basic types by:
https://codereview.chromium.org/1313353010
I audited pointer_data, wheel_data, and brush_data use too.
BUG=534982
TEST=No crashes running view_manager_unittests locally.
R=rjkroege@chromium.org
TBR=sky@chromium.org
Review URL: https://codereview.chromium.org/1362793002
Cr-Commit-Position: refs/heads/master@{#350265}
Diffstat (limited to 'mojo/converters')
-rw-r--r-- | mojo/converters/input_events/input_events_type_converters.cc | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/mojo/converters/input_events/input_events_type_converters.cc b/mojo/converters/input_events/input_events_type_converters.cc index 79fd047..8e48391 100644 --- a/mojo/converters/input_events/input_events_type_converters.cc +++ b/mojo/converters/input_events/input_events_type_converters.cc @@ -20,7 +20,7 @@ namespace mojo { namespace { ui::EventType MojoMouseEventTypeToUIEvent(const EventPtr& event) { - DCHECK(!event->pointer_data.is_null()); + DCHECK(event->pointer_data); DCHECK_EQ(POINTER_KIND_MOUSE, event->pointer_data->kind); switch (event->action) { case EVENT_TYPE_POINTER_DOWN: @@ -46,7 +46,7 @@ ui::EventType MojoMouseEventTypeToUIEvent(const EventPtr& event) { } ui::EventType MojoTouchEventTypeToUIEvent(const EventPtr& event) { - DCHECK(!event->pointer_data.is_null()); + DCHECK(event->pointer_data); DCHECK_EQ(POINTER_KIND_TOUCH, event->pointer_data->kind); switch (event->action) { case EVENT_TYPE_POINTER_DOWN: @@ -69,7 +69,7 @@ ui::EventType MojoTouchEventTypeToUIEvent(const EventPtr& event) { } ui::EventType MojoWheelEventTypeToUIEvent(const EventPtr& event) { - DCHECK(!event->wheel_data.is_null()); + DCHECK(event->wheel_data); return ui::ET_MOUSEWHEEL; } @@ -275,7 +275,7 @@ scoped_ptr<ui::Event> TypeConverter<scoped_ptr<ui::Event>, EventPtr>::Convert( const EventPtr& input) { gfx::PointF location; gfx::PointF screen_location; - if (!input->pointer_data.is_null()) { + if (input->pointer_data && input->pointer_data->location) { location.SetPoint(input->pointer_data->location->x, input->pointer_data->location->y); screen_location.SetPoint(input->pointer_data->location->screen_x, @@ -321,6 +321,7 @@ scoped_ptr<ui::Event> TypeConverter<scoped_ptr<ui::Event>, EventPtr>::Convert( return event.Pass(); } break; case POINTER_KIND_TOUCH: { + DCHECK(input->pointer_data->brush_data); scoped_ptr<ui::TouchEvent> touch_event(new ui::TouchEvent( MojoTouchEventTypeToUIEvent(input), location, ui::EventFlags(input->flags), input->pointer_data->pointer_id, @@ -337,6 +338,7 @@ scoped_ptr<ui::Event> TypeConverter<scoped_ptr<ui::Event>, EventPtr>::Convert( } } break; case EVENT_TYPE_WHEEL: { + DCHECK(input->wheel_data); scoped_ptr<ui::MouseEvent> pre_wheel_event(new ui::MouseEvent( MojoWheelEventTypeToUIEvent(input), location, screen_location, ui::EventTimeForNow(), ui::EventFlags(input->flags), |