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

Unified Diff: base/i18n/rtl.cc

Issue 2833052: [chromeos]Set GtkWidget's default direction correctly. (Closed) Base URL: http://src.chromium.org/git/chromium.git
Patch Set: Update comment. Created 10 years, 6 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 | « no previous file | no next file » | 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 65973bd291446cc667f5725e691503e8b22509cf..6c3d39483834b7d1e3ddad419e5c3f5e5e5a7944 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() {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698