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

Unified Diff: base/i18n/rtl.cc

Issue 10910128: Check string and UI direction in GetDisplayStringInLTRDirectionality, etc. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address comments. Created 8 years, 3 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 | « base/i18n/rtl.h ('k') | base/i18n/rtl_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/i18n/rtl.cc
diff --git a/base/i18n/rtl.cc b/base/i18n/rtl.cc
index 29a2a88d555e6d2164b6f7acf23eba6631fc5890..cbbb63f646b1f5c354fd0392d77d7e194cf16e9c 100644
--- a/base/i18n/rtl.cc
+++ b/base/i18n/rtl.cc
@@ -319,11 +319,14 @@ void WrapPathWithLTRFormatting(const FilePath& path,
}
string16 GetDisplayStringInLTRDirectionality(const string16& text) {
- if (!IsRTL())
- return text;
- string16 text_mutable(text);
- WrapStringWithLTRFormatting(&text_mutable);
- return text_mutable;
+ // Always wrap the string in RTL UI (it may be appended to RTL string).
+ // Also wrap strings with an RTL first strong character direction in LTR UI.
+ if (IsRTL() || GetFirstStrongCharacterDirection(text) == RIGHT_TO_LEFT) {
+ string16 text_mutable(text);
+ WrapStringWithLTRFormatting(&text_mutable);
+ return text_mutable;
+ }
+ return text;
}
string16 StripWrappingBidiControlCharacters(const string16& text) {
« no previous file with comments | « base/i18n/rtl.h ('k') | base/i18n/rtl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698