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

Unified Diff: ui/views/controls/link.cc

Issue 1898633004: Views: Add new SetFocusBehavior method. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased. Created 4 years, 8 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/controls/link.cc
diff --git a/ui/views/controls/link.cc b/ui/views/controls/link.cc
index ec955b385979911957b4c951a59fe53d2357399d..1b9179b960d38d21ac763f711d6c0dbe5ef28c78 100644
--- a/ui/views/controls/link.cc
+++ b/ui/views/controls/link.cc
@@ -162,7 +162,7 @@ void Link::SetText(const base::string16& text) {
// Disable focusability for empty links. Otherwise Label::GetInsets() will
// give them an unconditional 1-px. inset on every side to allow for a focus
// border, when in this case we probably wanted zero width.
- SetFocusable(!text.empty());
+ SetFocusBehavior(text.empty() ? FocusBehavior::NEVER : FocusBehavior::ALWAYS);
}
void Link::OnNativeThemeChanged(const ui::NativeTheme* theme) {
@@ -200,7 +200,8 @@ void Link::Init() {
// SetText() override will not be reached (because the constructed class is
// only a Label at the moment, not yet a Link). So so the set_focusable()
tapted 2016/04/20 04:16:28 `So so..` -> So set the focus behavior here as wel
karandeepb 2016/04/21 03:16:33 Done.
// call explicitly here.
- SetFocusable(!text().empty());
+ SetFocusBehavior(text().empty() ? FocusBehavior::NEVER
+ : FocusBehavior::ALWAYS);
}
void Link::SetPressed(bool pressed) {

Powered by Google App Engine
This is Rietveld 408576698