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

Unified Diff: mojo/converters/input_events/input_events_type_converters.cc

Issue 1362793002: Construct and check for mojo::Event's LocationData as needed. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Also audit wheel_data and brush_data. Created 5 years, 3 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
« components/pdf_viewer/pdf_viewer.cc ('K') | « components/pdf_viewer/pdf_viewer.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/converters/input_events/input_events_type_converters.cc
diff --git a/mojo/converters/input_events/input_events_type_converters.cc b/mojo/converters/input_events/input_events_type_converters.cc
index 79fd047e71846416d8a4eb310381f1435196aeee..8e4839192c43ee1ef6f58678df30fc504dc53c02 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),
« components/pdf_viewer/pdf_viewer.cc ('K') | « components/pdf_viewer/pdf_viewer.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698