зеркало из https://github.com/mozilla/gecko-dev.git
Font dialog regressions fix: Bug 283678 - Serif / Sans-serif pref ui doesn't work; Bug 283869 - crash after trying to change font prefs; Bug 283945 - empty font lists for some languages. r=ben. (patch from bug 283678)
This commit is contained in:
Родитель
77f519f3bc
Коммит
45f5128d83
|
@ -19,6 +19,7 @@
|
|||
#
|
||||
# Contributor(s):
|
||||
# Ben Goodger <ben@mozilla.org>
|
||||
# Asaf Romano <mozilla.mano@sent.com>
|
||||
#
|
||||
# Alternatively, the contents of this file may be used under the terms of
|
||||
# either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
|
@ -35,6 +36,7 @@
|
|||
# ***** END LICENSE BLOCK *****
|
||||
|
||||
|
||||
const kDefaultFontType = "font.default.%LANG%";
|
||||
const kFontNameFmtSerif = "font.name.serif.%LANG%";
|
||||
const kFontNameFmtSansSerif = "font.name.sans-serif.%LANG%";
|
||||
const kFontNameListFmtSerif = "font.name-list.serif.%LANG%";
|
||||
|
@ -53,8 +55,8 @@ var gContentPane = {
|
|||
_rebuildFonts: function ()
|
||||
{
|
||||
var langGroupPref = document.getElementById("font.language.group");
|
||||
var isSerifPref = document.getElementById("font.default");
|
||||
this._selectLanguageGroup(langGroupPref.value, isSerifPref.value == "serif");
|
||||
this._selectLanguageGroup(langGroupPref.value,
|
||||
this._readDefaultFontTypeForLanguage(langGroupPref.value) == "serif");
|
||||
},
|
||||
|
||||
_selectLanguageGroup: function (aLanguageGroup, aIsSerif)
|
||||
|
@ -98,6 +100,21 @@ var gContentPane = {
|
|||
}
|
||||
},
|
||||
|
||||
_readDefaultFontTypeForLanguage: function (aLanguageGroup)
|
||||
{
|
||||
var defaultFontTypePref = kDefaultFontType.replace(/%LANG%/, aLanguageGroup);
|
||||
var preference = document.getElementById(defaultFontTypePref);
|
||||
if (!preference) {
|
||||
preference = document.createElement("preference");
|
||||
preference.id = defaultFontTypePref;
|
||||
preference.setAttribute("name", defaultFontTypePref);
|
||||
preference.setAttribute("type", "string");
|
||||
preference.setAttribute("onchange", "gContentPane._rebuildFonts();");
|
||||
document.getElementById("contentPreferences").appendChild(preference);
|
||||
}
|
||||
return preference.value;
|
||||
},
|
||||
|
||||
writeEnableImagesPref: function ()
|
||||
{
|
||||
var enableImages = document.getElementById("enableImages");
|
||||
|
|
|
@ -62,7 +62,6 @@
|
|||
name="dom.disable_window_status_change"
|
||||
type="bool" onchange="gContentPane.annoyancesPrefChanged();"/>
|
||||
<preference id="font.language.group" name="font.language.group" type="wstring" onchange="gContentPane._rebuildFonts();"/>
|
||||
<preference id="font.default" name="font.default" type="string" onchange="gContentPane._rebuildFonts();"/>
|
||||
<preference id="pref.advanced.images.disable_button.view_image"
|
||||
name="pref.advanced.images.disable_button.view_image"
|
||||
type="bool"/>
|
||||
|
|
|
@ -96,19 +96,22 @@ var FontBuilder = {
|
|||
// All-Fonts list, so walk both lists side-by-side, skipping values we've
|
||||
// already created menu items for.
|
||||
var builtItem = separator ? separator.nextSibling : popup.firstChild;
|
||||
|
||||
var builtItemValue = builtItem ? builtItem.getAttribute("value") : null;
|
||||
|
||||
separator = document.createElement("menuseparator");
|
||||
popup.appendChild(separator);
|
||||
|
||||
for (i = 0; i < this._allFonts.length; ++i) {
|
||||
if (this._allFonts[i] != builtItem.getAttribute("value")) {
|
||||
if (this._allFonts[i] != builtItemValue) {
|
||||
menuitem = document.createElement("menuitem");
|
||||
menuitem.setAttribute("value", this._allFonts[i]);
|
||||
menuitem.setAttribute("label", this._allFonts[i]);
|
||||
popup.appendChild(menuitem);
|
||||
}
|
||||
else
|
||||
else {
|
||||
builtItem = builtItem.nextSibling;
|
||||
builtItemValue = builtItem ? builtItem.getAttribute("value") : null;
|
||||
}
|
||||
}
|
||||
}
|
||||
aMenuList.appendChild(popup);
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
#
|
||||
# Contributor(s):
|
||||
# Ben Goodger <ben@mozilla.org>
|
||||
# Asaf Romano <mozilla.mano@sent.com>
|
||||
#
|
||||
# Alternatively, the contents of this file may be used under the terms of
|
||||
# either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
|
@ -36,6 +37,7 @@
|
|||
|
||||
# browser.display.languageList LOCK ALL when LOCKED
|
||||
|
||||
const kDefaultFontType = "font.default.%LANG%";
|
||||
const kFontNameFmtSerif = "font.name.serif.%LANG%";
|
||||
const kFontNameFmtSansSerif = "font.name.sans-serif.%LANG%";
|
||||
const kFontNameFmtMonospace = "font.name.monospace.%LANG%";
|
||||
|
@ -49,7 +51,8 @@ const kFontMinSizeFmt = "font.minimum-size.%LANG%";
|
|||
var gFontsDialog = {
|
||||
_selectLanguageGroup: function (aLanguageGroup)
|
||||
{
|
||||
var prefs = [{ format: kFontNameFmtSerif, type: "unichar", element: "serif", fonttype: "serif" },
|
||||
var prefs = [{ format: kDefaultFontType, type: "string", element: "defaultFontType", fonttype: null},
|
||||
{ format: kFontNameFmtSerif, type: "unichar", element: "serif", fonttype: "serif" },
|
||||
{ format: kFontNameFmtSansSerif, type: "unichar", element: "sans-serif", fonttype: "sans-serif" },
|
||||
{ format: kFontNameFmtMonospace, type: "unichar", element: "monospace", fonttype: "monospace" },
|
||||
{ format: kFontNameListFmtSerif, type: "unichar", element: null, fonttype: "serif" },
|
||||
|
@ -65,9 +68,9 @@ var gFontsDialog = {
|
|||
preference = document.createElement("preference");
|
||||
var name = prefs[i].format.replace(/%LANG%/, aLanguageGroup);
|
||||
preference.id = name;
|
||||
preference.setAttribute("name", name);
|
||||
preference.setAttribute("type", prefs[i].type);
|
||||
preferences.appendChild(preference);
|
||||
preference.name = name;
|
||||
preference.type = prefs[i].type;
|
||||
}
|
||||
|
||||
if (!prefs[i].element)
|
||||
|
|
|
@ -52,7 +52,6 @@
|
|||
|
||||
<preferences id="fontPreferences">
|
||||
<preference id="font.language.group" name="font.language.group" type="wstring"/>
|
||||
<preference id="font.default" name="font.default" type="string"/>
|
||||
<preference id="browser.display.screen_resolution"
|
||||
name="browser.display.screen_resolution"
|
||||
type="int"/>
|
||||
|
@ -113,8 +112,7 @@
|
|||
<hbox align="center" pack="end">
|
||||
<label accesskey="&proportional.accesskey;" control="proportionalFont">&proportional.label;</label>
|
||||
</hbox>
|
||||
<menulist id="proportionalFont" flex="1" style="width: 0px;"
|
||||
preference="font.default">
|
||||
<menulist id="defaultFontType" flex="1" style="width: 0px;">
|
||||
<menupopup>
|
||||
<menuitem value="serif" label="&useDefaultFontSerif.label;"/>
|
||||
<menuitem value="sans-serif" label="&useDefaultFontSansSerif.label;"/>
|
||||
|
|
Загрузка…
Ссылка в новой задаче