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

Unified Diff: ui/aura/desktop.cc

Issue 8700013: Release aura::Desktop event handler windows on detaching an ancestor window. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Use parent_ to access parent. Created 9 years, 1 month 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
« no previous file with comments | « no previous file | ui/aura/window.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/aura/desktop.cc
diff --git a/ui/aura/desktop.cc b/ui/aura/desktop.cc
index 90ee1716fc309bb76a50e7dfeace8cd369d75bda..a4fe0083fca532c74139a3968590445a1bf5f054 100644
--- a/ui/aura/desktop.cc
+++ b/ui/aura/desktop.cc
@@ -533,19 +533,22 @@ void Desktop::WindowDetachedFromDesktop(Window* detached) {
// If the ancestor of the capture window is detached,
// release the capture.
- aura::Window* window = capture_window_;
- while (window && window != detached)
- window = window->parent();
- if (window && window != this)
+ if (detached->Contains(capture_window_) && detached != this)
ReleaseCapture(capture_window_);
- // If the ancestor of the capture window is detached,
+ // If the ancestor of the focused window is detached,
// release the focus.
- window = focused_window_;
- while (window && window != detached)
- window = window->parent();
- if (window)
+ if (detached->Contains(focused_window_))
SetFocusedWindow(NULL);
+
+ // If the ancestor of any event handler windows are detached, release the
+ // pointer to those windows.
+ if (detached->Contains(mouse_pressed_handler_))
+ mouse_pressed_handler_ = NULL;
+ if (detached->Contains(mouse_moved_handler_))
+ mouse_moved_handler_ = NULL;
+ if (detached->Contains(touch_event_handler_))
+ touch_event_handler_ = NULL;
}
void Desktop::OnLayerAnimationEnded(
« no previous file with comments | « no previous file | ui/aura/window.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698