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

Unified Diff: ui/views/controls/button/text_button.cc

Issue 10513009: Indicate focused state on text buttons with blue outline. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add comment. Created 8 years, 6 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
« no previous file with comments | « ui/views/controls/button/text_button.h ('k') | webkit/glue/webthemeengine_impl_android.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 32f1b216eeb8ed325e0c91ee88fda6a872ffe9ef..bb3aa5959194f825dc77db9ec48e23bfce61de9e 100644
--- a/ui/views/controls/button/text_button.cc
+++ b/ui/views/controls/button/text_button.cc
@@ -469,6 +469,7 @@ void TextButtonBase::GetExtraParams(
params->button.checked = false;
params->button.indeterminate = false;
params->button.is_default = false;
+ params->button.is_focused = false;
params->button.has_border = false;
params->button.classic_state = 0;
params->button.background_color =
@@ -850,7 +851,8 @@ void NativeTextButton::OnPaintFocusBorder(gfx::Canvas* canvas) {
canvas->DrawFocusRect(rect);
}
#else
- TextButton::OnPaintFocusBorder(canvas);
+ // Paint nothing, focus will be indicated with a border highlight drawn by
+ // NativeThemeBase::PaintButton.
#endif
}
@@ -858,6 +860,14 @@ void NativeTextButton::GetExtraParams(
ui::NativeTheme::ExtraParams* params) const {
TextButton::GetExtraParams(params);
params->button.has_border = true;
+#if !defined(OS_WIN)
+ // Windows may paint a dotted focus rect in
+ // NativeTextButton::OnPaintFocusBorder. To avoid getting two focus
+ // indications (A dotted rect and a highlighted border) only set is_focused on
+ // non windows platforms.
+ params->button.is_focused = HasFocus() &&
+ (focusable() || IsAccessibilityFocusable());
+#endif
}
} // namespace views
« no previous file with comments | « ui/views/controls/button/text_button.h ('k') | webkit/glue/webthemeengine_impl_android.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698