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

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

Issue 10949005: Fix toolbar keyboard accessibility on Views (alternative impl). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix test on linux_chromeos Created 8 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_search.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/focus/focus_search.cc
diff --git a/ui/views/focus/focus_search.cc b/ui/views/focus/focus_search.cc
index b461ec930062f1c4f79a10561220dc4c46d5d8ba..c54aec7be180ce8ae37467f6cc52f3db4ddd5adb 100644
--- a/ui/views/focus/focus_search.cc
+++ b/ui/views/focus/focus_search.cc
@@ -44,7 +44,7 @@ View* FocusSearch::FindNextFocusableView(View* starting_view,
check_starting_view = true;
} else {
// The starting view should be a direct or indirect child of the root.
- DCHECK(root_->Contains(starting_view));
+ DCHECK(Contains(root_, starting_view));
}
View* v = NULL;
@@ -68,7 +68,7 @@ View* FocusSearch::FindNextFocusableView(View* starting_view,
}
// Don't set the focus to something outside of this view hierarchy.
- if (v && v != root_ && !root_->Contains(v))
+ if (v && v != root_ && !Contains(root_, v))
v = NULL;
// If |cycle_| is true, prefer to keep cycling rather than returning NULL.
@@ -118,7 +118,11 @@ View* FocusSearch::FindSelectedViewForGroup(View* view) {
}
View* FocusSearch::GetParent(View* v) {
- return root_->Contains(v) ? v->parent() : NULL;
+ return Contains(root_, v) ? v->parent() : NULL;
+}
+
+bool FocusSearch::Contains(View* root, const View* v) {
+ return root->Contains(v);
}
// Strategy for finding the next focusable view:
@@ -179,7 +183,7 @@ View* FocusSearch::FindNextFocusableViewImpl(
// Then go up to the parent sibling.
if (can_go_up) {
View* parent = GetParent(starting_view);
- while (parent) {
+ while (parent && parent != root_) {
sibling = parent->GetNextFocusableView();
if (sibling) {
return FindNextFocusableViewImpl(sibling,
« no previous file with comments | « ui/views/focus/focus_search.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698