summaryrefslogtreecommitdiffstats
path: root/ui/aura/root_window.cc
diff options
context:
space:
mode:
authortdanderson@google.com <tdanderson@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2013-09-20 15:29:59 +0000
committertdanderson@google.com <tdanderson@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2013-09-20 15:29:59 +0000
commit450edc67348bc0106da16e56d783b2c3c9a9030c (patch)
tree42ea2652c4acfdb5000895920ff0368da9b75ddf /ui/aura/root_window.cc
parent92576792823018d937fc58e74267b0d30663e459 (diff)
downloadchromium_src-450edc67348bc0106da16e56d783b2c3c9a9030c.zip
chromium_src-450edc67348bc0106da16e56d783b2c3c9a9030c.tar.gz
chromium_src-450edc67348bc0106da16e56d783b2c3c9a9030c.tar.bz2
Dispatch a ui::ET_MOUSE_EXITED event when the cursor becomes invisible
Clear existing hover effects in views when the cursor becomes invisible by dispatching a mouse exit at the cursor's location. Note we do not need to dispatch a mouse enter when the cursor becomes visible because that can only happen in response to a mouse event, which will trigger its own mouse enter. The early exit in Widget::OnMouseEvent() is no longer needed since the issue it was originally meant to fix (issue 239363) is also fixed by revision 208303. It is being removed here since it blocks the dispatch of mouse exit events. BUG=244262,253317 R=oshima@chromium.org, sadrul@chromium.org Review URL: https://codereview.chromium.org/23935007 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@224384 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui/aura/root_window.cc')
-rw-r--r--ui/aura/root_window.cc21
1 files changed, 14 insertions, 7 deletions
diff --git a/ui/aura/root_window.cc b/ui/aura/root_window.cc
index 6e6fad4..133b486 100644
--- a/ui/aura/root_window.cc
+++ b/ui/aura/root_window.cc
@@ -280,6 +280,13 @@ void RootWindow::SetCursor(gfx::NativeCursor cursor) {
}
void RootWindow::OnCursorVisibilityChanged(bool show) {
+ // Clear any existing mouse hover effects when the cursor becomes invisible.
+ // Note we do not need to dispatch a mouse enter when the cursor becomes
+ // visible because that can only happen in response to a mouse event, which
+ // will trigger its own mouse enter.
+ if (!show)
+ DispatchMouseExitAtPoint(GetLastMouseLocationInRoot());
+
host_->OnCursorVisibilityChanged(show);
}
@@ -382,13 +389,13 @@ void RootWindow::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)) {
- ui::MouseEvent event(ui::ET_MOUSE_EXITED,
- last_mouse_location,
- last_mouse_location,
- ui::EF_NONE);
- DispatchMouseEnterOrExit(event, ui::ET_MOUSE_EXITED);
- }
+ window->ContainsPointInRoot(last_mouse_location))
+ DispatchMouseExitAtPoint(last_mouse_location);
+}
+
+void RootWindow::DispatchMouseExitAtPoint(const gfx::Point& point) {
+ ui::MouseEvent event(ui::ET_MOUSE_EXITED, point, point, ui::EF_NONE);
+ DispatchMouseEnterOrExit(event, ui::ET_MOUSE_EXITED);
}
void RootWindow::OnWindowVisibilityChanged(Window* window, bool is_visible) {