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 1a4c4e700cadce959305fb9e01ea9af2caf37e65..93644c3a16757aef6b58ce12119f32fded54de95 100644 |
--- a/ui/views/controls/button/text_button.cc |
+++ b/ui/views/controls/button/text_button.cc |
@@ -730,13 +730,16 @@ void TextButton::PaintButton(gfx::Canvas* canvas, PaintButtonMode mode) { |
gfx::Rect text_bounds = GetTextBounds(); |
int icon_x; |
int spacing = text_.empty() ? 0 : icon_text_spacing_; |
+ gfx::Insets insets = GetInsets(); |
if (icon_placement_ == ICON_ON_LEFT) { |
icon_x = text_bounds.x() - icon.width() - spacing; |
- } else { |
+ } else if (icon_placement_ == ICON_ON_RIGHT) { |
icon_x = text_bounds.right() + spacing; |
+ } else { // ICON_CENTERED |
+ DCHECK(text_.empty()); |
+ icon_x = (width() - insets.width() - icon.width()) / 2 + insets.left(); |
} |
- gfx::Insets insets = GetInsets(); |
int available_height = height() - insets.height(); |
int icon_y = (available_height - icon.height()) / 2 + insets.top(); |
@@ -785,7 +788,7 @@ gfx::Rect TextButton::GetTextBounds() const { |
// Make sure the icon is always fully visible. |
if (icon_placement_ == ICON_ON_LEFT) { |
bounds.Inset(extra_width, 0, 0, 0); |
- } else { |
+ } else if (icon_placement_ == ICON_ON_RIGHT) { |
bounds.Inset(0, 0, extra_width, 0); |
} |
} |