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

Unified Diff: ui/views/view.h

Issue 108063004: Give up focus if the focused view becomes unfocusable (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased Created 7 years 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
Index: ui/views/view.h
diff --git a/ui/views/view.h b/ui/views/view.h
index 9bdf84053dd1ea679a12921ec761d3631ab6a3c2..432c589b584ee738edc5399bf47de7d45a1980cc 100644
--- a/ui/views/view.h
+++ b/ui/views/view.h
@@ -277,7 +277,9 @@ class VIEWS_EXPORT View : public ui::LayerDelegate,
// as with Labels).
virtual int GetHeightForWidth(int w);
- // 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
@@ -288,7 +290,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.
@@ -765,10 +767,11 @@ 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 set_focusable(bool focusable) { focusable_ = focusable; }
+ void SetFocusable(bool focusable);
// Returns true if this view is capable of taking focus.
bool focusable() const { return focusable_ && enabled_ && visible_; }
@@ -781,11 +784,10 @@ 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 set_accessibility_focusable(bool accessibility_focusable) {
- accessibility_focusable_ = accessibility_focusable;
- }
+ void SetAccessibilityFocusable(bool accessibility_focusable);
// Convenience method to retrieve the FocusManager associated with the
// Widget that contains this view. This can return NULL if this view is not
« no previous file with comments | « ui/views/touchui/touch_editing_menu.cc ('k') | ui/views/view.cc » ('j') | ui/views/view.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698