diff options
author | rogerta@chromium.org <rogerta@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-07-25 21:08:52 +0000 |
---|---|---|
committer | rogerta@chromium.org <rogerta@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-07-25 21:08:52 +0000 |
commit | 4b43a78c2b434fc75ec3a860a180a5d50e12be3e (patch) | |
tree | b18cba42c17bdab1563668e01cd8aaa1eb96021b /views | |
parent | 75c34249720289b9b094f1205da61186efac0716 (diff) | |
download | chromium_src-4b43a78c2b434fc75ec3a860a180a5d50e12be3e.zip chromium_src-4b43a78c2b434fc75ec3a860a180a5d50e12be3e.tar.gz chromium_src-4b43a78c2b434fc75ec3a860a180a5d50e12be3e.tar.bz2 |
Make sure the focus border is inset wrt the entire button so
that the native text button appears more like a windows button.
BUG=90229
TEST=Open a dialog or popup with a button control. Use the tab key to place
the focus on the button. Make sure the focus border, which is black dotted
line, appears inset into the button as shown in the bug desription.
Review URL: http://codereview.chromium.org/7484045
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@93941 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'views')
-rw-r--r-- | views/controls/button/text_button.cc | 14 | ||||
-rw-r--r-- | views/controls/button/text_button.h | 3 |
2 files changed, 17 insertions, 0 deletions
diff --git a/views/controls/button/text_button.cc b/views/controls/button/text_button.cc index ac718f8..3ebbc90 100644 --- a/views/controls/button/text_button.cc +++ b/views/controls/button/text_button.cc @@ -807,6 +807,20 @@ std::string NativeTextButton::GetClassName() const { return kViewClassName; } +void NativeTextButton::OnPaintFocusBorder(gfx::Canvas* canvas) { +#if defined(OS_WIN) + // On windows, make sure the focus border is inset wrt the entire button so + // that the native text button appears more like a windows button. + if ((IsFocusable() || IsAccessibilityFocusableInRootView()) && HasFocus()) { + gfx::Rect rect(GetLocalBounds()); + rect.Inset(3, 3); + canvas->DrawFocusRect(rect.x(), rect.y(), rect.width(), rect.height()); + } +#else + TextButton::OnPaintFocusBorder(canvas); +#endif +} + void NativeTextButton::GetExtraParams( gfx::NativeTheme::ExtraParams* params) const { TextButton::GetExtraParams(params); diff --git a/views/controls/button/text_button.h b/views/controls/button/text_button.h index 865d5e8..68d55b8 100644 --- a/views/controls/button/text_button.h +++ b/views/controls/button/text_button.h @@ -423,6 +423,9 @@ class NativeTextButton : public TextButton { private: void Init(); + // Overridden from View: + virtual void OnPaintFocusBorder(gfx::Canvas* canvas) OVERRIDE; + // Overridden from TextButton: virtual void GetExtraParams( gfx::NativeTheme::ExtraParams* params) const OVERRIDE; |