summaryrefslogtreecommitdiffstats
path: root/gfx
diff options
context:
space:
mode:
authorjeremy@chromium.org <jeremy@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-11-24 07:27:42 +0000
committerjeremy@chromium.org <jeremy@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-11-24 07:27:42 +0000
commitc32d31eab915dcff1f128bf744ced2ad8fa221ef (patch)
tree69a8fbf3b9360c6401bb4658893cafc4b2f209ed /gfx
parent6ee50a8d443f48e70921a8eed76f26a6e9844228 (diff)
downloadchromium_src-c32d31eab915dcff1f128bf744ced2ad8fa221ef.zip
chromium_src-c32d31eab915dcff1f128bf744ced2ad8fa221ef.tar.gz
chromium_src-c32d31eab915dcff1f128bf744ced2ad8fa221ef.tar.bz2
Cleanup AdjustStringForLocaleDirection() to modify input parameter in place.
As described in the bug, the current behavior is confusing and bug-prone. BUG=47194 TEST=Check that there are no visible regressions in RTL and LTR language UIs on Linux & Windows. Review URL: http://codereview.chromium.org/5154009 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@67237 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'gfx')
-rw-r--r--gfx/canvas_skia_win.cc15
1 files changed, 8 insertions, 7 deletions
diff --git a/gfx/canvas_skia_win.cc b/gfx/canvas_skia_win.cc
index 1a65da0..dd8c96a 100644
--- a/gfx/canvas_skia_win.cc
+++ b/gfx/canvas_skia_win.cc
@@ -19,17 +19,18 @@ void DoDrawText(HDC hdc,
const std::wstring& text,
RECT* text_bounds,
int flags) {
- std::wstring localized_text;
- const wchar_t* string_ptr = text.c_str();
- int string_size = static_cast<int>(text.length());
// Only adjust string directionality if both of the following are true:
// 1. The current locale is RTL.
// 2. The string itself has RTL directionality.
+ const wchar_t* string_ptr = text.c_str();
+ int string_size = static_cast<int>(text.length());
+
+ std::wstring localized_text;
if (flags & DT_RTLREADING) {
- if (base::i18n::AdjustStringForLocaleDirection(text, &localized_text)) {
- string_ptr = localized_text.c_str();
- string_size = static_cast<int>(localized_text.length());
- }
+ localized_text = text;
+ base::i18n::AdjustStringForLocaleDirection(&localized_text);
+ string_ptr = localized_text.c_str();
+ string_size = static_cast<int>(localized_text.length());
}
DrawText(hdc, string_ptr, string_size, text_bounds, flags);