Index: ui/views/controls/button/text_button.cc |
diff --git a/ui/views/controls/button/text_button.cc b/ui/views/controls/button/text_button.cc |
index fa250ab54b9f80c6b1444d1798163d51d5da0950..5b0caff0039ef63743686cf678d054c0b4381acc 100644 |
--- a/ui/views/controls/button/text_button.cc |
+++ b/ui/views/controls/button/text_button.cc |
@@ -119,19 +119,23 @@ TextButtonDefaultBorder::~TextButtonDefaultBorder() { |
//////////////////////////////////////////////////////////////////////////////// |
void TextButtonDefaultBorder::Paint(const View& view, gfx::Canvas* canvas) { |
const TextButton* button = static_cast<const TextButton*>(&view); |
- int state = button->state(); |
+ const int state = button->state(); |
+ const bool animating = button->GetAnimation()->is_animating(); |
Painter* painter = normal_painter_.get(); |
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))) { |
+ // Also use the hot painter when we're STATE_NORMAL and |animating|. This is |
+ // to allow subclasses to have things like the bookmark throb animation. |
Peter Kasting
2013/05/15 01:18:48
Nit: It would be nice to go even further to explai
ckocagil
2013/05/26 21:45:46
Done(?)
|
+ 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()); |