summaryrefslogtreecommitdiffstats
path: root/views/focus
diff options
context:
space:
mode:
authorsky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-07-21 15:41:09 +0000
committersky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-07-21 15:41:09 +0000
commit59461d2076ab5bbe6274d07d7e7855643f64862c (patch)
treed2da836b8b24b851d399433720312ea0d6548f9b /views/focus
parent8ea4b5e6df7865892a40fbe304e44d67a34b8e46 (diff)
downloadchromium_src-59461d2076ab5bbe6274d07d7e7855643f64862c.zip
chromium_src-59461d2076ab5bbe6274d07d7e7855643f64862c.tar.gz
chromium_src-59461d2076ab5bbe6274d07d7e7855643f64862c.tar.bz2
Fixes regression in links ending up too small. The problem is that we
changed IsFocusable to check IsVisibleInRootView. This meant that any views (like label) whose preferred size takes into account focusable and cached the preferred size before they were visible in the root view would end up with the wrong size because they didn't recalculate when IsVisibleInRootView changed. I've separated out the two states so that IsFocusable no longer checks IsVisibleInRootView and is protected. All consumers now call IsFocusableInRootView which checks IsFocusable and IsVisibleInRootView. BUG=49635 TEST=see bug. Review URL: http://codereview.chromium.org/3046008 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@53187 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'views/focus')
-rw-r--r--views/focus/focus_manager.cc6
-rw-r--r--views/focus/focus_search.cc6
-rw-r--r--views/focus/focus_search.h7
3 files changed, 10 insertions, 9 deletions
diff --git a/views/focus/focus_manager.cc b/views/focus/focus_manager.cc
index 733d921..ee70d5b 100644
--- a/views/focus/focus_manager.cc
+++ b/views/focus/focus_manager.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -361,8 +361,8 @@ void FocusManager::RestoreFocusedView() {
View* view = view_storage->RetrieveView(stored_focused_view_storage_id_);
if (view) {
- if (ContainsView(view) &&
- (view->IsFocusable() || view->IsAccessibilityFocusable())) {
+ if (ContainsView(view) && (view->IsFocusableInRootView() ||
+ view->IsAccessibilityFocusableInRootView())) {
SetFocusedViewWithReason(view, kReasonFocusRestore);
}
} else {
diff --git a/views/focus/focus_search.cc b/views/focus/focus_search.cc
index eaeb8ac..f3fac86 100644
--- a/views/focus/focus_search.cc
+++ b/views/focus/focus_search.cc
@@ -102,9 +102,9 @@ bool FocusSearch::IsViewFocusableCandidate(View* v, int skip_group_id) {
bool FocusSearch::IsFocusable(View* v) {
if (accessibility_mode_)
- return v && v->IsAccessibilityFocusable();
- else
- return v && v->IsFocusable();
+ return v && v->IsAccessibilityFocusableInRootView();
+
+ return v && v->IsFocusableInRootView();
}
View* FocusSearch::FindSelectedViewForGroup(View* view) {
diff --git a/views/focus/focus_search.h b/views/focus/focus_search.h
index f24864b..d6479c4 100644
--- a/views/focus/focus_search.h
+++ b/views/focus/focus_search.h
@@ -34,8 +34,8 @@ class FocusSearch {
// view to FindNextFocusableView you will always get a valid view
// out, even if it's the same view.
// - |accessibility_mode| should be true if full keyboard accessibility is
- // needed and you want to check IsAccessibilityFocusable(),
- // rather than IsFocusable().
+ // needed and you want to check IsAccessibilityFocusableInRootView(),
+ // rather than IsFocusableInRootView().
FocusSearch(View* root, bool cycle, bool accessibility_mode);
virtual ~FocusSearch() {}
@@ -74,7 +74,8 @@ class FocusSearch {
bool IsViewFocusableCandidate(View* v, int skip_group_id);
// Convenience method; returns true if a view is not NULL and is focusable
- // (checking IsAccessibilityFocusable() if accessibility_mode_ is true).
+ // (checking IsAccessibilityFocusableInRootView() if accessibility_mode_ is
+ // true).
bool IsFocusable(View* v);
// Returns the view selected for the group of the selected view. If the view