diff options
author | suzhe@chromium.org <suzhe@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-07-02 01:26:54 +0000 |
---|---|---|
committer | suzhe@chromium.org <suzhe@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-07-02 01:26:54 +0000 |
commit | 42d9fdb8026af0f001471cf1e107fffd4a384af7 (patch) | |
tree | 7dc3fc83aeac9cf63976e9bb1046a7d05402d24e /base | |
parent | 3e0a8b86a3ea0f3da932df88738fa4d5ac4f8a04 (diff) | |
download | chromium_src-42d9fdb8026af0f001471cf1e107fffd4a384af7.zip chromium_src-42d9fdb8026af0f001471cf1e107fffd4a384af7.tar.gz chromium_src-42d9fdb8026af0f001471cf1e107fffd4a384af7.tar.bz2 |
[chromeos]Set GtkWidget's default direction correctly.
BUG=41558
TEST=Login ChromeOS with a RTL language, the text in the omnibox should be right aligned.
Review URL: http://codereview.chromium.org/2833052
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@51471 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base')
-rw-r--r-- | base/i18n/rtl.cc | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/base/i18n/rtl.cc b/base/i18n/rtl.cc index 65973bd..6c3d3948 100644 --- a/base/i18n/rtl.cc +++ b/base/i18n/rtl.cc @@ -14,7 +14,7 @@ #include "unicode/uchar.h" #include "unicode/uscript.h" -#if defined(TOOLKIT_GTK) +#if defined(TOOLKIT_USES_GTK) #include <gtk/gtk.h> #endif @@ -75,6 +75,15 @@ void SetICUDefaultLocale(const std::string& locale_string) { // it does not hurt to have it as a sanity check. DCHECK(U_SUCCESS(error_code)); g_icu_text_direction = UNKNOWN_DIRECTION; + + // If we use Views toolkit on top of GtkWidget, then we need to keep + // GtkWidget's default text direction consistent with ICU's text direction. + // Because in this case ICU's text direction will be used instead. + // See IsRTL() function below. +#if defined(TOOLKIT_USES_GTK) && !defined(TOOLKIT_GTK) + gtk_widget_set_default_direction( + ICUIsRTL() ? GTK_TEXT_DIR_RTL : GTK_TEXT_DIR_LTR); +#endif } bool IsRTL() { |