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

Unified Diff: base/i18n/rtl.cc

Issue 2853523002: [rendertext,i18n] Added flag to force RTL rendering (Closed)
Patch Set: Forgot to update histograms.xml Created 3 years, 8 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/base_i18n_switches.cc ('k') | chrome/browser/about_flags.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 095d66c6d8af13a9846e70ddc4fdf650410d2d03..2b6bf37706fd4ad52b28024427fa0451fc121c9d 100644
--- a/base/i18n/rtl.cc
+++ b/base/i18n/rtl.cc
@@ -55,6 +55,18 @@ std::string GetLocaleString(const icu::Locale& locale) {
// directionality, returns UNKNOWN_DIRECTION if it doesn't. Please refer to
// http://unicode.org/reports/tr9/ for more information.
base::i18n::TextDirection GetCharacterDirection(UChar32 character) {
+ static bool has_switch = base::CommandLine::ForCurrentProcess()->HasSwitch(
+ switches::kForceTextDirection);
+ if (has_switch) {
+ base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
+ std::string force_flag =
+ command_line->GetSwitchValueASCII(switches::kForceTextDirection);
+
+ if (force_flag == switches::kForceDirectionRTL)
+ return base::i18n::RIGHT_TO_LEFT;
+ if (force_flag == switches::kForceDirectionLTR)
+ return base::i18n::LEFT_TO_RIGHT;
+ }
// Now that we have the character, we use ICU in order to query for the
// appropriate Unicode BiDi character type.
int32_t property = u_getIntPropertyValue(character, UCHAR_BIDI_CLASS);
@@ -85,10 +97,10 @@ base::i18n::TextDirection GetForcedTextDirection() {
std::string force_flag =
command_line->GetSwitchValueASCII(switches::kForceUIDirection);
- if (force_flag == switches::kForceUIDirectionLTR)
+ if (force_flag == switches::kForceDirectionLTR)
return base::i18n::LEFT_TO_RIGHT;
- if (force_flag == switches::kForceUIDirectionRTL)
+ if (force_flag == switches::kForceDirectionRTL)
return base::i18n::RIGHT_TO_LEFT;
}
« no previous file with comments | « base/i18n/base_i18n_switches.cc ('k') | chrome/browser/about_flags.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698