Index: ui/views/controls/link.cc |
diff --git a/ui/views/controls/link.cc b/ui/views/controls/link.cc |
index 30e50a997607094468ddf8f0d3dc49bb9ea10602..953014feaa3187d1c8e87f6eb97c4d10f25db288 100644 |
--- a/ui/views/controls/link.cc |
+++ b/ui/views/controls/link.cc |
@@ -23,7 +23,9 @@ |
namespace views { |
+// static |
const char Link::kViewClassName[] = "Link"; |
+const int Link::kFocusBorderPadding = 1; |
Link::Link() : Link(base::string16()) {} |
@@ -159,9 +161,7 @@ void Link::SetFontList(const gfx::FontList& font_list) { |
void Link::SetText(const base::string16& text) { |
Label::SetText(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. |
+ // Disable focusability for empty links. |
SetFocusBehavior(text.empty() ? FocusBehavior::NEVER : FocusBehavior::ALWAYS); |
} |
@@ -177,6 +177,16 @@ void Link::SetEnabledColor(SkColor color) { |
Label::SetEnabledColor(GetEnabledColor()); |
} |
+gfx::Insets Link::GetInsets() const { |
+ gfx::Insets insets = Label::GetInsets(); |
+ // Non-empty links will have a focus border around them. |
+ if (!text().empty()) { |
karandeepb
2016/04/27 08:04:40
There are 1-2 instances where the focusability of
|
+ insets += gfx::Insets(kFocusBorderPadding, kFocusBorderPadding, |
+ kFocusBorderPadding, kFocusBorderPadding); |
+ } |
+ return insets; |
+} |
+ |
void Link::SetPressedColor(SkColor color) { |
requested_pressed_color_set_ = true; |
requested_pressed_color_ = color; |