Index: views/controls/button/text_button.cc |
=================================================================== |
--- views/controls/button/text_button.cc (revision 107928) |
+++ views/controls/button/text_button.cc (working copy) |
@@ -42,6 +42,9 @@ |
static const int kPreferredNativeThemePaddingHorizontal = 12; |
static const int kPreferredNativeThemePaddingVertical = 5; |
+// Number of pixels from the edge of the view to inset the focus rect |
Peter Kasting
2011/11/01 21:51:28
Needs to be a complete sentence (I see some existi
|
+static const int kFocusRectInset = 3; |
+ |
// Default background color for buttons. |
const SkColor kBackgroundColor = SkColorSetRGB(0xde, 0xde, 0xde); |
@@ -744,6 +747,14 @@ |
return kViewClassName; |
} |
+void TextButton::OnPaintFocusBorder(gfx::Canvas* canvas) { |
+ if ((IsFocusable() || IsAccessibilityFocusableInRootView()) && HasFocus()) { |
+ gfx::Rect rect(GetLocalBounds()); |
+ rect.Inset(kFocusRectInset, kFocusRectInset); |
+ canvas->DrawFocusRect(rect); |
+ } |
+} |
+ |
gfx::NativeTheme::Part TextButton::GetThemePart() const { |
return gfx::NativeTheme::kPushButton; |
} |
@@ -829,7 +840,7 @@ |
// that the native text button appears more like a windows button. |
if ((IsFocusable() || IsAccessibilityFocusableInRootView()) && HasFocus()) { |
gfx::Rect rect(GetLocalBounds()); |
- rect.Inset(3, 3); |
+ rect.Inset(kFocusRectInset, kFocusRectInset); |
canvas->DrawFocusRect(rect); |
} |
#else |