diff options
author | tony@chromium.org <tony@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-11-22 18:15:25 +0000 |
---|---|---|
committer | tony@chromium.org <tony@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-11-22 18:15:25 +0000 |
commit | 36f1e277205d0bc6621866b1242ea7ee00166d4a (patch) | |
tree | 9d9fa8d67e2c2a4d5be66a99a04aa45d6fa9b58a /views | |
parent | 27a64faaaa8a1d23826794a5763d34cac5fbf9fe (diff) | |
download | chromium_src-36f1e277205d0bc6621866b1242ea7ee00166d4a.zip chromium_src-36f1e277205d0bc6621866b1242ea7ee00166d4a.tar.gz chromium_src-36f1e277205d0bc6621866b1242ea7ee00166d4a.tar.bz2 |
Convert SizeStringInt from taking a wstring to a string16.
BUG=23581
Review URL: http://codereview.chromium.org/5158006
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@66973 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'views')
-rw-r--r-- | views/controls/button/text_button.cc | 3 | ||||
-rw-r--r-- | views/controls/label.cc | 6 | ||||
-rw-r--r-- | views/view_text_utils.cc | 5 |
3 files changed, 9 insertions, 5 deletions
diff --git a/views/controls/button/text_button.cc b/views/controls/button/text_button.cc index 578be80..1df698a 100644 --- a/views/controls/button/text_button.cc +++ b/views/controls/button/text_button.cc @@ -9,6 +9,7 @@ #include "app/throb_animation.h" #include "app/resource_bundle.h" #include "base/logging.h" +#include "base/utf_string_conversions.h" #include "gfx/canvas_skia.h" #include "views/controls/button/button.h" #include "views/event.h" @@ -402,7 +403,7 @@ void TextButton::UpdateColor() { void TextButton::UpdateTextSize() { int width = 0, height = 0; gfx::CanvasSkia::SizeStringInt( - text_, font_, &width, &height, + WideToUTF16Hack(text_), font_, &width, &height, gfx::Canvas::NO_ELLIPSIS | PrefixTypeToCanvasType(prefix_type_)); // Add 2 extra pixels to width and height when text halo is used. diff --git a/views/controls/label.cc b/views/controls/label.cc index 32df88a..b228c78b 100644 --- a/views/controls/label.cc +++ b/views/controls/label.cc @@ -68,7 +68,8 @@ int Label::GetHeightForWidth(int w) { w = std::max(0, w - GetInsets().width()); int h = font_.GetHeight(); - gfx::CanvasSkia::SizeStringInt(text_, font_, &w, &h, ComputeMultiLineFlags()); + gfx::CanvasSkia::SizeStringInt(WideToUTF16Hack(text_), font_, &w, &h, + ComputeMultiLineFlags()); return h + GetInsets().height(); } @@ -294,7 +295,8 @@ gfx::Size Label::GetTextSize() const { int flags = ComputeMultiLineFlags(); if (!is_multi_line_) flags |= gfx::Canvas::NO_ELLIPSIS; - gfx::CanvasSkia::SizeStringInt(text_, font_, &w, &h, flags); + gfx::CanvasSkia::SizeStringInt(WideToUTF16Hack(text_), font_, &w, &h, + flags); text_size_.SetSize(w, h); text_size_valid_ = true; } diff --git a/views/view_text_utils.cc b/views/view_text_utils.cc index 9b4442d..73bef45 100644 --- a/views/view_text_utils.cc +++ b/views/view_text_utils.cc @@ -117,7 +117,7 @@ void DrawTextStartingFrom(gfx::Canvas* canvas, word = text; // Draw the whole text at once. int w = font.GetStringWidth(word), h = font.GetHeight(); - gfx::CanvasSkia::SizeStringInt(word, font, &w, &h, flags); + gfx::CanvasSkia::SizeStringInt(WideToUTF16Hack(word), font, &w, &h, flags); // If we exceed the boundaries, we need to wrap. WrapIfWordDoesntFit(w, font.GetHeight(), position, bounds); @@ -131,7 +131,8 @@ void DrawTextStartingFrom(gfx::Canvas* canvas, // left of the LTR string. if (ltr_within_rtl && word[word.size() - 1] == L' ') { int space_w = font.GetStringWidth(L" "), space_h = font.GetHeight(); - gfx::CanvasSkia::SizeStringInt(L" ", font, &space_w, &space_h, flags); + gfx::CanvasSkia::SizeStringInt(UTF8ToUTF16(" "), font, &space_w, + &space_h, flags); x += space_w; } } |