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

Unified Diff: ui/base/webui/web_ui_util.cc

Issue 747923004: webui: minimize webui flicker. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: creis@ + davidben@ review Created 6 years, 1 month 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 | « ui/base/webui/web_ui_util.h ('k') | ui/webui/resources/css/chrome_shared.css » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/base/webui/web_ui_util.cc
diff --git a/ui/base/webui/web_ui_util.cc b/ui/base/webui/web_ui_util.cc
index c67e23edd40ef2c96b7873e3b7757800d1bc0be3..36e9b124abf1785a4d3f82f521f6cea544e390a9 100644
--- a/ui/base/webui/web_ui_util.cc
+++ b/ui/base/webui/web_ui_util.cc
@@ -125,19 +125,13 @@ void ParsePathAndScale(const GURL& url,
}
}
-// static
-void SetFontAndTextDirection(base::DictionaryValue* localized_strings) {
- int web_font_family_id = IDS_WEB_FONT_FAMILY;
- int web_font_size_id = IDS_WEB_FONT_SIZE;
+std::string GetFontFamily() {
+ std::string font_family = l10n_util::GetStringUTF8(
#if defined(OS_WIN)
- // Vary font settings for Windows XP.
- if (base::win::GetVersion() < base::win::VERSION_VISTA) {
- web_font_family_id = IDS_WEB_FONT_FAMILY_XP;
- web_font_size_id = IDS_WEB_FONT_SIZE_XP;
- }
+ base::win::GetVersion() < base::win::VERSION_VISTA ?
+ IDS_WEB_FONT_FAMILY_XP :
#endif
-
- std::string font_family = l10n_util::GetStringUTF8(web_font_family_id);
+ IDS_WEB_FONT_FAMILY);
// TODO(dnicoara) Remove Ozone check when PlatformFont support is introduced
// into Ozone: crbug.com/320050
@@ -146,11 +140,26 @@ void SetFontAndTextDirection(base::DictionaryValue* localized_strings) {
ui::ResourceBundle::BaseFont).GetFontName() + ", " + font_family;
#endif
- localized_strings->SetString("fontfamily", font_family);
- localized_strings->SetString("fontsize",
- l10n_util::GetStringUTF8(web_font_size_id));
- localized_strings->SetString("textdirection",
- base::i18n::IsRTL() ? "rtl" : "ltr");
+ return font_family;
+}
+
+std::string GetFontSize() {
+ return l10n_util::GetStringUTF8(
+#if defined(OS_WIN)
+ base::win::GetVersion() < base::win::VERSION_VISTA ?
+ IDS_WEB_FONT_SIZE_XP :
+#endif
+ IDS_WEB_FONT_SIZE);
+}
+
+std::string GetTextDirection() {
+ return base::i18n::IsRTL() ? "rtl" : "ltr";
+}
+
+void SetFontAndTextDirection(base::DictionaryValue* localized_strings) {
+ localized_strings->SetString("fontfamily", GetFontFamily());
+ localized_strings->SetString("fontsize", GetFontSize());
+ localized_strings->SetString("textdirection", GetTextDirection());
}
} // namespace webui
« no previous file with comments | « ui/base/webui/web_ui_util.h ('k') | ui/webui/resources/css/chrome_shared.css » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698