Index: ui/views/controls/button/text_button.cc |
diff --git a/ui/views/controls/button/text_button.cc b/ui/views/controls/button/text_button.cc |
index cf057de2f51636a40bdf7d0e8a72674c73c32d30..771efc3baa3da8664a62cd22b7c48448c89172f0 100644 |
--- a/ui/views/controls/button/text_button.cc |
+++ b/ui/views/controls/button/text_button.cc |
@@ -43,14 +43,6 @@ static const int kPreferredPaddingVertical = 5; |
static const int kPreferredNativeThemePaddingHorizontal = 12; |
static const int kPreferredNativeThemePaddingVertical = 5; |
-// By default the focus rect is drawn at the border of the view. |
-// For a button, we inset the focus rect by 3 pixels so that it |
-// doesn't draw on top of the button's border. This roughly matches |
-// how the Windows native focus rect for buttons looks. A subclass |
-// that draws a button with different padding may need to |
-// override OnPaintFocusBorder and do something different. |
-static const int kFocusRectInset = 3; |
- |
// How long the hover fade animation should last. |
static const int kHoverAnimationDurationMs = 170; |
@@ -470,6 +462,7 @@ void TextButtonBase::GetExtraParams( |
params->button.indeterminate = false; |
params->button.is_default = false; |
params->button.has_border = false; |
+ params->button.is_focused = HasFocus(); |
params->button.classic_state = 0; |
params->button.background_color = |
ui::NativeTheme::instance()->GetSystemColor( |
@@ -756,11 +749,6 @@ std::string TextButton::GetClassName() const { |
} |
void TextButton::OnPaintFocusBorder(gfx::Canvas* canvas) { |
- if (HasFocus() && (focusable() || IsAccessibilityFocusable())) { |
tony
2012/06/04 19:20:45
Is it OK to lose the focusable() || IsAccessibilit
xiyuan
2012/06/04 19:46:54
I have the same question.
Should we do "params->bu
flackr
2012/06/05 14:13:18
You're absolutely right, I originally had this and
|
- gfx::Rect rect(GetLocalBounds()); |
- rect.Inset(kFocusRectInset, kFocusRectInset); |
- canvas->DrawFocusRect(rect); |
- } |
} |
ui::NativeTheme::Part TextButton::GetThemePart() const { |
@@ -843,15 +831,6 @@ std::string NativeTextButton::GetClassName() const { |
} |
void NativeTextButton::OnPaintFocusBorder(gfx::Canvas* canvas) { |
-#if defined(OS_WIN) |
xiyuan
2012/06/04 19:46:54
Would this break Windows?
flackr
2012/06/05 14:13:18
I tried in Windows (7) and it draws a similar look
|
- if (HasFocus() && (focusable() || IsAccessibilityFocusable())) { |
- gfx::Rect rect(GetLocalBounds()); |
- rect.Inset(kFocusRectInset, kFocusRectInset); |
- canvas->DrawFocusRect(rect); |
- } |
-#else |
- TextButton::OnPaintFocusBorder(canvas); |
-#endif |
} |
void NativeTextButton::GetExtraParams( |