Commit 4457fe7e authored by ckocagil@chromium.org's avatar ckocagil@chromium.org

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
parent 11b96205
......@@ -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());
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment