mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-28 07:13:20 +00:00
Bug 1802957 - Remove non-standard and unused system font values. r=jfkthame
And hide internal but used values. System fonts are not exposed in the computed style so this should be fine. If we need the old values for some obscure reason, it's trivial to alias them to e.g., menu or so. Differential Revision: https://phabricator.services.mozilla.com/D163269
This commit is contained in:
parent
5da98a3a05
commit
77327233d7
@ -6756,15 +6756,9 @@ exports.CSS_PROPERTIES = {
|
||||
"supports": [],
|
||||
"values": [
|
||||
"-moz-button",
|
||||
"-moz-desktop",
|
||||
"-moz-dialog",
|
||||
"-moz-document",
|
||||
"-moz-field",
|
||||
"-moz-info",
|
||||
"-moz-list",
|
||||
"-moz-pull-down-menu",
|
||||
"-moz-window",
|
||||
"-moz-workspace",
|
||||
"all-petite-caps",
|
||||
"all-small-caps",
|
||||
"bold",
|
||||
|
@ -1866,9 +1866,6 @@ void gfxMacPlatformFontList::LookupSystemFont(LookAndFeel::FontID aSystemFontID,
|
||||
break;
|
||||
|
||||
case LookAndFeel::FontID::Icon: // used in urlbar; tried labelFont, but too small
|
||||
case LookAndFeel::FontID::MozWorkspace:
|
||||
case LookAndFeel::FontID::MozDesktop:
|
||||
case LookAndFeel::FontID::MozInfo:
|
||||
font = [NSFont controlContentFontOfSize:0.0];
|
||||
systemFontName = (char*)kSystemFont_system;
|
||||
break;
|
||||
@ -1880,7 +1877,6 @@ void gfxMacPlatformFontList::LookupSystemFont(LookAndFeel::FontID aSystemFontID,
|
||||
|
||||
case LookAndFeel::FontID::Caption:
|
||||
case LookAndFeel::FontID::Menu:
|
||||
case LookAndFeel::FontID::MozDialog:
|
||||
default:
|
||||
font = [NSFont systemFontOfSize:0.0];
|
||||
systemFontName = (char*)kSystemFont_system;
|
||||
|
@ -4,7 +4,7 @@
|
||||
<meta charset="UTF-8">
|
||||
<script>
|
||||
window.onload = () => {
|
||||
document.documentElement.animate([ { "font": "-moz-desktop" }, { "font": "message-box" } ])
|
||||
document.documentElement.animate([ { "font": "menu" }, { "font": "message-box" } ])
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
|
@ -5544,17 +5544,6 @@ var gCSSProperties = {
|
||||
"message-box",
|
||||
"small-caption",
|
||||
"status-bar",
|
||||
// Gecko-specific system fonts
|
||||
"-moz-window",
|
||||
"-moz-document",
|
||||
"-moz-desktop",
|
||||
"-moz-info",
|
||||
"-moz-dialog",
|
||||
"-moz-button",
|
||||
"-moz-pull-down-menu",
|
||||
"-moz-list",
|
||||
"-moz-field",
|
||||
"-moz-workspace",
|
||||
// line-height with calc()
|
||||
"condensed bold italic small-caps 24px/calc(2px) Times New Roman, serif",
|
||||
"condensed bold italic small-caps 24px/calc(50%) Times New Roman, serif",
|
||||
|
@ -22,6 +22,12 @@ const NON_CONTENT_ACCESSIBLE_VALUES = {
|
||||
"-moz-box",
|
||||
"-moz-inline-box",
|
||||
],
|
||||
"font": [
|
||||
"-moz-pull-down-menu",
|
||||
"-moz-button",
|
||||
"-moz-list",
|
||||
"-moz-field",
|
||||
],
|
||||
"-moz-appearance": [
|
||||
"button-arrow-down",
|
||||
"button-arrow-next",
|
||||
|
@ -48,24 +48,18 @@
|
||||
* cserialize.
|
||||
*/
|
||||
|
||||
var gSystemFont = {
|
||||
"caption": true,
|
||||
"icon": true,
|
||||
"menu": true,
|
||||
"message-box": true,
|
||||
"small-caption": true,
|
||||
"status-bar": true,
|
||||
"-moz-window": true,
|
||||
"-moz-document": true,
|
||||
"-moz-desktop": true,
|
||||
"-moz-info": true,
|
||||
"-moz-dialog": true,
|
||||
"-moz-button": true,
|
||||
"-moz-pull-down-menu": true,
|
||||
"-moz-list": true,
|
||||
"-moz-field": true,
|
||||
"-moz-workspace": true,
|
||||
};
|
||||
var gSystemFont = [
|
||||
"caption",
|
||||
"icon",
|
||||
"menu",
|
||||
"message-box",
|
||||
"small-caption",
|
||||
"status-bar",
|
||||
"-moz-button",
|
||||
"-moz-pull-down-menu",
|
||||
"-moz-list",
|
||||
"-moz-field",
|
||||
];
|
||||
|
||||
var gBadCompute = {
|
||||
// output wrapped around to positive, in exponential notation
|
||||
@ -154,7 +148,7 @@ function test_property(property)
|
||||
|
||||
function test_value(value, resolved_value) {
|
||||
var value_has_variable_reference = resolved_value != null;
|
||||
var is_system_font = property == "font" && value in gSystemFont;
|
||||
var is_system_font = property == "font" && gSystemFont.includes(value);
|
||||
|
||||
var colon = ": ";
|
||||
gDeclaration.setProperty(property, value, "");
|
||||
|
@ -69,7 +69,7 @@
|
||||
let mut stretch = None;
|
||||
let size;
|
||||
% if engine == "gecko":
|
||||
if let Ok(sys) = input.try_parse(SystemFont::parse) {
|
||||
if let Ok(sys) = input.try_parse(|i| SystemFont::parse(context, i)) {
|
||||
return Ok(expanded! {
|
||||
% for name in SYSTEM_FONT_LONGHANDS:
|
||||
${name}: ${name}::SpecifiedValue::system_font(sys),
|
||||
|
@ -70,21 +70,29 @@ macro_rules! system_font_methods {
|
||||
)]
|
||||
#[allow(missing_docs)]
|
||||
pub enum SystemFont {
|
||||
/// https://drafts.csswg.org/css-fonts/#valdef-font-caption
|
||||
Caption,
|
||||
/// https://drafts.csswg.org/css-fonts/#valdef-font-icon
|
||||
Icon,
|
||||
/// https://drafts.csswg.org/css-fonts/#valdef-font-menu
|
||||
Menu,
|
||||
/// https://drafts.csswg.org/css-fonts/#valdef-font-message-box
|
||||
MessageBox,
|
||||
/// https://drafts.csswg.org/css-fonts/#valdef-font-small-caption
|
||||
SmallCaption,
|
||||
/// https://drafts.csswg.org/css-fonts/#valdef-font-status-bar
|
||||
StatusBar,
|
||||
MozWindow,
|
||||
MozDocument,
|
||||
MozWorkspace,
|
||||
MozDesktop,
|
||||
MozInfo,
|
||||
MozDialog,
|
||||
MozButton,
|
||||
/// Internal system font, used by the `<menupopup>`s on macOS.
|
||||
#[parse(condition = "ParserContext::in_ua_or_chrome_sheet")]
|
||||
MozPullDownMenu,
|
||||
/// Internal system font, used for `<button>` elements.
|
||||
#[parse(condition = "ParserContext::in_ua_or_chrome_sheet")]
|
||||
MozButton,
|
||||
/// Internal font, used by `<select>` elements.
|
||||
#[parse(condition = "ParserContext::in_ua_or_chrome_sheet")]
|
||||
MozList,
|
||||
/// Internal font, used by `<input>` elements.
|
||||
#[parse(condition = "ParserContext::in_ua_or_chrome_sheet")]
|
||||
MozField,
|
||||
#[css(skip)]
|
||||
End, // Just for indexing purposes.
|
||||
|
@ -16,7 +16,7 @@ checkbox {
|
||||
<vbox style="font: message-box">
|
||||
<hbox><checkbox native="true" label="Small"/></hbox>
|
||||
</vbox>
|
||||
<vbox style="font: -moz-dialog">
|
||||
<vbox style="font: menu">
|
||||
<hbox><checkbox native="true" label="Regular"/></hbox>
|
||||
</vbox>
|
||||
<vbox style="font-size: 9px">
|
||||
@ -25,7 +25,7 @@ checkbox {
|
||||
<vbox style="font: message-box">
|
||||
<hbox><checkbox native="true" label="Small" checked="true"/></hbox>
|
||||
</vbox>
|
||||
<vbox style="font: -moz-dialog">
|
||||
<vbox style="font: menu">
|
||||
<hbox><checkbox native="true" label="Regular" checked="true"/></hbox>
|
||||
</vbox>
|
||||
</window>
|
||||
|
@ -16,7 +16,7 @@ radio {
|
||||
<vbox style="font: message-box">
|
||||
<hbox><radio label="Small"/></hbox>
|
||||
</vbox>
|
||||
<vbox style="font: -moz-dialog">
|
||||
<vbox style="font: menu">
|
||||
<hbox><radio label="Regular"/></hbox>
|
||||
</vbox>
|
||||
<vbox style="font-size: 9px">
|
||||
@ -25,7 +25,7 @@ radio {
|
||||
<vbox style="font: message-box">
|
||||
<hbox><radio label="Small" selected="true"/></hbox>
|
||||
</vbox>
|
||||
<vbox style="font: -moz-dialog">
|
||||
<vbox style="font: menu">
|
||||
<hbox><radio label="Regular" selected="true"/></hbox>
|
||||
</vbox>
|
||||
</window>
|
||||
|
@ -557,20 +557,6 @@ bool nsLookAndFeel::IsSystemOrientationRTL() {
|
||||
bool nsLookAndFeel::NativeGetFont(FontID aID, nsString& aFontName, gfxFontStyle& aFontStyle) {
|
||||
NS_OBJC_BEGIN_TRY_BLOCK_RETURN;
|
||||
|
||||
// hack for now
|
||||
if (aID == FontID::MozWindow || aID == FontID::MozDocument) {
|
||||
aFontStyle.style = mozilla::FontSlantStyle::NORMAL;
|
||||
aFontStyle.weight = mozilla::FontWeight::NORMAL;
|
||||
aFontStyle.stretch = mozilla::FontStretch::NORMAL;
|
||||
aFontStyle.size = 14;
|
||||
aFontStyle.systemFont = true;
|
||||
|
||||
aFontName.AssignLiteral("sans-serif");
|
||||
return true;
|
||||
}
|
||||
|
||||
// TODO: Add caching? Note that it needs to be thread-safe for stylo use.
|
||||
|
||||
nsAutoCString name;
|
||||
gfxPlatformMac::LookupSystemFont(aID, name, aFontStyle);
|
||||
aFontName.Append(NS_ConvertUTF8toUTF16(name));
|
||||
|
@ -1090,12 +1090,6 @@ bool nsLookAndFeel::PerThemeData::GetFont(FontID aID, nsString& aFontName,
|
||||
case FontID::MessageBox: // css2
|
||||
case FontID::SmallCaption: // css2
|
||||
case FontID::StatusBar: // css2
|
||||
case FontID::MozWindow: // css3
|
||||
case FontID::MozDocument: // css3
|
||||
case FontID::MozWorkspace: // css3
|
||||
case FontID::MozDesktop: // css3
|
||||
case FontID::MozInfo: // css3
|
||||
case FontID::MozDialog: // css3
|
||||
default:
|
||||
aFontName = mDefaultFontName;
|
||||
aFontStyle = mDefaultFontStyle;
|
||||
|
@ -744,7 +744,6 @@ LookAndFeelFont nsLookAndFeel::GetLookAndFeelFont(LookAndFeel::FontID anID) {
|
||||
case LookAndFeel::FontID::StatusBar:
|
||||
result = GetLookAndFeelFontInternal(ncm.lfStatusFont, false);
|
||||
break;
|
||||
case LookAndFeel::FontID::MozDialog:
|
||||
case LookAndFeel::FontID::MozButton:
|
||||
case LookAndFeel::FontID::MozField:
|
||||
case LookAndFeel::FontID::MozList:
|
||||
|
Loading…
Reference in New Issue
Block a user