Index: services/ui/ws/window_manager_state.cc |
diff --git a/services/ui/ws/window_manager_state.cc b/services/ui/ws/window_manager_state.cc |
index 224207202adc95319a720e7aab3b604d6d27c146..3738a6b61c158fb696cf0bfc3d5d7b6fc949b8fc 100644 |
--- a/services/ui/ws/window_manager_state.cc |
+++ b/services/ui/ws/window_manager_state.cc |
@@ -507,15 +507,15 @@ ClientSpecificId WindowManagerState::GetEventTargetClientId( |
// the window. |
WindowTree* tree = nullptr; |
if (in_nonclient_area) { |
- tree = window_server()->GetTreeWithId(window->id().client_id); |
+ // Events in the non-client area always go to the window manager. |
+ tree = window_tree_; |
} else { |
// If the window is an embed root, forward to the embedded window. |
tree = window_server()->GetTreeWithRoot(window); |
if (!tree) |
tree = window_server()->GetTreeWithId(window->id().client_id); |
- } |
+ DCHECK(tree); |
- if (tree) { |
const ServerWindow* embed_root = |
tree->HasRoot(window) ? window : GetEmbedRoot(window); |
while (tree && tree->embedder_intercepts_events()) { |
@@ -523,11 +523,7 @@ ClientSpecificId WindowManagerState::GetEventTargetClientId( |
tree = window_server()->GetTreeWithId(embed_root->id().client_id); |
embed_root = GetEmbedRoot(embed_root); |
} |
- } |
- |
- if (!tree) { |
- DCHECK(in_nonclient_area); |
- tree = window_tree_; |
+ DCHECK(tree); |
} |
return tree->id(); |
} |