summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorfalken@chromium.org <falken@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-05-18 07:20:32 +0000
committerfalken@chromium.org <falken@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-05-18 07:20:32 +0000
commit966d1e1627da47dc782a3d7ca8204de233b6edd6 (patch)
tree49477476b24226b10881e6b0cc35e26197b77c74
parent1c6189ff4780f3a0968eb93370de7f477bf44b50 (diff)
downloadchromium_src-966d1e1627da47dc782a3d7ca8204de233b6edd6.zip
chromium_src-966d1e1627da47dc782a3d7ca8204de233b6edd6.tar.gz
chromium_src-966d1e1627da47dc782a3d7ca8204de233b6edd6.tar.bz2
Migrate WebKit "global script" font prefs.
The effect is to migrate a pref like webkit.webprefs.global.standard_font_family to webkit.webprefs.fonts.standard.Zyyy This has two motivations: 1) Undo the migration of font prefs to the "global" (as opposed to per-tab) namespace, as planned here: <http://codereview.chromium.org/9838050>. There are still more prefs to move out of "global" after this patch. 2) Move the "global script" (as opposed to per-script) font prefs into the per-script font maps, under the script code "Zyyy" (the ISO 15924 code for the "Common" script). This is consistent with WebKit-side settings and should simplify the code overall as we no longer have to special case the global script vs the per-script fonts. TBR=gene for chrome/browser/printing BUG=123812 TEST=browser_tests --gtest_filter=PrefsTab* and ExtensionApiTest.Font* Review URL: https://chromiumcodereview.appspot.com/10107014 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@137835 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/chrome_content_browser_client.cc15
-rw-r--r--chrome/browser/extensions/extension_font_settings_api.cc77
-rw-r--r--chrome/browser/extensions/extension_font_settings_apitest.cc4
-rw-r--r--chrome/browser/prefs/pref_service_unittest.cc3
-rw-r--r--chrome/browser/printing/cloud_print/cloud_print_setup_flow.cc4
-rw-r--r--chrome/browser/resources/options2/font_settings.html8
-rw-r--r--chrome/browser/ui/prefs/prefs_tab_helper.cc130
-rw-r--r--chrome/browser/ui/prefs/prefs_tab_helper_browsertest.cc105
-rw-r--r--chrome/browser/ui/webui/options2/font_settings_handler2.cc18
-rw-r--r--chrome/browser/ui/webui/options2/font_settings_utils2_mac.mm6
-rw-r--r--chrome/common/extensions/api/experimental_font_settings.json10
-rw-r--r--chrome/common/extensions/docs/experimental.fontSettings.html10
-rw-r--r--chrome/common/pref_names.cc26
-rw-r--r--chrome/common/pref_names.h22
-rw-r--r--chrome/test/data/extensions/api_test/font_settings/standard/test.js5
-rw-r--r--chrome/test/data/profiles/webkit_global_reverse_migration/Default/Preferences14
-rw-r--r--content/common/view_messages.h6
-rw-r--r--ppapi/proxy/ppapi_messages.h8
-rw-r--r--ppapi/shared_impl/ppapi_preferences.cc10
-rw-r--r--ppapi/shared_impl/ppapi_preferences.h10
-rw-r--r--ppapi/shared_impl/private/ppb_browser_font_trusted_shared.cc30
-rw-r--r--ppapi/shared_impl/private/ppb_font_shared.cc30
-rw-r--r--webkit/glue/webpreferences.cc32
-rw-r--r--webkit/glue/webpreferences.h14
-rw-r--r--webkit/tools/test_shell/test_shell.cc27
25 files changed, 381 insertions, 243 deletions
diff --git a/chrome/browser/chrome_content_browser_client.cc b/chrome/browser/chrome_content_browser_client.cc
index fad4f84..1c5efe5 100644
--- a/chrome/browser/chrome_content_browser_client.cc
+++ b/chrome/browser/chrome_content_browser_client.cc
@@ -305,7 +305,7 @@ void FillFontFamilyMap(const PrefService* prefs,
std::string pref_name = base::StringPrintf("%s.%s", map_name, script);
std::string font_family = prefs->GetString(pref_name.c_str());
if (!font_family.empty())
- map->push_back(std::make_pair(script, UTF8ToUTF16(font_family)));
+ (*map)[script] = UTF8ToUTF16(font_family);
}
}
@@ -1334,19 +1334,6 @@ void ChromeContentBrowserClient::OverrideWebkitPrefs(
rvh->GetProcess()->GetBrowserContext());
PrefService* prefs = profile->GetPrefs();
- web_prefs->standard_font_family =
- UTF8ToUTF16(prefs->GetString(prefs::kWebKitGlobalStandardFontFamily));
- web_prefs->fixed_font_family =
- UTF8ToUTF16(prefs->GetString(prefs::kWebKitGlobalFixedFontFamily));
- web_prefs->serif_font_family =
- UTF8ToUTF16(prefs->GetString(prefs::kWebKitGlobalSerifFontFamily));
- web_prefs->sans_serif_font_family =
- UTF8ToUTF16(prefs->GetString(prefs::kWebKitGlobalSansSerifFontFamily));
- web_prefs->cursive_font_family =
- UTF8ToUTF16(prefs->GetString(prefs::kWebKitGlobalCursiveFontFamily));
- web_prefs->fantasy_font_family =
- UTF8ToUTF16(prefs->GetString(prefs::kWebKitGlobalFantasyFontFamily));
-
FillFontFamilyMap(prefs, prefs::kWebKitStandardFontFamilyMap,
&web_prefs->standard_font_family_map);
FillFontFamilyMap(prefs, prefs::kWebKitFixedFontFamilyMap,
diff --git a/chrome/browser/extensions/extension_font_settings_api.cc b/chrome/browser/extensions/extension_font_settings_api.cc
index 9d12154..6943745 100644
--- a/chrome/browser/extensions/extension_font_settings_api.cc
+++ b/chrome/browser/extensions/extension_font_settings_api.cc
@@ -50,20 +50,9 @@ const char kOnFontChanged[] = "experimental.fontSettings.onFontChanged";
const char kOnMinimumFontSizeChanged[] =
"experimental.fontSettings.onMinimumFontSizeChanged";
-// Format for per-script font preference keys.
-// E.g., "webkit.webprefs.fonts.standard.Hrkt"
-const char kWebKitPerScriptFontPrefFormat[] = "webkit.webprefs.fonts.%s.%s";
-const char kWebKitPerScriptFontPrefPrefix[] = "webkit.webprefs.fonts.";
-
-// Format for global (non per-script) font preference keys.
-// E.g., "webkit.webprefs.global.fixed_font_family"
-// Note: there are two meanings of "global" here. The "Global" in the const name
-// means "not per-script". The "global" in the key itself means "not per-tab"
-// (per-profile).
-const char kWebKitGlobalFontPrefFormat[] =
- "webkit.webprefs.global.%s_font_family";
-const char kWebKitGlobalFontPrefPrefix[] = "webkit.webprefs.global.";
-const char kWebKitGlobalFontPrefSuffix[] = "_font_family";
+// Format for font preference keys.
+const char kWebKitFontPrefFormat[] = "webkit.webprefs.fonts.%s.%s";
+const char kWebKitFontPrefPrefix[] = "webkit.webprefs.fonts.";
// Gets the font name preference path from |details| which contains key
// |kGenericFamilyKey| and optionally |kScriptKey|.
@@ -72,18 +61,14 @@ bool GetFontNamePrefPath(DictionaryValue* details, std::string* pref_path) {
if (!details->GetString(kGenericFamilyKey, &generic_family))
return false;
- if (details->HasKey(kScriptKey)) {
- std::string script;
- if (!details->GetString(kScriptKey, &script))
- return false;
- *pref_path = StringPrintf(kWebKitPerScriptFontPrefFormat,
- generic_family.c_str(),
- script.c_str());
- } else {
- *pref_path = StringPrintf(kWebKitGlobalFontPrefFormat,
- generic_family.c_str());
- }
-
+ std::string script;
+ if (!details->HasKey(kScriptKey))
+ script = prefs::kWebKitCommonScript;
+ else if (!details->GetString(kScriptKey, &script))
+ return false;
+ *pref_path = StringPrintf(kWebKitFontPrefFormat,
+ generic_family.c_str(),
+ script.c_str());
return true;
}
@@ -91,25 +76,16 @@ bool GetFontNamePrefPath(DictionaryValue* details, std::string* pref_path) {
bool ParseFontNamePrefPath(std::string pref_path,
std::string* generic_family,
std::string* script) {
- if (StartsWithASCII(pref_path, kWebKitPerScriptFontPrefPrefix, true)) {
- size_t start = strlen(kWebKitPerScriptFontPrefPrefix);
- size_t pos = pref_path.find('.', start);
- if (pos == std::string::npos || pos + 1 == pref_path.length())
- return false;
- *generic_family = pref_path.substr(start, pos - start);
- *script = pref_path.substr(pos + 1);
- return true;
- } else if (StartsWithASCII(pref_path, kWebKitGlobalFontPrefPrefix, true) &&
- EndsWith(pref_path, kWebKitGlobalFontPrefSuffix, true)) {
- size_t start = strlen(kWebKitGlobalFontPrefPrefix);
- size_t pos = pref_path.find('_', start);
- if (pos == std::string::npos || pos + 1 == pref_path.length())
- return false;
- *generic_family = pref_path.substr(start, pos - start);
- *script = "";
- return true;
- }
- return false;
+ if (!StartsWithASCII(pref_path, kWebKitFontPrefPrefix, true))
+ return false;
+
+ size_t start = strlen(kWebKitFontPrefPrefix);
+ size_t pos = pref_path.find('.', start);
+ if (pos == std::string::npos || pos + 1 == pref_path.length())
+ return false;
+ *generic_family = pref_path.substr(start, pos - start);
+ *script = pref_path.substr(pos + 1);
+ return true;
}
// Returns the localized name of a font so that it can be matched within the
@@ -160,12 +136,6 @@ void ExtensionFontSettingsEventRouter::Init() {
kOnDefaultCharacterSetChanged,
kCharsetKey);
- registrar_.Add(prefs::kWebKitGlobalStandardFontFamily, this);
- registrar_.Add(prefs::kWebKitGlobalSerifFontFamily, this);
- registrar_.Add(prefs::kWebKitGlobalSansSerifFontFamily, this);
- registrar_.Add(prefs::kWebKitGlobalFixedFontFamily, this);
- registrar_.Add(prefs::kWebKitGlobalCursiveFontFamily, this);
- registrar_.Add(prefs::kWebKitGlobalFantasyFontFamily, this);
RegisterFontFamilyMapObserver(&registrar_,
prefs::kWebKitStandardFontFamilyMap, this);
RegisterFontFamilyMapObserver(&registrar_,
@@ -244,8 +214,7 @@ void ExtensionFontSettingsEventRouter::OnFontNamePrefChanged(
args.Append(dict);
dict->SetString(kFontNameKey, font_name);
dict->SetString(kGenericFamilyKey, generic_family);
- if (!script.empty())
- dict->SetString(kScriptKey, script);
+ dict->SetString(kScriptKey, script);
extension_preference_helpers::DispatchEventToExtensions(
profile_,
@@ -350,7 +319,7 @@ bool SetFontFunction::RunImpl() {
std::string font_name;
EXTENSION_FUNCTION_VALIDATE(details->GetString(kFontNameKey, &font_name));
- // Ensure |pref_path| really is for a registered per-script font pref.
+ // Ensure |pref_path| really is for a registered font pref.
EXTENSION_FUNCTION_VALIDATE(
profile_->GetPrefs()->FindPreference(pref_path.c_str()));
diff --git a/chrome/browser/extensions/extension_font_settings_apitest.cc b/chrome/browser/extensions/extension_font_settings_apitest.cc
index 4ab7329..337c098 100644
--- a/chrome/browser/extensions/extension_font_settings_apitest.cc
+++ b/chrome/browser/extensions/extension_font_settings_apitest.cc
@@ -15,7 +15,7 @@ IN_PROC_BROWSER_TEST_F(ExtensionApiTest, FontSettings) {
PrefService* prefs = browser()->profile()->GetPrefs();
prefs->SetString(prefs::kWebKitStandardFontFamilyKorean, "Tahoma");
- prefs->SetString(prefs::kWebKitGlobalSansSerifFontFamily, "Arial");
+ prefs->SetString(prefs::kWebKitSansSerifFontFamily, "Arial");
prefs->SetInteger(prefs::kWebKitGlobalDefaultFontSize, 16);
prefs->SetInteger(prefs::kWebKitGlobalDefaultFixedFontSize, 14);
prefs->SetInteger(prefs::kWebKitGlobalMinimumFontSize, 8);
@@ -30,7 +30,7 @@ IN_PROC_BROWSER_TEST_F(ExtensionApiTest, FontSettingsIncognito) {
PrefService* prefs = browser()->profile()->GetPrefs();
prefs->SetString(prefs::kWebKitStandardFontFamilyKorean, "Tahoma");
- prefs->SetString(prefs::kWebKitGlobalSansSerifFontFamily, "Arial");
+ prefs->SetString(prefs::kWebKitSansSerifFontFamily, "Arial");
prefs->SetInteger(prefs::kWebKitGlobalDefaultFontSize, 16);
int flags = ExtensionApiTest::kFlagEnableIncognito |
diff --git a/chrome/browser/prefs/pref_service_unittest.cc b/chrome/browser/prefs/pref_service_unittest.cc
index ab3a62f..a685885 100644
--- a/chrome/browser/prefs/pref_service_unittest.cc
+++ b/chrome/browser/prefs/pref_service_unittest.cc
@@ -404,6 +404,7 @@ TEST_F(PrefServiceWebKitPrefs, PrefsCopied) {
#else
const char kDefaultFont[] = "Times New Roman";
#endif
- EXPECT_EQ(ASCIIToUTF16(kDefaultFont), webkit_prefs.standard_font_family);
+ EXPECT_EQ(ASCIIToUTF16(kDefaultFont),
+ webkit_prefs.standard_font_family_map[prefs::kWebKitCommonScript]);
EXPECT_TRUE(webkit_prefs.javascript_enabled);
}
diff --git a/chrome/browser/printing/cloud_print/cloud_print_setup_flow.cc b/chrome/browser/printing/cloud_print/cloud_print_setup_flow.cc
index f41c1e0..efabb80 100644
--- a/chrome/browser/printing/cloud_print/cloud_print_setup_flow.cc
+++ b/chrome/browser/printing/cloud_print/cloud_print_setup_flow.cc
@@ -133,7 +133,7 @@ void CloudPrintSetupFlow::GetWebUIMessageHandlers(
void CloudPrintSetupFlow::GetDialogSize(gfx::Size* size) const {
PrefService* prefs = profile_->GetPrefs();
gfx::Font approximate_web_font(
- prefs->GetString(prefs::kWebKitGlobalSansSerifFontFamily),
+ prefs->GetString(prefs::kWebKitSansSerifFontFamily),
prefs->GetInteger(prefs::kWebKitGlobalDefaultFontSize));
if (setup_done_) {
@@ -315,7 +315,7 @@ void CloudPrintSetupFlow::ShowSetupDone() {
if (web_ui_) {
PrefService* prefs = profile_->GetPrefs();
gfx::Font approximate_web_font(
- prefs->GetString(prefs::kWebKitGlobalSansSerifFontFamily),
+ prefs->GetString(prefs::kWebKitSansSerifFontFamily),
prefs->GetInteger(prefs::kWebKitGlobalDefaultFontSize));
gfx::Size done_size = ui::GetLocalizedContentsSizeForFont(
IDS_CLOUD_PRINT_SETUP_WIZARD_DONE_WIDTH_CHARS,
diff --git a/chrome/browser/resources/options2/font_settings.html b/chrome/browser/resources/options2/font_settings.html
index 23b03ef..c49795c 100644
--- a/chrome/browser/resources/options2/font_settings.html
+++ b/chrome/browser/resources/options2/font_settings.html
@@ -9,7 +9,7 @@
<div>
<select id="standard-font-family" class="font-input"
data-type="string" metric="Options_ChangeStandardFont"
- pref="webkit.webprefs.global.standard_font_family">
+ pref="webkit.webprefs.fonts.standard.Zyyy">
</select>
</div>
<div>
@@ -32,7 +32,7 @@
<div class="font-input-div">
<div>
<select id="serif-font-family" class="font-input" data-type="string"
- pref="webkit.webprefs.global.serif_font_family"
+ pref="webkit.webprefs.fonts.serif.Zyyy"
metric="Options_ChangeSerifFont">
</select>
</div>
@@ -47,7 +47,7 @@
<div>
<select id="sans-serif-font-family" class="font-input"
data-type="string" metric="Options_ChangeSansSerifFont"
- pref="webkit.webprefs.global.sansserif_font_family">
+ pref="webkit.webprefs.fonts.sansserif.Zyyy">
</select>
</div>
</div>
@@ -60,7 +60,7 @@
<div class="font-input-div">
<div>
<select id="fixed-font-family" class="font-input" data-type="string"
- pref="webkit.webprefs.global.fixed_font_family"
+ pref="webkit.webprefs.fonts.fixed.Zyyy"
metric="Options_ChangeFixedFont">
</select>
</div>
diff --git a/chrome/browser/ui/prefs/prefs_tab_helper.cc b/chrome/browser/ui/prefs/prefs_tab_helper.cc
index 65b58ad..2e19ecc 100644
--- a/chrome/browser/ui/prefs/prefs_tab_helper.cc
+++ b/chrome/browser/ui/prefs/prefs_tab_helper.cc
@@ -36,24 +36,6 @@ static void RegisterFontsAndCharsetPrefs(PrefService* prefs) {
prefs->RegisterLocalizedStringPref(prefs::kDefaultCharset,
IDS_DEFAULT_ENCODING,
PrefService::SYNCABLE_PREF);
- prefs->RegisterLocalizedStringPref(prefs::kWebKitStandardFontFamily,
- IDS_STANDARD_FONT_FAMILY,
- PrefService::UNSYNCABLE_PREF);
- prefs->RegisterLocalizedStringPref(prefs::kWebKitFixedFontFamily,
- IDS_FIXED_FONT_FAMILY,
- PrefService::UNSYNCABLE_PREF);
- prefs->RegisterLocalizedStringPref(prefs::kWebKitSerifFontFamily,
- IDS_SERIF_FONT_FAMILY,
- PrefService::UNSYNCABLE_PREF);
- prefs->RegisterLocalizedStringPref(prefs::kWebKitSansSerifFontFamily,
- IDS_SANS_SERIF_FONT_FAMILY,
- PrefService::UNSYNCABLE_PREF);
- prefs->RegisterLocalizedStringPref(prefs::kWebKitCursiveFontFamily,
- IDS_CURSIVE_FONT_FAMILY,
- PrefService::UNSYNCABLE_PREF);
- prefs->RegisterLocalizedStringPref(prefs::kWebKitFantasyFontFamily,
- IDS_FANTASY_FONT_FAMILY,
- PrefService::UNSYNCABLE_PREF);
prefs->RegisterLocalizedIntegerPref(prefs::kWebKitDefaultFontSize,
IDS_DEFAULT_FONT_SIZE,
PrefService::UNSYNCABLE_PREF);
@@ -66,6 +48,44 @@ static void RegisterFontsAndCharsetPrefs(PrefService* prefs) {
prefs->RegisterLocalizedIntegerPref(prefs::kWebKitMinimumLogicalFontSize,
IDS_MINIMUM_LOGICAL_FONT_SIZE,
PrefService::UNSYNCABLE_PREF);
+
+ // These are only registered to be used in migration.
+ prefs->RegisterLocalizedStringPref(prefs::kWebKitOldStandardFontFamily,
+ IDS_STANDARD_FONT_FAMILY,
+ PrefService::UNSYNCABLE_PREF);
+ prefs->RegisterLocalizedStringPref(prefs::kWebKitOldFixedFontFamily,
+ IDS_FIXED_FONT_FAMILY,
+ PrefService::UNSYNCABLE_PREF);
+ prefs->RegisterLocalizedStringPref(prefs::kWebKitOldSerifFontFamily,
+ IDS_SERIF_FONT_FAMILY,
+ PrefService::UNSYNCABLE_PREF);
+ prefs->RegisterLocalizedStringPref(prefs::kWebKitOldSansSerifFontFamily,
+ IDS_SANS_SERIF_FONT_FAMILY,
+ PrefService::UNSYNCABLE_PREF);
+ prefs->RegisterLocalizedStringPref(prefs::kWebKitOldCursiveFontFamily,
+ IDS_CURSIVE_FONT_FAMILY,
+ PrefService::UNSYNCABLE_PREF);
+ prefs->RegisterLocalizedStringPref(prefs::kWebKitOldFantasyFontFamily,
+ IDS_FANTASY_FONT_FAMILY,
+ PrefService::UNSYNCABLE_PREF);
+ prefs->RegisterLocalizedStringPref(prefs::kWebKitGlobalStandardFontFamily,
+ IDS_STANDARD_FONT_FAMILY,
+ PrefService::UNSYNCABLE_PREF);
+ prefs->RegisterLocalizedStringPref(prefs::kWebKitGlobalFixedFontFamily,
+ IDS_FIXED_FONT_FAMILY,
+ PrefService::UNSYNCABLE_PREF);
+ prefs->RegisterLocalizedStringPref(prefs::kWebKitGlobalSerifFontFamily,
+ IDS_SERIF_FONT_FAMILY,
+ PrefService::UNSYNCABLE_PREF);
+ prefs->RegisterLocalizedStringPref(prefs::kWebKitGlobalSansSerifFontFamily,
+ IDS_SANS_SERIF_FONT_FAMILY,
+ PrefService::UNSYNCABLE_PREF);
+ prefs->RegisterLocalizedStringPref(prefs::kWebKitGlobalCursiveFontFamily,
+ IDS_CURSIVE_FONT_FAMILY,
+ PrefService::UNSYNCABLE_PREF);
+ prefs->RegisterLocalizedStringPref(prefs::kWebKitGlobalFantasyFontFamily,
+ IDS_FANTASY_FONT_FAMILY,
+ PrefService::UNSYNCABLE_PREF);
}
// The list of prefs we want to observe.
@@ -75,20 +95,14 @@ const char* kPrefsToObserve[] = {
prefs::kEnableReferrers,
prefs::kWebKitAllowDisplayingInsecureContent,
prefs::kWebKitAllowRunningInsecureContent,
- prefs::kWebKitGlobalCursiveFontFamily,
prefs::kWebKitGlobalDefaultFixedFontSize,
prefs::kWebKitGlobalDefaultFontSize,
- prefs::kWebKitGlobalFantasyFontFamily,
- prefs::kWebKitGlobalFixedFontFamily,
prefs::kWebKitGlobalJavascriptEnabled,
prefs::kWebKitJavaEnabled,
prefs::kWebKitGlobalLoadsImagesAutomatically,
prefs::kWebKitGlobalMinimumFontSize,
prefs::kWebKitGlobalMinimumLogicalFontSize,
prefs::kWebKitGlobalPluginsEnabled,
- prefs::kWebKitGlobalSansSerifFontFamily,
- prefs::kWebKitGlobalSerifFontFamily,
- prefs::kWebKitGlobalStandardFontFamily,
prefs::kWebkitTabsToLinks,
prefs::kWebKitUsesUniversalDetector
};
@@ -243,26 +257,51 @@ const struct {
} kPrefNamesToMigrate[] = {
{ prefs::kDefaultCharset,
prefs::kGlobalDefaultCharset },
- { prefs::kWebKitCursiveFontFamily,
- prefs::kWebKitGlobalCursiveFontFamily },
{ prefs::kWebKitDefaultFixedFontSize,
prefs::kWebKitGlobalDefaultFixedFontSize },
{ prefs::kWebKitDefaultFontSize,
prefs::kWebKitGlobalDefaultFontSize },
- { prefs::kWebKitFantasyFontFamily,
- prefs::kWebKitGlobalFantasyFontFamily },
- { prefs::kWebKitFixedFontFamily,
- prefs::kWebKitGlobalFixedFontFamily },
{ prefs::kWebKitMinimumFontSize,
prefs::kWebKitGlobalMinimumFontSize },
{ prefs::kWebKitMinimumLogicalFontSize,
prefs::kWebKitGlobalMinimumLogicalFontSize },
- { prefs::kWebKitSansSerifFontFamily,
- prefs::kWebKitGlobalSansSerifFontFamily },
- { prefs::kWebKitSerifFontFamily,
- prefs::kWebKitGlobalSerifFontFamily },
- { prefs::kWebKitStandardFontFamily,
- prefs::kWebKitGlobalStandardFontFamily },
+
+ // Migrate prefs like "webkit.webprefs.standard_font_family" to
+ // "webkit.webprefs.fonts.standard.Zyyy". This moves the formerly
+ // "non-per-script" font prefs into the per-script font pref maps, as the
+ // entry for the "Common" script (Zyyy is the ISO 15924 script code for the
+ // Common script). The |from| prefs will exist if the migration to global
+ // prefs (for the per-tab pref mechanism, which has since been removed) never
+ // occurred.
+ { prefs::kWebKitOldCursiveFontFamily,
+ prefs::kWebKitCursiveFontFamily },
+ { prefs::kWebKitOldFantasyFontFamily,
+ prefs::kWebKitFantasyFontFamily },
+ { prefs::kWebKitOldFixedFontFamily,
+ prefs::kWebKitFixedFontFamily },
+ { prefs::kWebKitOldSansSerifFontFamily,
+ prefs::kWebKitSansSerifFontFamily },
+ { prefs::kWebKitOldSerifFontFamily,
+ prefs::kWebKitSerifFontFamily },
+ { prefs::kWebKitOldStandardFontFamily,
+ prefs::kWebKitStandardFontFamily },
+
+ // Migrate "global" prefs. These will exist if the migration to global prefs
+ // (for the per-tab pref mechanism, which has since been removed) occurred.
+ // In addition, this moves the formerly "non-per-script" font prefs into the
+ // per-script font pref maps, as above.
+ { prefs::kWebKitGlobalCursiveFontFamily,
+ prefs::kWebKitCursiveFontFamily },
+ { prefs::kWebKitGlobalFantasyFontFamily,
+ prefs::kWebKitFantasyFontFamily },
+ { prefs::kWebKitGlobalFixedFontFamily,
+ prefs::kWebKitFixedFontFamily },
+ { prefs::kWebKitGlobalSansSerifFontFamily,
+ prefs::kWebKitSansSerifFontFamily },
+ { prefs::kWebKitGlobalSerifFontFamily,
+ prefs::kWebKitSerifFontFamily },
+ { prefs::kWebKitGlobalStandardFontFamily,
+ prefs::kWebKitStandardFontFamily }
};
const int kPrefsToMigrateLength = ARRAYSIZE_UNSAFE(kPrefNamesToMigrate);
@@ -385,22 +424,22 @@ void PrefsTabHelper::RegisterUserPrefs(PrefService* prefs) {
prefs->RegisterLocalizedStringPref(prefs::kGlobalDefaultCharset,
IDS_DEFAULT_ENCODING,
PrefService::SYNCABLE_PREF);
- prefs->RegisterLocalizedStringPref(prefs::kWebKitGlobalStandardFontFamily,
+ prefs->RegisterLocalizedStringPref(prefs::kWebKitStandardFontFamily,
IDS_STANDARD_FONT_FAMILY,
PrefService::UNSYNCABLE_PREF);
- prefs->RegisterLocalizedStringPref(prefs::kWebKitGlobalFixedFontFamily,
+ prefs->RegisterLocalizedStringPref(prefs::kWebKitFixedFontFamily,
IDS_FIXED_FONT_FAMILY,
PrefService::UNSYNCABLE_PREF);
- prefs->RegisterLocalizedStringPref(prefs::kWebKitGlobalSerifFontFamily,
+ prefs->RegisterLocalizedStringPref(prefs::kWebKitSerifFontFamily,
IDS_SERIF_FONT_FAMILY,
PrefService::UNSYNCABLE_PREF);
- prefs->RegisterLocalizedStringPref(prefs::kWebKitGlobalSansSerifFontFamily,
+ prefs->RegisterLocalizedStringPref(prefs::kWebKitSansSerifFontFamily,
IDS_SANS_SERIF_FONT_FAMILY,
PrefService::UNSYNCABLE_PREF);
- prefs->RegisterLocalizedStringPref(prefs::kWebKitGlobalCursiveFontFamily,
+ prefs->RegisterLocalizedStringPref(prefs::kWebKitCursiveFontFamily,
IDS_CURSIVE_FONT_FAMILY,
PrefService::UNSYNCABLE_PREF);
- prefs->RegisterLocalizedStringPref(prefs::kWebKitGlobalFantasyFontFamily,
+ prefs->RegisterLocalizedStringPref(prefs::kWebKitFantasyFontFamily,
IDS_FANTASY_FONT_FAMILY,
PrefService::UNSYNCABLE_PREF);
@@ -413,8 +452,11 @@ void PrefsTabHelper::RegisterUserPrefs(PrefService* prefs) {
const PerScriptFontDefault& pref = kPerScriptFontDefaults[i];
// Suppress default per-script font when the script matches the browser's
// locale. Otherwise, the default would override the user's preferences
- // when viewing pages in their native language. This can be removed when
- // per-script fonts are added to Preferences UI.
+ // when viewing pages in their native language. This would be bad
+ // particularly because there is not yet a way for users to customize
+ // their per-script font prefs. This code can possibly be removed later if
+ // users can easily access per-script font prefs (e.g., via the extensions
+ // workflow), or the problem turns out to not be really critical after all.
if (!StartsWithASCII(locale, pref.native_locale, false)) {
prefs->RegisterLocalizedStringPref(pref.pref_name,
pref.resource_id,
diff --git a/chrome/browser/ui/prefs/prefs_tab_helper_browsertest.cc b/chrome/browser/ui/prefs/prefs_tab_helper_browsertest.cc
index 890a33a..ba7a54f 100644
--- a/chrome/browser/ui/prefs/prefs_tab_helper_browsertest.cc
+++ b/chrome/browser/ui/prefs/prefs_tab_helper_browsertest.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -14,9 +14,17 @@
class PrefsTabHelperBrowserTest : public InProcessBrowserTest {
protected:
- virtual bool SetUpUserDataDirectory() OVERRIDE {
+ virtual FilePath GetPreferencesFilePath() {
FilePath test_data_directory;
PathService::Get(chrome::DIR_TEST_DATA, &test_data_directory);
+ return test_data_directory
+ .AppendASCII("profiles")
+ .AppendASCII("webkit_global_migration")
+ .AppendASCII("Default")
+ .Append(chrome::kPreferencesFilename);
+ }
+
+ virtual bool SetUpUserDataDirectory() OVERRIDE {
FilePath user_data_directory;
PathService::Get(chrome::DIR_USER_DATA, &user_data_directory);
FilePath default_profile = user_data_directory.AppendASCII("Default");
@@ -24,12 +32,7 @@ class PrefsTabHelperBrowserTest : public InProcessBrowserTest {
LOG(ERROR) << "Can't create " << default_profile.MaybeAsASCII();
return false;
}
- FilePath non_global_pref_file;
- non_global_pref_file = test_data_directory
- .AppendASCII("profiles")
- .AppendASCII("webkit_global_migration")
- .AppendASCII("Default")
- .Append(chrome::kPreferencesFilename);
+ FilePath non_global_pref_file = GetPreferencesFilePath();
if (!file_util::PathExists(non_global_pref_file)) {
LOG(ERROR) << "Doesn't exist " << non_global_pref_file.MaybeAsASCII();
return false;
@@ -52,6 +55,10 @@ class PrefsTabHelperBrowserTest : public InProcessBrowserTest {
}
};
+// This tests migration like:
+// webkit.webprefs.default_charset -> webkit.webprefs.global.default_charset
+// This was needed for per-tab prefs, which have since been removed. So
+// eventually this migration will be replaced with the reverse migration.
IN_PROC_BROWSER_TEST_F(PrefsTabHelperBrowserTest, NonGlobalPrefsAreMigrated) {
PrefService* prefs = browser()->profile()->GetPrefs();
@@ -60,12 +67,6 @@ IN_PROC_BROWSER_TEST_F(PrefsTabHelperBrowserTest, NonGlobalPrefsAreMigrated) {
EXPECT_EQ(NULL, prefs->FindPreference(prefs::kWebKitDefaultFixedFontSize));
EXPECT_EQ(NULL, prefs->FindPreference(prefs::kWebKitMinimumFontSize));
EXPECT_EQ(NULL, prefs->FindPreference(prefs::kWebKitMinimumLogicalFontSize));
- EXPECT_EQ(NULL, prefs->FindPreference(prefs::kWebKitCursiveFontFamily));
- EXPECT_EQ(NULL, prefs->FindPreference(prefs::kWebKitFantasyFontFamily));
- EXPECT_EQ(NULL, prefs->FindPreference(prefs::kWebKitFixedFontFamily));
- EXPECT_EQ(NULL, prefs->FindPreference(prefs::kWebKitSansSerifFontFamily));
- EXPECT_EQ(NULL, prefs->FindPreference(prefs::kWebKitSerifFontFamily));
- EXPECT_EQ(NULL, prefs->FindPreference(prefs::kWebKitStandardFontFamily));
EXPECT_EQ("ISO-8859-1", prefs->GetString(prefs::kGlobalDefaultCharset));
EXPECT_EQ(42, prefs->GetInteger(prefs::kWebKitGlobalDefaultFontSize));
@@ -74,16 +75,78 @@ IN_PROC_BROWSER_TEST_F(PrefsTabHelperBrowserTest, NonGlobalPrefsAreMigrated) {
EXPECT_EQ(42, prefs->GetInteger(prefs::kWebKitGlobalMinimumFontSize));
EXPECT_EQ(42,
prefs->GetInteger(prefs::kWebKitGlobalMinimumLogicalFontSize));
+};
+
+// This tests migration like:
+// webkit.webprefs.standard_font_family -> webkit.webprefs.fonts.standard.Zyyy
+// This migration moves the formerly "non-per-script" font prefs into the
+// per-script font maps, as the entry for "Common" script (Zyyy is the ISO 15924
+// script code for the Common script).
+IN_PROC_BROWSER_TEST_F(PrefsTabHelperBrowserTest, PrefsAreMigratedToFontMap) {
+ PrefService* prefs = browser()->profile()->GetPrefs();
+
+ EXPECT_EQ(NULL, prefs->FindPreference(prefs::kWebKitOldCursiveFontFamily));
+ EXPECT_EQ(NULL, prefs->FindPreference(prefs::kWebKitOldFantasyFontFamily));
+ EXPECT_EQ(NULL, prefs->FindPreference(prefs::kWebKitOldFixedFontFamily));
+ EXPECT_EQ(NULL, prefs->FindPreference(prefs::kWebKitOldSansSerifFontFamily));
+ EXPECT_EQ(NULL, prefs->FindPreference(prefs::kWebKitOldSerifFontFamily));
+ EXPECT_EQ(NULL, prefs->FindPreference(prefs::kWebKitOldStandardFontFamily));
EXPECT_EQ("CursiveFontFamily",
- prefs->GetString(prefs::kWebKitGlobalCursiveFontFamily));
+ prefs->GetString(prefs::kWebKitCursiveFontFamily));
EXPECT_EQ("FantasyFontFamily",
- prefs->GetString(prefs::kWebKitGlobalFantasyFontFamily));
+ prefs->GetString(prefs::kWebKitFantasyFontFamily));
EXPECT_EQ("FixedFontFamily",
- prefs->GetString(prefs::kWebKitGlobalFixedFontFamily));
+ prefs->GetString(prefs::kWebKitFixedFontFamily));
EXPECT_EQ("SansSerifFontFamily",
- prefs->GetString(prefs::kWebKitGlobalSansSerifFontFamily));
+ prefs->GetString(prefs::kWebKitSansSerifFontFamily));
EXPECT_EQ("SerifFontFamily",
- prefs->GetString(prefs::kWebKitGlobalSerifFontFamily));
+ prefs->GetString(prefs::kWebKitSerifFontFamily));
EXPECT_EQ("StandardFontFamily",
- prefs->GetString(prefs::kWebKitGlobalStandardFontFamily));
-}
+ prefs->GetString(prefs::kWebKitStandardFontFamily));
+};
+
+class PrefsTabHelperBrowserTest2 : public PrefsTabHelperBrowserTest {
+ protected:
+ virtual FilePath GetPreferencesFilePath() OVERRIDE {
+ FilePath test_data_directory;
+ PathService::Get(chrome::DIR_TEST_DATA, &test_data_directory);
+ return test_data_directory
+ .AppendASCII("profiles")
+ .AppendASCII("webkit_global_reverse_migration")
+ .AppendASCII("Default")
+ .Append(chrome::kPreferencesFilename);
+ }
+};
+
+// This tests migration like:
+// webkit.webprefs.global.standard_font_family ->
+// webkit.webprefs.fonts.standard.Zyyy
+// This undoes the migration to "global" names (originally done for the per-tab
+// pref mechanism, which has since been removed). In addition, it moves the
+// formerly "non-per-script" font prefs into the per-script font maps, as
+// described in the comment for PrefsAreMigratedToFontMap.
+IN_PROC_BROWSER_TEST_F(PrefsTabHelperBrowserTest2, GlobalPrefsAreMigrated) {
+ PrefService* prefs = browser()->profile()->GetPrefs();
+
+ EXPECT_EQ(NULL, prefs->FindPreference(prefs::kWebKitGlobalCursiveFontFamily));
+ EXPECT_EQ(NULL, prefs->FindPreference(prefs::kWebKitGlobalFantasyFontFamily));
+ EXPECT_EQ(NULL, prefs->FindPreference(prefs::kWebKitGlobalFixedFontFamily));
+ EXPECT_EQ(NULL,
+ prefs->FindPreference(prefs::kWebKitGlobalSansSerifFontFamily));
+ EXPECT_EQ(NULL, prefs->FindPreference(prefs::kWebKitGlobalSerifFontFamily));
+ EXPECT_EQ(NULL,
+ prefs->FindPreference(prefs::kWebKitGlobalStandardFontFamily));
+
+ EXPECT_EQ("CursiveFontFamily",
+ prefs->GetString(prefs::kWebKitCursiveFontFamily));
+ EXPECT_EQ("FantasyFontFamily",
+ prefs->GetString(prefs::kWebKitFantasyFontFamily));
+ EXPECT_EQ("FixedFontFamily",
+ prefs->GetString(prefs::kWebKitFixedFontFamily));
+ EXPECT_EQ("SansSerifFontFamily",
+ prefs->GetString(prefs::kWebKitSansSerifFontFamily));
+ EXPECT_EQ("SerifFontFamily",
+ prefs->GetString(prefs::kWebKitSerifFontFamily));
+ EXPECT_EQ("StandardFontFamily",
+ prefs->GetString(prefs::kWebKitStandardFontFamily));
+};
diff --git a/chrome/browser/ui/webui/options2/font_settings_handler2.cc b/chrome/browser/ui/webui/options2/font_settings_handler2.cc
index 1fc18fc..338f285 100644
--- a/chrome/browser/ui/webui/options2/font_settings_handler2.cc
+++ b/chrome/browser/ui/webui/options2/font_settings_handler2.cc
@@ -106,12 +106,12 @@ void FontSettingsHandler::RegisterMessages() {
FontSettingsUtilities::ValidateSavedFonts(pref_service);
// Register for preferences that we need to observe manually.
- standard_font_.Init(prefs::kWebKitGlobalStandardFontFamily,
+ standard_font_.Init(prefs::kWebKitStandardFontFamily,
pref_service, this);
- serif_font_.Init(prefs::kWebKitGlobalSerifFontFamily, pref_service, this);
- sans_serif_font_.Init(prefs::kWebKitGlobalSansSerifFontFamily,
+ serif_font_.Init(prefs::kWebKitSerifFontFamily, pref_service, this);
+ sans_serif_font_.Init(prefs::kWebKitSansSerifFontFamily,
pref_service, this);
- fixed_font_.Init(prefs::kWebKitGlobalFixedFontFamily, pref_service, this);
+ fixed_font_.Init(prefs::kWebKitFixedFontFamily, pref_service, this);
font_encoding_.Init(prefs::kGlobalDefaultCharset, pref_service, this);
default_font_size_.Init(prefs::kWebKitGlobalDefaultFontSize,
pref_service, this);
@@ -196,14 +196,14 @@ void FontSettingsHandler::Observe(int type,
const content::NotificationDetails& details) {
if (type == chrome::NOTIFICATION_PREF_CHANGED) {
std::string* pref_name = content::Details<std::string>(details).ptr();
- if (*pref_name == prefs::kWebKitGlobalStandardFontFamily) {
+ if (*pref_name == prefs::kWebKitStandardFontFamily) {
SetUpStandardFontSample();
- } else if (*pref_name == prefs::kWebKitGlobalSerifFontFamily) {
+ } else if (*pref_name == prefs::kWebKitSerifFontFamily) {
SetUpSerifFontSample();
- } else if (*pref_name == prefs::kWebKitGlobalSansSerifFontFamily) {
+ } else if (*pref_name == prefs::kWebKitSansSerifFontFamily) {
SetUpSansSerifFontSample();
- } else if (*pref_name == prefs::kWebKitGlobalFixedFontFamily ||
- *pref_name == prefs::kWebKitGlobalDefaultFixedFontSize) {
+ } else if (*pref_name == prefs::kWebKitFixedFontFamily ||
+ *pref_name == prefs::kWebKitDefaultFixedFontSize) {
SetUpFixedFontSample();
} else if (*pref_name == prefs::kWebKitGlobalDefaultFontSize) {
SetUpStandardFontSample();
diff --git a/chrome/browser/ui/webui/options2/font_settings_utils2_mac.mm b/chrome/browser/ui/webui/options2/font_settings_utils2_mac.mm
index 1f96b9b..888fd6e 100644
--- a/chrome/browser/ui/webui/options2/font_settings_utils2_mac.mm
+++ b/chrome/browser/ui/webui/options2/font_settings_utils2_mac.mm
@@ -34,9 +34,9 @@ static void ValidateFontFamily(PrefService* prefs,
// static
void FontSettingsUtilities::ValidateSavedFonts(PrefService* prefs) {
- ValidateFontFamily(prefs, prefs::kWebKitGlobalSerifFontFamily);
- ValidateFontFamily(prefs, prefs::kWebKitGlobalSansSerifFontFamily);
- ValidateFontFamily(prefs, prefs::kWebKitGlobalFixedFontFamily);
+ ValidateFontFamily(prefs, prefs::kWebKitSerifFontFamily);
+ ValidateFontFamily(prefs, prefs::kWebKitSansSerifFontFamily);
+ ValidateFontFamily(prefs, prefs::kWebKitFixedFontFamily);
}
} // namespace options2
diff --git a/chrome/common/extensions/api/experimental_font_settings.json b/chrome/common/extensions/api/experimental_font_settings.json
index b2ed78d..749083f 100644
--- a/chrome/common/extensions/api/experimental_font_settings.json
+++ b/chrome/common/extensions/api/experimental_font_settings.json
@@ -27,9 +27,9 @@
"enum": [ "Arab", "Armn", "Beng", "Cans", "Cher", "Cyrl", "Deva", "Ethi", "Geor",
"Grek", "Gujr", "Guru", "Hang", "Hans", "Hant", "Hebr", "Hrkt", "Knda",
"Khmr", "Laoo", "Mlym", "Mong", "Mymr", "Orya", "Sinh", "Taml", "Telu",
- "Thaa", "Thai", "Tibt", "Yiii"
+ "Thaa", "Thai", "Tibt", "Yiii", "Zyyy"
],
- "description": "An ISO 15924 script code."
+ "description": "An ISO 15924 script code. The default, or global, script is represented by script code \"Zyyy\"."
},
{
"id": "GenericFamily",
@@ -82,7 +82,7 @@
"properties": {
"script": {
"$ref": "ScriptCode",
- "description": "The script for which the font should be retrieved. If omitted, the font for the global script is retrieved.",
+ "description": "The script for which the font should be retrieved. If omitted, the font setting for the global script (script code \"Zyyy\") is retrieved.",
"optional": true
},
"genericFamily": {
@@ -124,7 +124,7 @@
"properties": {
"script": {
"$ref": "ScriptCode",
- "description": "The script code which the font should be set. If omitted, the font for the global script is set.",
+ "description": "The script code which the font should be set. If omitted, the font setting for the global script (script code \"Zyyy\") is set.",
"optional": true
},
"genericFamily": {
@@ -475,7 +475,7 @@
"fontName": { "type": "string" },
"script": {
"$ref": "ScriptCode",
- "description": "The script code for which the font setting has changed. If omitted, the global script font setting has changed.",
+ "description": "The script code for which the font setting has changed.",
"optional": true
},
"genericFamily": {
diff --git a/chrome/common/extensions/docs/experimental.fontSettings.html b/chrome/common/extensions/docs/experimental.fontSettings.html
index 3c639c0..b339467 100644
--- a/chrome/common/extensions/docs/experimental.fontSettings.html
+++ b/chrome/common/extensions/docs/experimental.fontSettings.html
@@ -1393,7 +1393,7 @@ directory. For other examples and for help in viewing the source code, see
</div>
</em>
</dt>
- <dd>The script for which the font should be retrieved. If omitted, the font for the global script is retrieved.</dd>
+ <dd>The script for which the font should be retrieved. If omitted, the font setting for the global script (script code "Zyyy") is retrieved.</dd>
<!-- OBJECT PROPERTIES -->
<!-- OBJECT METHODS -->
<!-- OBJECT EVENT FIELDS -->
@@ -2201,7 +2201,7 @@ directory. For other examples and for help in viewing the source code, see
</div>
</em>
</dt>
- <dd>The script code which the font should be set. If omitted, the font for the global script is set.</dd>
+ <dd>The script code which the font should be set. If omitted, the font setting for the global script (script code "Zyyy") is set.</dd>
<!-- OBJECT PROPERTIES -->
<!-- OBJECT METHODS -->
<!-- OBJECT EVENT FIELDS -->
@@ -2800,7 +2800,7 @@ directory. For other examples and for help in viewing the source code, see
</div>
</em>
</dt>
- <dd>The script code for which the font setting has changed. If omitted, the global script font setting has changed.</dd>
+ <dd>The script code for which the font setting has changed.</dd>
<!-- OBJECT PROPERTIES -->
<!-- OBJECT METHODS -->
<!-- OBJECT EVENT FIELDS -->
@@ -3061,14 +3061,14 @@ directory. For other examples and for help in viewing the source code, see
<span id="typeTemplate">
<span>
<span>string</span>
- <span>["Arab", "Armn", "Beng", "Cans", "Cher", "Cyrl", "Deva", "Ethi", "Geor", "Grek", "Gujr", "Guru", "Hang", "Hans", "Hant", "Hebr", "Hrkt", "Knda", "Khmr", "Laoo", "Mlym", "Mong", "Mymr", "Orya", "Sinh", "Taml", "Telu", "Thaa", "Thai", "Tibt", "Yiii"]</span>
+ <span>["Arab", "Armn", "Beng", "Cans", "Cher", "Cyrl", "Deva", "Ethi", "Geor", "Grek", "Gujr", "Guru", "Hang", "Hans", "Hant", "Hebr", "Hrkt", "Knda", "Khmr", "Laoo", "Mlym", "Mong", "Mymr", "Orya", "Sinh", "Taml", "Telu", "Thaa", "Thai", "Tibt", "Yiii", "Zyyy"]</span>
</span>
</span>
)
</div>
</em>
</dt>
- <dd>An ISO 15924 script code.</dd>
+ <dd>An ISO 15924 script code. The default, or global, script is represented by script code "Zyyy".</dd>
<!-- OBJECT PROPERTIES -->
<!-- OBJECT METHODS -->
<!-- OBJECT EVENT FIELDS -->
diff --git a/chrome/common/pref_names.cc b/chrome/common/pref_names.cc
index b876f21d..30de06e 100644
--- a/chrome/common/pref_names.cc
+++ b/chrome/common/pref_names.cc
@@ -129,6 +129,16 @@ const char kWebKitGlobalCursiveFontFamily[] =
"webkit.webprefs.global.cursive_font_family";
const char kWebKitGlobalFantasyFontFamily[] =
"webkit.webprefs.global.fantasy_font_family";
+const char kWebKitOldStandardFontFamily[] =
+ "webkit.webprefs.standard_font_family";
+const char kWebKitOldFixedFontFamily[] = "webkit.webprefs.fixed_font_family";
+const char kWebKitOldSerifFontFamily[] = "webkit.webprefs.serif_font_family";
+const char kWebKitOldSansSerifFontFamily[] =
+ "webkit.webprefs.sansserif_font_family";
+const char kWebKitOldCursiveFontFamily[] =
+ "webkit.webprefs.cursive_font_family";
+const char kWebKitOldFantasyFontFamily[] =
+ "webkit.webprefs.fantasy_font_family";
const char kWebKitStandardFontFamilyMap[] =
"webkit.webprefs.fonts.standard";
const char kWebKitFixedFontFamilyMap[] =
@@ -148,7 +158,7 @@ const char* const kWebKitScriptsForFontFamilyMaps[] = {
"Arab", "Armn", "Beng", "Cans", "Cher", "Cyrl", "Deva", "Ethi", "Geor",
"Grek", "Gujr", "Guru", "Hang", "Hans", "Hant", "Hebr", "Hrkt", "Knda",
"Khmr", "Laoo", "Mlym", "Mong", "Mymr", "Orya", "Sinh", "Taml", "Telu",
- "Thaa", "Thai", "Tibt", "Yiii"
+ "Thaa", "Thai", "Tibt", "Yiii", "Zyyy"
};
const size_t kWebKitScriptsForFontFamilyMapsLength =
@@ -229,15 +239,15 @@ const char kWebKitAllowDisplayingInsecureContent[] =
const char kWebKitAllowRunningInsecureContent[] =
"webkit.webprefs.allow_running_insecure_content";
-// Settings below can be overridden for each tab individually.
const char kDefaultCharset[] = "intl.charset_default";
-const char kWebKitStandardFontFamily[] = "webkit.webprefs.standard_font_family";
-const char kWebKitFixedFontFamily[] = "webkit.webprefs.fixed_font_family";
-const char kWebKitSerifFontFamily[] = "webkit.webprefs.serif_font_family";
+const char kWebKitCommonScript[] = "Zyyy";
+const char kWebKitStandardFontFamily[] = "webkit.webprefs.fonts.standard.Zyyy";
+const char kWebKitFixedFontFamily[] = "webkit.webprefs.fonts.fixed.Zyyy";
+const char kWebKitSerifFontFamily[] = "webkit.webprefs.fonts.serif.Zyyy";
const char kWebKitSansSerifFontFamily[] =
- "webkit.webprefs.sansserif_font_family";
-const char kWebKitCursiveFontFamily[] = "webkit.webprefs.cursive_font_family";
-const char kWebKitFantasyFontFamily[] = "webkit.webprefs.fantasy_font_family";
+ "webkit.webprefs.fonts.sansserif.Zyyy";
+const char kWebKitCursiveFontFamily[] = "webkit.webprefs.fonts.cursive.Zyyy";
+const char kWebKitFantasyFontFamily[] = "webkit.webprefs.fonts.fantasy.Zyyy";
const char kWebKitDefaultFontSize[] = "webkit.webprefs.default_font_size";
const char kWebKitDefaultFixedFontSize[] =
"webkit.webprefs.default_fixed_font_size";
diff --git a/chrome/common/pref_names.h b/chrome/common/pref_names.h
index b355990..b916840 100644
--- a/chrome/common/pref_names.h
+++ b/chrome/common/pref_names.h
@@ -37,23 +37,33 @@ extern const char kApplicationLocaleAccepted[];
extern const char kOwnerLocale[];
#endif
+// Obselete keys, kept only for migration code to the new keys. See
+// http://crbug.com/123812
+extern const char kWebKitGlobalStandardFontFamily[];
+extern const char kWebKitGlobalFixedFontFamily[];
+extern const char kWebKitGlobalSerifFontFamily[];
+extern const char kWebKitGlobalSansSerifFontFamily[];
+extern const char kWebKitGlobalCursiveFontFamily[];
+extern const char kWebKitGlobalFantasyFontFamily[];
+extern const char kWebKitOldStandardFontFamily[];
+extern const char kWebKitOldFixedFontFamily[];
+extern const char kWebKitOldSerifFontFamily[];
+extern const char kWebKitOldSansSerifFontFamily[];
+extern const char kWebKitOldCursiveFontFamily[];
+extern const char kWebKitOldFantasyFontFamily[];
+
extern const char kGlobalDefaultCharset[];
extern const char kDefaultCharset[];
extern const char kAcceptLanguages[];
extern const char kStaticEncodings[];
extern const char kShowBookmarkBar[];
extern const char kBookmarkEditorExpandedNodes[];
-extern const char kWebKitGlobalStandardFontFamily[];
+extern const char kWebKitCommonScript[];
extern const char kWebKitStandardFontFamily[];
-extern const char kWebKitGlobalFixedFontFamily[];
extern const char kWebKitFixedFontFamily[];
-extern const char kWebKitGlobalSerifFontFamily[];
extern const char kWebKitSerifFontFamily[];
-extern const char kWebKitGlobalSansSerifFontFamily[];
extern const char kWebKitSansSerifFontFamily[];
-extern const char kWebKitGlobalCursiveFontFamily[];
extern const char kWebKitCursiveFontFamily[];
-extern const char kWebKitGlobalFantasyFontFamily[];
extern const char kWebKitFantasyFontFamily[];
extern const char kWebKitStandardFontFamilyMap[];
extern const char kWebKitFixedFontFamilyMap[];
diff --git a/chrome/test/data/extensions/api_test/font_settings/standard/test.js b/chrome/test/data/extensions/api_test/font_settings/standard/test.js
index 08612ee..f6fdd54 100644
--- a/chrome/test/data/extensions/api_test/font_settings/standard/test.js
+++ b/chrome/test/data/extensions/api_test/font_settings/standard/test.js
@@ -49,6 +49,7 @@ chrome.test.runTests([
chrome.test.assertEq({
genericFamily: genericFamily,
fontName: fontName,
+ script: 'Zyyy',
levelOfControl: CONTROLLED_BY_THIS_EXTENSION
}, details);
});
@@ -120,7 +121,7 @@ chrome.test.runTests([
'fontName and localizedName properties.';
fs.getFontList(chrome.test.callbackPass(function(value) {
chrome.test.assertTrue(value.length > 0,
- "Font list is not expected to be empty.");
+ 'Font list is not expected to be empty.');
chrome.test.assertEq('string', typeof(value[0].fontName), message);
chrome.test.assertEq('string', typeof(value[0].localizedName), message);
}));
@@ -205,11 +206,13 @@ chrome.test.runTests([
// This test may fail on Windows if the font is not installed on the
// system. See crbug.com/122303
function clearGlobalFont() {
+ var script = 'Zyyy';
var genericFamily = 'sansserif';
var fontName = 'Arial';
chrome.test.listenOnce(fs.onFontChanged, function(details) {
chrome.test.assertEq({
+ script: script,
genericFamily: genericFamily,
fontName: fontName,
levelOfControl: CONTROLLABLE_BY_THIS_EXTENSION
diff --git a/chrome/test/data/profiles/webkit_global_reverse_migration/Default/Preferences b/chrome/test/data/profiles/webkit_global_reverse_migration/Default/Preferences
new file mode 100644
index 0000000..73d50d6
--- /dev/null
+++ b/chrome/test/data/profiles/webkit_global_reverse_migration/Default/Preferences
@@ -0,0 +1,14 @@
+{
+ "webkit": {
+ "webprefs": {
+ "global": {
+ "standard_font_family": "StandardFontFamily",
+ "fixed_font_family": "FixedFontFamily",
+ "serif_font_family": "SerifFontFamily",
+ "sansserif_font_family": "SansSerifFontFamily",
+ "cursive_font_family": "CursiveFontFamily",
+ "fantasy_font_family": "FantasyFontFamily"
+ }
+ }
+ }
+}
diff --git a/content/common/view_messages.h b/content/common/view_messages.h
index 84b2b34..582e8d2 100644
--- a/content/common/view_messages.h
+++ b/content/common/view_messages.h
@@ -128,12 +128,6 @@ IPC_STRUCT_TRAITS_BEGIN(WebKit::WebScreenInfo)
IPC_STRUCT_TRAITS_END()
IPC_STRUCT_TRAITS_BEGIN(webkit_glue::WebPreferences)
- IPC_STRUCT_TRAITS_MEMBER(standard_font_family)
- IPC_STRUCT_TRAITS_MEMBER(fixed_font_family)
- IPC_STRUCT_TRAITS_MEMBER(serif_font_family)
- IPC_STRUCT_TRAITS_MEMBER(sans_serif_font_family)
- IPC_STRUCT_TRAITS_MEMBER(cursive_font_family)
- IPC_STRUCT_TRAITS_MEMBER(fantasy_font_family)
IPC_STRUCT_TRAITS_MEMBER(standard_font_family_map)
IPC_STRUCT_TRAITS_MEMBER(fixed_font_family_map)
IPC_STRUCT_TRAITS_MEMBER(serif_font_family_map)
diff --git a/ppapi/proxy/ppapi_messages.h b/ppapi/proxy/ppapi_messages.h
index 493352d6..b96f13d 100644
--- a/ppapi/proxy/ppapi_messages.h
+++ b/ppapi/proxy/ppapi_messages.h
@@ -123,10 +123,10 @@ IPC_STRUCT_TRAITS_BEGIN(ppapi::ViewData)
IPC_STRUCT_TRAITS_END()
IPC_STRUCT_TRAITS_BEGIN(ppapi::Preferences)
- IPC_STRUCT_TRAITS_MEMBER(standard_font_family)
- IPC_STRUCT_TRAITS_MEMBER(fixed_font_family)
- IPC_STRUCT_TRAITS_MEMBER(serif_font_family)
- IPC_STRUCT_TRAITS_MEMBER(sans_serif_font_family)
+ IPC_STRUCT_TRAITS_MEMBER(standard_font_family_map)
+ IPC_STRUCT_TRAITS_MEMBER(fixed_font_family_map)
+ IPC_STRUCT_TRAITS_MEMBER(serif_font_family_map)
+ IPC_STRUCT_TRAITS_MEMBER(sans_serif_font_family_map)
IPC_STRUCT_TRAITS_MEMBER(default_font_size)
IPC_STRUCT_TRAITS_MEMBER(default_fixed_font_size)
IPC_STRUCT_TRAITS_END()
diff --git a/ppapi/shared_impl/ppapi_preferences.cc b/ppapi/shared_impl/ppapi_preferences.cc
index 8622640..14c89f0 100644
--- a/ppapi/shared_impl/ppapi_preferences.cc
+++ b/ppapi/shared_impl/ppapi_preferences.cc
@@ -4,8 +4,6 @@
#include "ppapi/shared_impl/ppapi_preferences.h"
-#include "webkit/glue/webpreferences.h"
-
namespace ppapi {
Preferences::Preferences()
@@ -15,10 +13,10 @@ Preferences::Preferences()
}
Preferences::Preferences(const webkit_glue::WebPreferences& prefs)
- : standard_font_family(prefs.standard_font_family),
- fixed_font_family(prefs.fixed_font_family),
- serif_font_family(prefs.serif_font_family),
- sans_serif_font_family(prefs.sans_serif_font_family),
+ : standard_font_family_map(prefs.standard_font_family_map),
+ fixed_font_family_map(prefs.fixed_font_family_map),
+ serif_font_family_map(prefs.serif_font_family_map),
+ sans_serif_font_family_map(prefs.sans_serif_font_family_map),
default_font_size(prefs.default_font_size),
default_fixed_font_size(prefs.default_fixed_font_size),
// Pepper 3D support keys off of WebGL which is what the GPU blacklist
diff --git a/ppapi/shared_impl/ppapi_preferences.h b/ppapi/shared_impl/ppapi_preferences.h
index 66b2051..008811f 100644
--- a/ppapi/shared_impl/ppapi_preferences.h
+++ b/ppapi/shared_impl/ppapi_preferences.h
@@ -5,8 +5,8 @@
#ifndef PPAPI_SHARED_IMPL_PPAPI_PREFERENCES_H_
#define PPAPI_SHARED_IMPL_PPAPI_PREFERENCES_H_
-#include "base/string16.h"
#include "ppapi/shared_impl/ppapi_shared_export.h"
+#include "webkit/glue/webpreferences.h"
namespace webkit_glue {
struct WebPreferences;
@@ -20,10 +20,10 @@ struct PPAPI_SHARED_EXPORT Preferences {
explicit Preferences(const webkit_glue::WebPreferences& prefs);
~Preferences();
- string16 standard_font_family;
- string16 fixed_font_family;
- string16 serif_font_family;
- string16 sans_serif_font_family;
+ webkit_glue::WebPreferences::ScriptFontFamilyMap standard_font_family_map;
+ webkit_glue::WebPreferences::ScriptFontFamilyMap fixed_font_family_map;
+ webkit_glue::WebPreferences::ScriptFontFamilyMap serif_font_family_map;
+ webkit_glue::WebPreferences::ScriptFontFamilyMap sans_serif_font_family_map;
int default_font_size;
int default_fixed_font_size;
diff --git a/ppapi/shared_impl/private/ppb_browser_font_trusted_shared.cc b/ppapi/shared_impl/private/ppb_browser_font_trusted_shared.cc
index 0d73691..e5414b3 100644
--- a/ppapi/shared_impl/private/ppb_browser_font_trusted_shared.cc
+++ b/ppapi/shared_impl/private/ppb_browser_font_trusted_shared.cc
@@ -37,6 +37,20 @@ namespace ppapi {
namespace {
+// Same as WebPreferences::kCommonScript. I'd use that directly here, but get an
+// undefined reference linker error.
+const char kCommonScript[] = "Zyyy";
+
+string16 GetFontFromMap(
+ const webkit_glue::WebPreferences::ScriptFontFamilyMap& map,
+ const std::string& script) {
+ webkit_glue::WebPreferences::ScriptFontFamilyMap::const_iterator it =
+ map.find(script);
+ if (it != map.end())
+ return it->second;
+ return string16();
+}
+
bool PPTextRunToWebTextRun(const PP_BrowserFont_Trusted_TextRun& text,
WebTextRun* run) {
StringVar* text_string = StringVar::FromPPVar(text.text);
@@ -88,17 +102,21 @@ WebFontDescription PPFontDescToWebFontDesc(
// Resolve the generic family.
switch (font.family) {
case PP_BROWSERFONT_TRUSTED_FAMILY_SERIF:
- resolved_family = prefs.serif_font_family;
+ resolved_family = GetFontFromMap(prefs.serif_font_family_map,
+ kCommonScript);
break;
case PP_BROWSERFONT_TRUSTED_FAMILY_SANSSERIF:
- resolved_family = prefs.sans_serif_font_family;
+ resolved_family = GetFontFromMap(prefs.sans_serif_font_family_map,
+ kCommonScript);
break;
case PP_BROWSERFONT_TRUSTED_FAMILY_MONOSPACE:
- resolved_family = prefs.fixed_font_family;
+ resolved_family = GetFontFromMap(prefs.fixed_font_family_map,
+ kCommonScript);
break;
case PP_BROWSERFONT_TRUSTED_FAMILY_DEFAULT:
default:
- resolved_family = prefs.standard_font_family;
+ resolved_family = GetFontFromMap(prefs.standard_font_family_map,
+ kCommonScript);
break;
}
} else {
@@ -115,7 +133,8 @@ WebFontDescription PPFontDescToWebFontDesc(
// level to detect if the requested font is fixed width, so we only apply
// the alternate font size to the default fixed font family.
if (StringToLowerASCII(resolved_family) ==
- StringToLowerASCII(prefs.fixed_font_family))
+ StringToLowerASCII(GetFontFromMap(prefs.fixed_font_family_map,
+ kCommonScript)))
result.size = static_cast<float>(prefs.default_fixed_font_size);
else
result.size = static_cast<float>(prefs.default_font_size);
@@ -314,4 +333,3 @@ void PPB_BrowserFont_Trusted_Shared::DrawTextToCanvas(
}
} // namespace ppapi
-
diff --git a/ppapi/shared_impl/private/ppb_font_shared.cc b/ppapi/shared_impl/private/ppb_font_shared.cc
index 36c9ed2..e71aaf5 100644
--- a/ppapi/shared_impl/private/ppb_font_shared.cc
+++ b/ppapi/shared_impl/private/ppb_font_shared.cc
@@ -40,6 +40,20 @@ namespace ppapi {
namespace {
+// Same as WebPreferences::kCommonScript. I'd use that directly here, but get an
+// undefined reference linker error.
+const char kCommonScript[] = "Zyyy";
+
+string16 GetFontFromMap(
+ const webkit_glue::WebPreferences::ScriptFontFamilyMap& map,
+ const std::string& script) {
+ webkit_glue::WebPreferences::ScriptFontFamilyMap::const_iterator it =
+ map.find(script);
+ if (it != map.end())
+ return it->second;
+ return string16();
+}
+
// Converts the given PP_TextRun to a TextRun, returning true on success.
// False means the input was invalid.
bool PPTextRunToTextRun(const PP_TextRun_Dev* run,
@@ -92,17 +106,21 @@ WebFontDescription PPFontDescToWebFontDesc(const PP_FontDescription_Dev& font,
// Resolve the generic family.
switch (font.family) {
case PP_FONTFAMILY_SERIF:
- resolved_family = prefs.serif_font_family;
+ resolved_family = GetFontFromMap(prefs.serif_font_family_map,
+ kCommonScript);
break;
case PP_FONTFAMILY_SANSSERIF:
- resolved_family = prefs.sans_serif_font_family;
+ resolved_family = GetFontFromMap(prefs.sans_serif_font_family_map,
+ kCommonScript);
break;
case PP_FONTFAMILY_MONOSPACE:
- resolved_family = prefs.fixed_font_family;
+ resolved_family = GetFontFromMap(prefs.fixed_font_family_map,
+ kCommonScript);
break;
case PP_FONTFAMILY_DEFAULT:
default:
- resolved_family = prefs.standard_font_family;
+ resolved_family = GetFontFromMap(prefs.standard_font_family_map,
+ kCommonScript);
break;
}
} else {
@@ -119,7 +137,8 @@ WebFontDescription PPFontDescToWebFontDesc(const PP_FontDescription_Dev& font,
// level to detect if the requested font is fixed width, so we only apply
// the alternate font size to the default fixed font family.
if (StringToLowerASCII(resolved_family) ==
- StringToLowerASCII(prefs.fixed_font_family))
+ StringToLowerASCII(GetFontFromMap(prefs.fixed_font_family_map,
+ kCommonScript)))
result.size = static_cast<float>(prefs.default_fixed_font_size);
else
result.size = static_cast<float>(prefs.default_font_size);
@@ -401,4 +420,3 @@ int32_t PPB_Font_Shared::PixelOffsetForCharacter(const PP_TextRun_Dev* text,
}
} // namespace ppapi
-
diff --git a/webkit/glue/webpreferences.cc b/webkit/glue/webpreferences.cc
index 359e0b0..40d15aa 100644
--- a/webkit/glue/webpreferences.cc
+++ b/webkit/glue/webpreferences.cc
@@ -4,8 +4,6 @@
#include "webkit/glue/webpreferences.h"
-#include <unicode/uchar.h>
-
#include "base/string_util.h"
#include "base/utf_string_conversions.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebCompositor.h"
@@ -16,6 +14,7 @@
#include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebString.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebURL.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h"
+#include "unicode/uchar.h"
#include "webkit/glue/webkit_glue.h"
using WebKit::WebNetworkStateNotifier;
@@ -27,14 +26,11 @@ using WebKit::WebView;
namespace webkit_glue {
+// "Zyyy" is the ISO 15924 script code for undetermined script aka Common.
+const char WebPreferences::kCommonScript[] = "Zyyy";
+
WebPreferences::WebPreferences()
- : standard_font_family(ASCIIToUTF16("Times New Roman")),
- fixed_font_family(ASCIIToUTF16("Courier New")),
- serif_font_family(ASCIIToUTF16("Times New Roman")),
- sans_serif_font_family(ASCIIToUTF16("Arial")),
- cursive_font_family(ASCIIToUTF16("Script")),
- fantasy_font_family(), // Not sure what to use on Windows.
- default_font_size(16),
+ : default_font_size(16),
default_fixed_font_size(13),
minimum_font_size(0),
minimum_logical_font_size(6),
@@ -107,6 +103,18 @@ WebPreferences::WebPreferences()
per_tile_painting_enabled(false),
css_regions_enabled(false),
css_shaders_enabled(false) {
+ standard_font_family_map[kCommonScript] =
+ ASCIIToUTF16("Times New Roman");
+ fixed_font_family_map[kCommonScript] =
+ ASCIIToUTF16("Courier New");
+ serif_font_family_map[kCommonScript] =
+ ASCIIToUTF16("Times New Roman");
+ sans_serif_font_family_map[kCommonScript] =
+ ASCIIToUTF16("Arial");
+ cursive_font_family_map[kCommonScript] =
+ ASCIIToUTF16("Script");
+ fantasy_font_family_map[kCommonScript] =
+ ASCIIToUTF16("Impact");
}
WebPreferences::~WebPreferences() {
@@ -168,12 +176,6 @@ void ApplyFontsFromMap(const WebPreferences::ScriptFontFamilyMap& map,
void WebPreferences::Apply(WebView* web_view) const {
WebSettings* settings = web_view->settings();
- settings->setStandardFontFamily(standard_font_family);
- settings->setFixedFontFamily(fixed_font_family);
- settings->setSerifFontFamily(serif_font_family);
- settings->setSansSerifFontFamily(sans_serif_font_family);
- settings->setCursiveFontFamily(cursive_font_family);
- settings->setFantasyFontFamily(fantasy_font_family);
ApplyFontsFromMap(standard_font_family_map, setStandardFontFamilyWrapper,
settings);
ApplyFontsFromMap(fixed_font_family_map, setFixedFontFamilyWrapper, settings);
diff --git a/webkit/glue/webpreferences.h b/webkit/glue/webpreferences.h
index 05e0677..d00b5a2 100644
--- a/webkit/glue/webpreferences.h
+++ b/webkit/glue/webpreferences.h
@@ -11,6 +11,7 @@
#ifndef WEBKIT_GLUE_WEBPREFERENCES_H__
#define WEBKIT_GLUE_WEBPREFERENCES_H__
+#include <map>
#include <string>
#include <vector>
@@ -27,14 +28,13 @@ namespace webkit_glue {
struct WEBKIT_GLUE_EXPORT WebPreferences {
// Map of ISO 15924 four-letter script code to font family. For example,
// "Arab" to "My Arabic Font".
- typedef std::vector<std::pair<std::string, string16> > ScriptFontFamilyMap;
+ typedef std::map<std::string, string16> ScriptFontFamilyMap;
+
+ // The ISO 15924 script code for undetermined script aka Common. It's the
+ // default used on WebKit's side to get/set a font setting when no script is
+ // specified.
+ static const char kCommonScript[];
- string16 standard_font_family;
- string16 fixed_font_family;
- string16 serif_font_family;
- string16 sans_serif_font_family;
- string16 cursive_font_family;
- string16 fantasy_font_family;
ScriptFontFamilyMap standard_font_family_map;
ScriptFontFamilyMap fixed_font_family_map;
ScriptFontFamilyMap serif_font_family_map;
diff --git a/webkit/tools/test_shell/test_shell.cc b/webkit/tools/test_shell/test_shell.cc
index 07f57a6..e929405 100644
--- a/webkit/tools/test_shell/test_shell.cc
+++ b/webkit/tools/test_shell/test_shell.cc
@@ -301,13 +301,17 @@ void TestShell::ResetWebPreferences() {
*web_prefs_ = WebPreferences();
#if defined(OS_MACOSX)
- web_prefs_->serif_font_family = ASCIIToUTF16("Times");
- web_prefs_->cursive_font_family = ASCIIToUTF16("Apple Chancery");
- web_prefs_->fantasy_font_family = ASCIIToUTF16("Papyrus");
+ web_prefs_->serif_font_family_map[WebPreferences::kCommonScript] =
+ ASCIIToUTF16("Times");
+ web_prefs_->cursive_font_family_map[WebPreferences::kCommonScript] =
+ ASCIIToUTF16("Apple Chancery");
+ web_prefs_->fantasy_font_family_map[WebPreferences::kCommonScript] =
+ ASCIIToUTF16("Papyrus");
#else
// NOTE: case matters here, this must be 'times new roman', else
// some layout tests fail.
- web_prefs_->serif_font_family = ASCIIToUTF16("times new roman");
+ web_prefs_->serif_font_family_map[WebPreferences::kCommonScript] =
+ ASCIIToUTF16("times new roman");
// These two fonts are picked from the intersection of
// Win XP font list and Vista font list :
@@ -319,12 +323,17 @@ void TestShell::ResetWebPreferences() {
// They (especially Impact for fantasy) are not typical cursive
// and fantasy fonts, but it should not matter for layout tests
// as long as they're available.
- web_prefs_->cursive_font_family = ASCIIToUTF16("Comic Sans MS");
- web_prefs_->fantasy_font_family = ASCIIToUTF16("Impact");
+ web_prefs_->cursive_font_family_map[WebPreferences::kCommonScript] =
+ ASCIIToUTF16("Comic Sans MS");
+ web_prefs_->fantasy_font_family_map[WebPreferences::kCommonScript] =
+ ASCIIToUTF16("Impact");
#endif
- web_prefs_->standard_font_family = web_prefs_->serif_font_family;
- web_prefs_->fixed_font_family = ASCIIToUTF16("Courier");
- web_prefs_->sans_serif_font_family = ASCIIToUTF16("Helvetica");
+ web_prefs_->standard_font_family_map[WebPreferences::kCommonScript] =
+ web_prefs_->serif_font_family_map[WebPreferences::kCommonScript];
+ web_prefs_->fixed_font_family_map[WebPreferences::kCommonScript] =
+ ASCIIToUTF16("Courier");
+ web_prefs_->sans_serif_font_family_map[WebPreferences::kCommonScript] =
+ ASCIIToUTF16("Helvetica");
web_prefs_->default_encoding = "ISO-8859-1";
web_prefs_->default_font_size = 16;