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

Unified Diff: chrome/browser/ui/webui/options2/font_settings_handler2.cc

Issue 9838055: Fixed bidi RTL check failures on font settings page. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Sets the directionality from the contents of the font strings. Created 8 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 | « chrome/browser/ui/webui/bidi_checker_web_ui_test.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/webui/options2/font_settings_handler2.cc
diff --git a/chrome/browser/ui/webui/options2/font_settings_handler2.cc b/chrome/browser/ui/webui/options2/font_settings_handler2.cc
index bac3faab785c09f2fd2b2b66553919228c99ebad..1fc18fcb42a0037c8e953da7215b3733358b4e4d 100644
--- a/chrome/browser/ui/webui/options2/font_settings_handler2.cc
+++ b/chrome/browser/ui/webui/options2/font_settings_handler2.cc
@@ -133,6 +133,18 @@ void FontSettingsHandler::HandleFetchFontsData(const ListValue* args) {
void FontSettingsHandler::FontsListHasLoaded(
scoped_ptr<base::ListValue> list) {
+ // Selects the directionality for the fonts in the given list.
+ for (size_t i = 0; i < list->GetSize(); i++) {
+ ListValue* font;
+ bool has_font = list->GetList(i, &font);
+ DCHECK(has_font);
+ string16 value;
+ bool has_value = font->GetString(1, &value);
+ DCHECK(has_value);
+ bool has_rtl_chars = base::i18n::StringContainsStrongRTLChars(value);
+ font->Append(Value::CreateStringValue(has_rtl_chars ? "rtl" : "ltr"));
+ }
+
ListValue encoding_list;
const std::vector<CharacterEncoding::EncodingInfo>* encodings;
PrefService* pref_service = Profile::FromWebUI(web_ui())->GetPrefs();
@@ -151,9 +163,10 @@ void FontSettingsHandler::FontsListHasLoaded(
std::string encoding =
CharacterEncoding::GetCanonicalEncodingNameByCommandId(cmd_id);
string16 name = it->encoding_display_name;
- base::i18n::AdjustStringForLocaleDirection(&name);
+ bool has_rtl_chars = base::i18n::StringContainsStrongRTLChars(name);
option->Append(Value::CreateStringValue(encoding));
option->Append(Value::CreateStringValue(name));
+ option->Append(Value::CreateStringValue(has_rtl_chars ? "rtl" : "ltr"));
} else {
// Add empty name/value to indicate a separator item.
option->Append(Value::CreateStringValue(""));
« no previous file with comments | « chrome/browser/ui/webui/bidi_checker_web_ui_test.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698