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

Unified Diff: ash/sticky_keys/sticky_keys_controller.cc

Issue 227113009: Fix sticky keys crash when handling synthetic events without a native event. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fixes Created 6 years, 8 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: ash/sticky_keys/sticky_keys_controller.cc
diff --git a/ash/sticky_keys/sticky_keys_controller.cc b/ash/sticky_keys/sticky_keys_controller.cc
index e5bb0afe2483c32c1dbd4a20dfff9f6583cf4c8b..45c1248567614e7062aa0e0d135adb9b544fb82d 100644
--- a/ash/sticky_keys/sticky_keys_controller.cc
+++ b/ash/sticky_keys/sticky_keys_controller.cc
@@ -69,10 +69,18 @@ void StickyKeysHandlerDelegateImpl::DispatchMouseEvent(ui::MouseEvent* event,
DCHECK(target);
// We need to send a new, untransformed mouse event to the host.
if (event->IsMouseWheelEvent()) {
- ui::MouseWheelEvent new_event(event->native_event());
+ aura::Window* source = static_cast<aura::Window*>(event->target());
+ ui::MouseWheelEvent new_event(*static_cast<ui::MouseWheelEvent*>(event),
+ source,
+ source->GetRootWindow());
+ // Transform the location back to host coordinates before dispatching.
+ new_event.UpdateForRootTransform(source->GetHost()->GetRootTransform());
DispatchEvent(&new_event, target);
} else {
- ui::MouseEvent new_event(event->native_event());
+ aura::Window* source = static_cast<aura::Window*>(event->target());
+ ui::MouseEvent new_event(*event, source, source->GetRootWindow());
+ // Transform the location back to host coordinates before dispatching.
+ new_event.UpdateForRootTransform(source->GetHost()->GetRootTransform());
DispatchEvent(&new_event, target);
}
}

Powered by Google App Engine
This is Rietveld 408576698