Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(99)

Unified Diff: views/view_text_utils.cc

Issue 6134010: Revert 71167 - Remove wstring from gfx.... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « views/drag_utils.cc ('k') | views/window/custom_frame_view.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: views/view_text_utils.cc
===================================================================
--- views/view_text_utils.cc (revision 71168)
+++ views/view_text_utils.cc (working copy)
@@ -110,14 +110,14 @@
// iterate to the next line breaking opportunity.
while (iter.Advance()) {
// Get the word and figure out the dimensions.
- string16 word;
+ std::wstring word;
if (!ltr_within_rtl)
- word = iter.GetString(); // Get the next word.
+ word = UTF16ToWide(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();
- gfx::CanvasSkia::SizeStringInt(word, font, &w, &h, flags);
+ int w = font.GetStringWidth(WideToUTF16Hack(word)), h = font.GetHeight();
+ gfx::CanvasSkia::SizeStringInt(WideToUTF16Hack(word), font, &w, &h, flags);
// If we exceed the boundaries, we need to wrap.
WrapIfWordDoesntFit(w, font.GetHeight(), position, bounds);
@@ -129,7 +129,7 @@
// 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] == ' ') {
+ if (ltr_within_rtl && word[word.size() - 1] == L' ') {
int space_w = font.GetStringWidth(ASCIIToUTF16(" "));
int space_h = font.GetHeight();
gfx::CanvasSkia::SizeStringInt(ASCIIToUTF16(" "), font, &space_w,
@@ -143,7 +143,7 @@
canvas->DrawStringInt(word, font, text_color, x, y, w, font.GetHeight(),
flags);
- if (word.size() > 0 && word[word.size() - 1] == '\x0a') {
+ if (word.size() > 0 && word[word.size() - 1] == L'\x0a') {
// When we come across '\n', we move to the beginning of the next line.
position->set_width(0);
position->Enlarge(0, font.GetHeight());
« no previous file with comments | « views/drag_utils.cc ('k') | views/window/custom_frame_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698