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

Unified Diff: ui/views/view.cc

Issue 108063004: Give up focus if the focused view becomes unfocusable (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased + Some updates Created 6 years, 4 months 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.cc
diff --git a/ui/views/view.cc b/ui/views/view.cc
index 349b0ddbcaa5d9b8ae97176ad97076c36e14eb01..8316afb05f2eaf52b0dc74e2a47edb717b9417be 100644
--- a/ui/views/view.cc
+++ b/ui/views/view.cc
@@ -406,6 +406,7 @@ void View::SetVisible(bool visible) {
SchedulePaint();
visible_ = visible;
+ ReviseFocusedView();
// Notify the parent.
if (parent_)
@@ -428,6 +429,7 @@ bool View::IsDrawn() const {
void View::SetEnabled(bool enabled) {
if (enabled != enabled_) {
enabled_ = enabled;
+ ReviseFocusedView();
OnEnabledChanged();
}
}
@@ -1144,6 +1146,7 @@ void View::SetFocusable(bool focusable) {
return;
focusable_ = focusable;
+ ReviseFocusedView();
}
bool View::IsFocusable() const {
@@ -1159,6 +1162,7 @@ void View::SetAccessibilityFocusable(bool accessibility_focusable) {
return;
accessibility_focusable_ = accessibility_focusable;
+ ReviseFocusedView();
}
FocusManager* View::GetFocusManager() {
@@ -2371,6 +2375,12 @@ void View::InitFocusSiblings(View* v, int index) {
}
}
+void View::ReviseFocusedView() {
+ FocusManager* focus_manager = GetFocusManager();
sky 2014/08/07 21:40:34 I would rather avoid the constant tree walking if
mohsen 2014/08/08 01:32:07 Yep, done.
+ if (focus_manager)
+ focus_manager->ReviseFocusedView();
+}
+
// System events ---------------------------------------------------------------
void View::PropagateThemeChanged() {

Powered by Google App Engine
This is Rietveld 408576698