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

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

Issue 23475012: Fixes focus traversal bug (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: OVERRIDE Created 7 years, 3 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/focus/focus_manager.h ('k') | ui/views/focus/focus_manager_unittest.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 a2b88b0ae3194f3b76708753b9e78b07223b9ed5..6e2a64409058684a6f10adaa744196b652556ef4 100644
--- a/ui/views/focus/focus_manager.cc
+++ b/ui/views/focus/focus_manager.cc
@@ -139,7 +139,7 @@ bool FocusManager::ContainsView(View* view) {
}
void FocusManager::AdvanceFocus(bool reverse) {
- View* v = GetNextFocusableView(focused_view_, reverse, false);
+ View* v = GetNextFocusableView(focused_view_, NULL, reverse, false);
// Note: Do not skip this next block when v == focused_view_. If the user
// tabs past the last focusable element in a webpage, we'll get here, and if
// the TabContentsContainerView is the only focusable view (possible in
@@ -219,6 +219,7 @@ bool FocusManager::RotatePaneFocus(Direction direction,
}
View* FocusManager::GetNextFocusableView(View* original_starting_view,
+ Widget* starting_widget,
bool reverse,
bool dont_loop) {
FocusTraversable* focus_traversable = NULL;
@@ -262,7 +263,8 @@ View* FocusManager::GetNextFocusableView(View* original_starting_view,
}
}
} else {
- focus_traversable = widget_->GetFocusTraversable();
+ Widget* widget = starting_widget ? starting_widget : widget_;
+ focus_traversable = widget->GetFocusTraversable();
}
// Traverse the FocusTraversable tree down to find the focusable view.
@@ -303,9 +305,12 @@ View* FocusManager::GetNextFocusableView(View* original_starting_view,
// infinitely looping in empty windows.
if (!dont_loop && original_starting_view) {
// Easy, just clear the selection and press tab again.
- // By calling with NULL as the starting view, we'll start from the
- // top_root_view.
- return GetNextFocusableView(NULL, reverse, true);
+ // By calling with NULL as the starting view, we'll start from either
+ // the starting views widget or |widget_|.
+ Widget* widget = original_starting_view->GetWidget();
+ if (widget->widget_delegate()->ShouldAdvanceFocusToTopLevelWidget())
+ widget = widget_;
+ return GetNextFocusableView(NULL, widget, reverse, true);
}
}
return NULL;
« no previous file with comments | « ui/views/focus/focus_manager.h ('k') | ui/views/focus/focus_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698