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

Unified Diff: components/mus/gesture_manager.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
Index: components/mus/gesture_manager.cc
diff --git a/components/mus/gesture_manager.cc b/components/mus/gesture_manager.cc
index 0b35c9a5bdf36e2e6125f50efad3e72c6b4a03da..5cedf3a8b42138a8454d68a8583023db33e3e49a 100644
--- a/components/mus/gesture_manager.cc
+++ b/components/mus/gesture_manager.cc
@@ -55,12 +55,14 @@ Views GetTouchTargets(const ServerView* deepest) {
mojo::EventPtr CloneEventForView(const mojo::Event& event,
const ServerView* view) {
mojo::EventPtr result(event.Clone());
- const gfx::PointF location(event.pointer_data->location->x,
- event.pointer_data->location->y);
- const gfx::PointF target_location(
- ConvertPointFBetweenViews(view->GetRoot(), view, location));
- result->pointer_data->location->x = target_location.x();
- result->pointer_data->location->y = target_location.y();
+ if (event.pointer_data && event.pointer_data->location) {
+ const gfx::PointF location(event.pointer_data->location->x,
+ event.pointer_data->location->y);
+ const gfx::PointF target_location(
+ ConvertPointFBetweenViews(view->GetRoot(), view, location));
+ result->pointer_data->location->x = target_location.x();
+ result->pointer_data->location->y = target_location.y();
+ }
return result.Pass();
}
@@ -535,7 +537,7 @@ GestureManager::~GestureManager() {
}
bool GestureManager::ProcessEvent(const mojo::Event& event) {
- if (!event.pointer_data)
+ if (!event.pointer_data || !event.pointer_data->location)
return false;
ScheduledDeleteProcessor delete_processor(this);

Powered by Google App Engine
This is Rietveld 408576698