Index: base/i18n/rtl.cc |
diff --git a/base/i18n/rtl.cc b/base/i18n/rtl.cc |
index 095d66c6d8af13a9846e70ddc4fdf650410d2d03..e4ccc07159fc17c3fb631383b19d1b1b21fdb72d 100644 |
--- a/base/i18n/rtl.cc |
+++ b/base/i18n/rtl.cc |
@@ -55,6 +55,16 @@ 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) { |
+ base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); |
msw
2017/04/28 22:04:03
This function is called heavily, cache the value (
Kevin Bailey
2017/04/29 04:24:03
Done.
|
+ if (command_line->HasSwitch(switches::kForceTextDirection)) { |
+ std::string force_flag = |
+ command_line->GetSwitchValueASCII(switches::kForceTextDirection); |
+ |
+ if (force_flag == switches::kForceUIDirectionRTL) |
+ return base::i18n::RIGHT_TO_LEFT; |
+ if (force_flag == switches::kForceUIDirectionLTR) |
+ 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); |