summaryrefslogtreecommitdiffstats
path: root/views/view.cc
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/view.cc
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/view.cc')
-rw-r--r--views/view.cc20
1 files changed, 11 insertions, 9 deletions
diff --git a/views/view.cc b/views/view.cc
index 4ae7bef..2c92338 100644
--- a/views/view.cc
+++ b/views/view.cc
@@ -283,15 +283,15 @@ void View::SetEnabled(bool state) {
}
}
-bool View::IsFocusable() const {
- return focusable_ && IsEnabled() && IsVisibleInRootView();
-}
-
void View::SetFocusable(bool focusable) {
focusable_ = focusable;
}
-bool View::IsAccessibilityFocusable() const {
+bool View::IsFocusableInRootView() const {
+ return IsFocusable() && IsVisibleInRootView();
+}
+
+bool View::IsAccessibilityFocusableInRootView() const {
return (focusable_ || accessibility_focusable_) && IsEnabled() &&
IsVisibleInRootView();
}
@@ -359,10 +359,8 @@ void View::PaintBorder(gfx::Canvas* canvas) {
}
void View::PaintFocusBorder(gfx::Canvas* canvas) {
- if (HasFocus() && (IsFocusable() ||
- IsAccessibilityFocusable())) {
+ if (HasFocus() && (IsFocusable() || IsAccessibilityFocusableInRootView()))
canvas->DrawFocusRect(0, 0, width(), height());
- }
}
void View::PaintChildren(gfx::Canvas* canvas) {
@@ -665,6 +663,10 @@ void View::PropagateAddNotifications(View* parent, View* child) {
ViewHierarchyChangedImpl(true, true, parent, child);
}
+bool View::IsFocusable() const {
+ return focusable_ && IsEnabled() && IsVisible();
+}
+
void View::ThemeChanged() {
for (int i = GetChildViewCount() - 1; i >= 0; --i)
GetChildViewAt(i)->ThemeChanged();
@@ -1319,7 +1321,7 @@ bool View::IsVisibleInRootView() const {
void View::RequestFocus() {
RootView* rv = GetRootView();
- if (rv && IsFocusable())
+ if (rv && IsFocusableInRootView())
rv->FocusView(this);
}