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:
Emilio Cobos Álvarez 2022-12-01 09:23:19 +00:00
Родитель ea44d8c7fb
Коммит c9a0f65ceb
14 изменённых файлов: 43 добавлений и 77 удалений

Просмотреть файл

@ -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;

Просмотреть файл

@ -10,9 +10,9 @@
/* Reduce the width so that container can fit all its children in 600px viewport width. */
width: 100px;
}
input[type=date] {
/* date by default uses a monospace font, which might have different metrics */
font: -moz-field;
/* date by default uses a monospace font, which might have different metrics */
input, button, select {
font: Menu;
}
.small-font * {
font-size: 8px !important; /* important to override rule above */

Просмотреть файл

@ -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: