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

Unified Diff: gfx/canvas_skia_win.cc

Issue 5154009: Cleanup AdjustStringForLocaleDirection() (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: further fixes Created 10 years, 1 month 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
Index: gfx/canvas_skia_win.cc
diff --git a/gfx/canvas_skia_win.cc b/gfx/canvas_skia_win.cc
index 1a65da09acd83dfd485458926e77d389be8307f3..dd8c96a599586dc1ada3c20c9e4abed3d9fae166 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);

Powered by Google App Engine
This is Rietveld 408576698