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

Unified Diff: ui/aura/window_event_dispatcher.cc

Issue 344793013: Dispatch a synthetic mouse exit to the widget handling mouse events when a widget grabs capture (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 6 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: ui/aura/window_event_dispatcher.cc
diff --git a/ui/aura/window_event_dispatcher.cc b/ui/aura/window_event_dispatcher.cc
index 0f4715066fad90842b2a2f2eea23251e15ad2909..516d0ce48ca2fa755a26e9a004480ddcf919afde 100644
--- a/ui/aura/window_event_dispatcher.cc
+++ b/ui/aura/window_event_dispatcher.cc
@@ -150,13 +150,11 @@ void WindowEventDispatcher::DispatchGestureEvent(ui::GestureEvent* event) {
}
}
-void WindowEventDispatcher::DispatchMouseExitAtPoint(const gfx::Point& point) {
+DispatchDetails WindowEventDispatcher::DispatchMouseExitAtPoint(
+ const gfx::Point& point) {
ui::MouseEvent event(ui::ET_MOUSE_EXITED, point, point, ui::EF_NONE,
ui::EF_NONE);
- DispatchDetails details =
- DispatchMouseEnterOrExit(event, ui::ET_MOUSE_EXITED);
- if (details.dispatcher_destroyed)
- return;
+ return DispatchMouseEnterOrExit(event, ui::ET_MOUSE_EXITED);
}
void WindowEventDispatcher::ProcessedTouchEvent(ui::TouchEvent* event,
@@ -242,8 +240,11 @@ void WindowEventDispatcher::DispatchMouseExitToHidingWindow(Window* window) {
// |window| is the capture window.
gfx::Point last_mouse_location = GetLastMouseLocationInRoot();
if (window->Contains(mouse_moved_handler_) &&
- window->ContainsPointInRoot(last_mouse_location))
- DispatchMouseExitAtPoint(last_mouse_location);
+ window->ContainsPointInRoot(last_mouse_location)) {
+ DispatchDetails details = DispatchMouseExitAtPoint(last_mouse_location);
+ if (details.dispatcher_destroyed)
+ return;
+ }
}
ui::EventDispatchDetails WindowEventDispatcher::DispatchMouseEnterOrExit(
@@ -387,6 +388,16 @@ void WindowEventDispatcher::UpdateCapture(Window* old_capture,
}
void WindowEventDispatcher::OnOtherRootGotCapture() {
+ if (mouse_moved_handler_) {
+ // Dispatch a mouse exit to reset any state associated with hover. This is
+ // important when going from no window having capture to a window having
+ // capture because we do not dispatch ET_MOUSE_CAPTURE_CHANGED in this case.
+ DispatchDetails details = DispatchMouseExitAtPoint(
+ GetLastMouseLocationInRoot());
+ if (details.dispatcher_destroyed)
+ return;
+ }
+
mouse_moved_handler_ = NULL;
mouse_pressed_handler_ = NULL;
}

Powered by Google App Engine
This is Rietveld 408576698