diff options
author | sky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-07-21 15:41:09 +0000 |
---|---|---|
committer | sky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-07-21 15:41:09 +0000 |
commit | 59461d2076ab5bbe6274d07d7e7855643f64862c (patch) | |
tree | d2da836b8b24b851d399433720312ea0d6548f9b /views/view.h | |
parent | 8ea4b5e6df7865892a40fbe304e44d67a34b8e46 (diff) | |
download | chromium_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.h')
-rw-r--r-- | views/view.h | 33 |
1 files changed, 20 insertions, 13 deletions
diff --git a/views/view.h b/views/view.h index d06d2fa6..5a72863 100644 --- a/views/view.h +++ b/views/view.h @@ -506,17 +506,18 @@ class View : public AcceleratorTarget { // IMPORTANT NOTE: loops in the focus hierarchy are not supported. void SetNextFocusableView(View* view); - // Return whether this view can accept the focus. - virtual bool IsFocusable() const; - // Sets whether this view can accept the focus. // Note that this is false by default so that a view used as a container does // not get the focus. virtual void SetFocusable(bool focusable); - // Return whether this view is focusable when the user requires - // full keyboard access, even though it may not be normally focusable. - virtual bool IsAccessibilityFocusable() const; + // Returns true if the view is focusable (IsFocusable) and visible in the root + // view. See also IsFocusable. + bool IsFocusableInRootView() const; + + // Return whether this view is focusable when the user requires full keyboard + // access, even though it may not be normally focusable. + bool IsAccessibilityFocusableInRootView() const; // Set whether this view can be made focusable if the user requires // full keyboard access, even though it's not normally focusable. @@ -966,13 +967,11 @@ class View : public AcceleratorTarget { ThemeProvider* GetThemeProvider() const; protected: - // The id of this View. Used to find this View. - int id_; - - // The group of this view. Some view subclasses use this id to find other - // views of the same group. For example radio button uses this information - // to find other radio buttons. - int group_; + // Returns whether this view can accept focus. + // A view can accept focus if it's enabled, focusable and visible. + // This method is intended for views to use when calculating preferred size. + // The FocusManager and other places use IsFocusableInRootView. + virtual bool IsFocusable() const; // Called when the UI theme has changed, overriding allows individual Views to // do special cleanup and processing (such as dropping resource caches). @@ -1096,6 +1095,14 @@ class View : public AcceleratorTarget { static int GetHorizontalDragThreshold(); static int GetVerticalDragThreshold(); + // The id of this View. Used to find this View. + int id_; + + // The group of this view. Some view subclasses use this id to find other + // views of the same group. For example radio button uses this information + // to find other radio buttons. + int group_; + // Whether this view is enabled. bool enabled_; |