Index: ui/views/view.h |
diff --git a/ui/views/view.h b/ui/views/view.h |
index 858fde3ac699d3e5ebe457efff1245bdfc05fda9..b60f53625f63bc07a4d01d75b912495fd3230e9b 100644 |
--- a/ui/views/view.h |
+++ b/ui/views/view.h |
@@ -271,7 +271,9 @@ class VIEWS_EXPORT View : public ui::LayerDelegate, |
// as with Labels). |
virtual int GetHeightForWidth(int w) const; |
- // Set whether this view is visible. Painting is scheduled as needed. |
+ // Sets whether this view is visible. Painting is scheduled as needed. Also, |
+ // clears focus if the focused view or one of its ancestors is set to be |
+ // hidden. |
virtual void SetVisible(bool visible); |
// Return whether a view is visible |
@@ -282,7 +284,7 @@ class VIEWS_EXPORT View : public ui::LayerDelegate, |
// Set whether this view is enabled. A disabled view does not receive keyboard |
// or mouse inputs. If |enabled| differs from the current value, SchedulePaint |
- // is invoked. |
+ // is invoked. Also, clears focus if the focused view is disabled. |
void SetEnabled(bool enabled); |
// Returns whether the view is enabled. |
@@ -768,7 +770,8 @@ class VIEWS_EXPORT View : public ui::LayerDelegate, |
// IMPORTANT NOTE: loops in the focus hierarchy are not supported. |
void SetNextFocusableView(View* view); |
- // Sets whether this view is capable of taking focus. |
+ // Sets whether this view is capable of taking focus. It will clear focus if |
+ // the focused view is set to be non-focusable. |
// Note that this is false by default so that a view used as a container does |
// not get the focus. |
void SetFocusable(bool focusable); |
@@ -781,7 +784,8 @@ class VIEWS_EXPORT View : public ui::LayerDelegate, |
bool IsAccessibilityFocusable() const; |
// Set whether this view can be made focusable if the user requires |
- // full keyboard access, even though it's not normally focusable. |
+ // full keyboard access, even though it's not normally focusable. It will |
+ // clear focus if the focused view is set to be non-focusable. |
// Note that this is false by default. |
void SetAccessibilityFocusable(bool accessibility_focusable); |
@@ -1412,6 +1416,10 @@ class VIEWS_EXPORT View : public ui::LayerDelegate, |
// to the view at the specified index. |
void InitFocusSiblings(View* view, int index); |
+ // Helper function to revise the focused view, in case it has become |
+ // unfocusable. |
+ void ReviseFocusedView(); |
+ |
// System events ------------------------------------------------------------- |
// Used to propagate theme changed notifications from the root view to all |