Index: ui/views/view_text_utils.cc |
=================================================================== |
--- ui/views/view_text_utils.cc (revision 119451) |
+++ ui/views/view_text_utils.cc (working copy) |
@@ -91,15 +91,15 @@ |
bool ltr_within_rtl) { |
// Iterate through line breaking opportunities (which in English would be |
// spaces and such). This tells us where to wrap. |
- string16 text16(text); |
- base::i18n::BreakIterator iter(text16, |
+ base::i18n::BreakIterator iter(text, |
base::i18n::BreakIterator::BREAK_SPACE); |
if (!iter.Init()) |
return; |
int flags = (text_direction_is_rtl ? gfx::Canvas::TEXT_ALIGN_RIGHT : |
gfx::Canvas::TEXT_ALIGN_LEFT); |
- flags |= gfx::Canvas::MULTI_LINE | gfx::Canvas::HIDE_PREFIX; |
+ flags |= gfx::Canvas::MULTI_LINE | gfx::Canvas::HIDE_PREFIX | |
+ gfx::Canvas::NO_ELLIPSIS; |
// Iterate over each word in the text, or put in a more locale-neutral way: |
// iterate to the next line breaking opportunity. |
@@ -109,9 +109,9 @@ |
if (!ltr_within_rtl) |
word = iter.GetString(); // Get the next word. |
else |
- word = text16; // Draw the whole text at once. |
+ word = text; // Draw the whole text at once. |
- int w = font.GetStringWidth(word), h = font.GetHeight(); |
+ int w = 0, h = 0; |
gfx::CanvasSkia::SizeStringInt(word, font, &w, &h, flags); |
// If we exceed the boundaries, we need to wrap. |
@@ -123,13 +123,8 @@ |
// When drawing LTR strings inside RTL text we need to make sure we |
// draw the trailing space (if one exists after the LTR text) to the |
// left of the LTR string. |
- if (ltr_within_rtl && word[word.size() - 1] == ' ') { |
- int space_w = font.GetStringWidth(ASCIIToUTF16(" ")); |
- int space_h = font.GetHeight(); |
- gfx::CanvasSkia::SizeStringInt(ASCIIToUTF16(" "), font, &space_w, |
- &space_h, flags); |
- x += space_w; |
- } |
+ if (ltr_within_rtl && word[word.size() - 1] == ' ') |
+ x += gfx::CanvasSkia::GetStringWidth(ASCIIToUTF16(" "), font); |
} |
int y = position->height() + bounds.y(); |