diff --git a/ui/platform_window/x11/x11_topmost_window_finder.cc b/ui/platform_window/x11/x11_topmost_window_finder.cc index e20bf0abf..c9c672c60 100644 --- a/ui/platform_window/x11/x11_topmost_window_finder.cc +++ b/ui/platform_window/x11/x11_topmost_window_finder.cc @@ -42,12 +42,12 @@ bool EnumerateChildren(ShouldStopIteratingCallback should_stop_iterating, // reverse-iterate the list to check the windows from top-to-bottom. std::vector::reverse_iterator iter; for (iter = windows.rbegin(); iter != windows.rend(); iter++) { - if (IsWindowNamed(*iter) && should_stop_iterating.Run(*iter)) - return true; if (depth < max_depth) { if (EnumerateChildren(should_stop_iterating, *iter, max_depth, depth + 1)) return true; } + if (IsWindowNamed(*iter) && should_stop_iterating.Run(*iter)) + return true; } return false;