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

Unified Diff: ui/views/focus/focus_manager.cc

Issue 2371113003: Do not give instant focus if a view's toplevelwidget is not active (Closed)
Patch Set: based on comments Created 4 years, 2 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
« no previous file with comments | « ui/views/controls/combobox/combobox_unittest.cc ('k') | ui/views/mus/native_widget_mus.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/focus/focus_manager.cc
diff --git a/ui/views/focus/focus_manager.cc b/ui/views/focus/focus_manager.cc
index d5858e28e9eed91bc22cbd577a425e1cfef91fd3..719510805ab2e8f5a8811d6ac764fe8ce2b770fa 100644
--- a/ui/views/focus/focus_manager.cc
+++ b/ui/views/focus/focus_manager.cc
@@ -313,6 +313,21 @@ void FocusManager::SetFocusedViewWithReason(
if (focused_view_ == view)
return;
+#if !defined(OS_MACOSX)
+ // TODO(warx): There are some AccessiblePaneViewTest failed on macosx.
+ // crbug.com/650859. Remove !defined(OS_MACOSX) once that is fixed.
+ //
+ // If the widget isn't active store the focused view and then attempt to
+ // activate the widget. If activation succeeds |view| will be focused.
+ // If activation fails |view| will be focused the next time the widget is
+ // made active.
+ if (view && !widget_->IsActive()) {
+ SetStoredFocusView(view);
+ widget_->Activate();
+ return;
+ }
+#endif
+
base::AutoReset<bool> auto_changing_focus(&is_changing_focus_, true);
// Update the reason for the focus change (since this is checked by
// some listeners), then notify all listeners.
« no previous file with comments | « ui/views/controls/combobox/combobox_unittest.cc ('k') | ui/views/mus/native_widget_mus.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698