| Index: ui/views/view.cc
|
| diff --git a/ui/views/view.cc b/ui/views/view.cc
|
| index 349b0ddbcaa5d9b8ae97176ad97076c36e14eb01..d35c526e1b8e5666a075b3466203511802d579aa 100644
|
| --- a/ui/views/view.cc
|
| +++ b/ui/views/view.cc
|
| @@ -406,6 +406,7 @@ void View::SetVisible(bool visible) {
|
| SchedulePaint();
|
|
|
| visible_ = visible;
|
| + AdvanceFocusIfNecessary();
|
|
|
| // Notify the parent.
|
| if (parent_)
|
| @@ -428,6 +429,7 @@ bool View::IsDrawn() const {
|
| void View::SetEnabled(bool enabled) {
|
| if (enabled != enabled_) {
|
| enabled_ = enabled;
|
| + AdvanceFocusIfNecessary();
|
| OnEnabledChanged();
|
| }
|
| }
|
| @@ -1144,6 +1146,7 @@ void View::SetFocusable(bool focusable) {
|
| return;
|
|
|
| focusable_ = focusable;
|
| + AdvanceFocusIfNecessary();
|
| }
|
|
|
| bool View::IsFocusable() const {
|
| @@ -1159,6 +1162,7 @@ void View::SetAccessibilityFocusable(bool accessibility_focusable) {
|
| return;
|
|
|
| accessibility_focusable_ = accessibility_focusable;
|
| + AdvanceFocusIfNecessary();
|
| }
|
|
|
| FocusManager* View::GetFocusManager() {
|
| @@ -2371,6 +2375,18 @@ void View::InitFocusSiblings(View* v, int index) {
|
| }
|
| }
|
|
|
| +void View::AdvanceFocusIfNecessary() {
|
| + // Focus should only be advanced if this is the focused view and has become
|
| + // unfocusable. If it is still focusable, we can return early avoiding furthur
|
| + // unnecessary checks.
|
| + if (IsAccessibilityFocusable())
|
| + return;
|
| +
|
| + FocusManager* focus_manager = GetFocusManager();
|
| + if (focus_manager)
|
| + focus_manager->AdvanceFocusIfNecessary();
|
| +}
|
| +
|
| // System events ---------------------------------------------------------------
|
|
|
| void View::PropagateThemeChanged() {
|
|
|