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

Unified Diff: chrome/browser/tab_contents/render_view_host_delegate_helper.cc

Issue 7606028: Pass per-script fonts to WebKit settings. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 4 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
Index: chrome/browser/tab_contents/render_view_host_delegate_helper.cc
diff --git a/chrome/browser/tab_contents/render_view_host_delegate_helper.cc b/chrome/browser/tab_contents/render_view_host_delegate_helper.cc
index 7a697dba62c71e8f1b29efde1b436e2bd34ab113..d26cd5c7b0b5809d72acf2dc2cd4536eb8a0402d 100644
--- a/chrome/browser/tab_contents/render_view_host_delegate_helper.cc
+++ b/chrome/browser/tab_contents/render_view_host_delegate_helper.cc
@@ -302,6 +302,19 @@ RenderWidgetHostView*
}
// static
+void RenderViewHostDelegateHelper::FillFontFamilyMap(
tony 2011/08/10 19:23:40 Does this need to be part of RenderViewHostDelegat
+ const DictionaryValue* from, WebPreferences::ScriptFontFamilyMap& to) {
+ if (from) {
+ for (DictionaryValue::key_iterator iter(from->begin_keys());
+ iter != from->end_keys(); ++iter) {
+ string16 value;
+ if (from->GetString(*iter, &value))
+ to.push_back(std::make_pair(*iter, value));
+ }
+ }
+}
+
+// static
WebPreferences RenderViewHostDelegateHelper::GetWebkitPrefs(
content::BrowserContext* browser_context, bool is_web_ui) {
Profile* profile = Profile::FromBrowserContext(browser_context);
@@ -321,6 +334,19 @@ WebPreferences RenderViewHostDelegateHelper::GetWebkitPrefs(
web_prefs.fantasy_font_family =
UTF8ToUTF16(prefs->GetString(prefs::kWebKitFantasyFontFamily));
+ FillFontFamilyMap(prefs->GetDictionary(prefs::kWebKitStandardFontFamilyMap),
+ web_prefs.standard_font_family_map);
+ FillFontFamilyMap(prefs->GetDictionary(prefs::kWebKitFixedFontFamilyMap),
+ web_prefs.fixed_font_family_map);
+ FillFontFamilyMap(prefs->GetDictionary(prefs::kWebKitSerifFontFamilyMap),
+ web_prefs.serif_font_family_map);
+ FillFontFamilyMap(prefs->GetDictionary(prefs::kWebKitSansSerifFontFamilyMap),
+ web_prefs.sans_serif_font_family_map);
+ FillFontFamilyMap(prefs->GetDictionary(prefs::kWebKitCursiveFontFamilyMap),
+ web_prefs.cursive_font_family_map);
+ FillFontFamilyMap(prefs->GetDictionary(prefs::kWebKitFantasyFontFamilyMap),
+ web_prefs.fantasy_font_family_map);
+
web_prefs.default_font_size =
prefs->GetInteger(prefs::kWebKitDefaultFontSize);
web_prefs.default_fixed_font_size =

Powered by Google App Engine
This is Rietveld 408576698