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

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: 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
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..0d80718591a61d8c4f682b9c27e51d5308c0db8d 100644
--- a/ui/base/native_theme/native_theme_base.cc
+++ b/ui/base/native_theme/native_theme_base.cc
@@ -531,10 +531,13 @@ void NativeThemeBase::PaintButton(SkCanvas* canvas,
paint.setShader(NULL);
if (button.has_border) {
- const int kBorderAlpha = state == kHovered ? 0x80 : 0x55;
+ const int kBorderAlpha = button.is_focused ? 0xff :
+ state == kHovered ? 0x80 : 0x55;
tony 2012/06/04 19:20:45 Nit: Nested ternary operators are hard to read. C
flackr 2012/06/05 14:13:18 Done.
+ if (button.is_focused)
+ paint.setColor(GetSystemColor(kColorId_FocusedBorderColor));
paint.setStyle(SkPaint::kStroke_Style);
paint.setStrokeWidth(SkIntToScalar(1));
- paint.setARGB(kBorderAlpha, 0, 0, 0);
+ paint.setAlpha(kBorderAlpha);
skrect.inset(SkFloatToScalar(.5f), SkFloatToScalar(.5f));
canvas->drawRoundRect(skrect, SkIntToScalar(1), SkIntToScalar(1), paint);
}

Powered by Google App Engine
This is Rietveld 408576698