diff options
author | ckocagil@chromium.org <ckocagil@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-05-30 08:07:13 +0000 |
---|---|---|
committer | ckocagil@chromium.org <ckocagil@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-05-30 08:07:13 +0000 |
commit | 4457fe7e1192b6a7c2afc49d1a10a05607dd793b (patch) | |
tree | 1a9a1576dc11cba96a526604890dbebba2a2da0a /ui/views/controls/button | |
parent | 11b96205601f8872f3ff4ede24b06124adfef242 (diff) | |
download | chromium_src-4457fe7e1192b6a7c2afc49d1a10a05607dd793b.zip chromium_src-4457fe7e1192b6a7c2afc49d1a10a05607dd793b.tar.gz chromium_src-4457fe7e1192b6a7c2afc49d1a10a05607dd793b.tar.bz2 |
Allow STATE_NORMAL text buttons to animate
Fixes a regression from http://crrev.com/88149
BUG=234472
Review URL: https://chromiumcodereview.appspot.com/15111002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@203111 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui/views/controls/button')
-rw-r--r-- | ui/views/controls/button/text_button.cc | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/ui/views/controls/button/text_button.cc b/ui/views/controls/button/text_button.cc index a04d374..aba3941 100644 --- a/ui/views/controls/button/text_button.cc +++ b/ui/views/controls/button/text_button.cc @@ -118,18 +118,24 @@ TextButtonDefaultBorder::~TextButtonDefaultBorder() { void TextButtonDefaultBorder::Paint(const View& view, gfx::Canvas* canvas) { const TextButton* button = static_cast<const TextButton*>(&view); int state = button->state(); + bool animating = button->GetAnimation()->is_animating(); Painter* painter = normal_painter_.get(); + // Use the hot painter when we're hovered. Also use the hot painter when we're + // STATE_NORMAL and |animating| so that we show throb animations started from + // CustomButton::StartThrobbing which should start throbbing the button + // regardless of whether it is hovered. if (button->show_multiple_icon_states() && ((state == TextButton::STATE_HOVERED) || - (state == TextButton::STATE_PRESSED))) { - painter = (state == TextButton::STATE_HOVERED) ? - hot_painter_.get() : pushed_painter_.get(); + (state == TextButton::STATE_PRESSED) || + ((state == TextButton::STATE_NORMAL) && animating))) { + painter = (state == TextButton::STATE_PRESSED) ? + pushed_painter_.get() : hot_painter_.get(); } if (painter) { - if (button->GetAnimation()->is_animating()) { + if (animating) { // TODO(pkasting): Really this should crossfade between states so it could - // handle the case of having a non-NULL |normal_set_|. + // handle the case of having a non-NULL |normal_painter_|. canvas->SaveLayerAlpha(static_cast<uint8>( button->GetAnimation()->CurrentValueBetween(0, 255))); painter->Paint(canvas, view.size()); |