Index: views/controls/button/text_button.cc |
diff --git a/views/controls/button/text_button.cc b/views/controls/button/text_button.cc |
index e64d3dca5b602996d710cdfb4166a1fda6d8fa84..f758910b9dce71efb04f5aa16d48c9d312c547be 100644 |
--- a/views/controls/button/text_button.cc |
+++ b/views/controls/button/text_button.cc |
@@ -190,6 +190,8 @@ TextButton::TextButton(ButtonListener* listener, const std::wstring& text) |
color_disabled_(kDisabledColor), |
color_highlight_(kHighlightColor), |
color_hover_(kHoverColor), |
+ text_halo_color_(0), |
+ has_text_halo_(false), |
has_hover_icon_(false), |
has_pushed_icon_(false), |
max_width_(0), |
@@ -248,6 +250,11 @@ void TextButton::SetHoverColor(SkColor color) { |
color_hover_ = color; |
} |
+void TextButton::SetTextHaloColor(SkColor color) { |
+ text_halo_color_ = color; |
+ has_text_halo_ = true; |
+} |
+ |
void TextButton::ClearMaxTextSize() { |
max_text_size_ = text_size_; |
} |
@@ -360,6 +367,11 @@ void TextButton::Paint(gfx::Canvas* canvas, bool for_drag) { |
text_bounds.height(), |
draw_string_flags); |
#endif |
+ } else if (has_text_halo_) { |
+ canvas->AsCanvasSkia()->DrawStringWithHalo( |
+ text_, font_, text_color, text_halo_color_, text_bounds.x(), |
+ text_bounds.y(), text_bounds.width(), text_bounds.height(), |
+ draw_string_flags); |
} else { |
canvas->DrawStringInt(text_, |
font_, |
@@ -391,6 +403,13 @@ void TextButton::UpdateTextSize() { |
gfx::CanvasSkia::SizeStringInt( |
text_, font_, &width, &height, |
gfx::Canvas::NO_ELLIPSIS | PrefixTypeToCanvasType(prefix_type_)); |
+ |
+ // Add 2 extra pixels to width and height when text halo is used. |
+ if (has_text_halo_) { |
+ width += 2; |
+ height += 2; |
+ } |
+ |
text_size_.SetSize(width, font_.GetHeight()); |
max_text_size_.SetSize(std::max(max_text_size_.width(), text_size_.width()), |
std::max(max_text_size_.height(), |