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

Unified Diff: ui/base/native_theme/native_theme_base.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/base/native_theme/native_theme.h ('k') | ui/views/controls/button/text_button.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/base/native_theme/native_theme_base.cc
diff --git a/ui/base/native_theme/native_theme_base.cc b/ui/base/native_theme/native_theme_base.cc
index a44c59e0aec60ba7e3178858863e4e1714a9cf6c..7a446faaaa5159ca1237e874a7f1ce2a7c339891 100644
--- a/ui/base/native_theme/native_theme_base.cc
+++ b/ui/base/native_theme/native_theme_base.cc
@@ -487,9 +487,9 @@ void NativeThemeBase::PaintRadio(SkCanvas* canvas,
}
void NativeThemeBase::PaintButton(SkCanvas* canvas,
- State state,
- const gfx::Rect& rect,
- const ButtonExtraParams& button) const {
+ State state,
+ const gfx::Rect& rect,
+ const ButtonExtraParams& button) const {
SkPaint paint;
const int kRight = rect.right();
const int kBottom = rect.bottom();
@@ -531,10 +531,14 @@ void NativeThemeBase::PaintButton(SkCanvas* canvas,
paint.setShader(NULL);
if (button.has_border) {
- const int kBorderAlpha = state == kHovered ? 0x80 : 0x55;
+ int border_alpha = state == kHovered ? 0x80 : 0x55;
+ if (button.is_focused) {
+ border_alpha = 0xff;
+ paint.setColor(GetSystemColor(kColorId_FocusedBorderColor));
+ }
paint.setStyle(SkPaint::kStroke_Style);
paint.setStrokeWidth(SkIntToScalar(1));
- paint.setARGB(kBorderAlpha, 0, 0, 0);
+ paint.setAlpha(border_alpha);
skrect.inset(SkFloatToScalar(.5f), SkFloatToScalar(.5f));
canvas->drawRoundRect(skrect, SkIntToScalar(1), SkIntToScalar(1), paint);
}
« no previous file with comments | « ui/base/native_theme/native_theme.h ('k') | ui/views/controls/button/text_button.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698