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

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

Issue 8439015: Make infobar controls focusable by default. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 2 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 | « views/controls/button/text_button.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « views/controls/button/text_button.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698