Further changes required by Servo

This commit is contained in:
Oriol Brufau 2023-05-22 11:03:30 +02:00
parent d86e449e8c
commit fd41056ca5
4 changed files with 10 additions and 1 deletions

View file

@ -127,6 +127,7 @@ stroke-opacity
storage
submit
suspend
system-ui
tel
text
time

View file

@ -1387,6 +1387,8 @@ fn to_font_kit_family(font_family: &font::SingleFontFamily) -> FamilyName {
font::GenericFontFamily::Monospace => FamilyName::Monospace,
font::GenericFontFamily::Fantasy => FamilyName::Fantasy,
font::GenericFontFamily::Cursive => FamilyName::Cursive,
// TODO: There is no FontFamily::SystemUi.
font::GenericFontFamily::SystemUi => unreachable!("system-ui should be disabled"),
font::GenericFontFamily::None => unreachable!("Shouldn't appear in computed values"),
},
}

View file

@ -569,6 +569,7 @@ impl<'a> From<&'a SingleFontFamily> for FontFamilyName {
GenericFontFamily::Monospace => atom!("monospace"),
GenericFontFamily::Cursive => atom!("cursive"),
GenericFontFamily::Fantasy => atom!("fantasy"),
GenericFontFamily::SystemUi => atom!("system-ui"),
}),
}
}

View file

@ -387,7 +387,10 @@ pub enum SingleFontFamily {
}
fn system_ui_enabled(_: &ParserContext) -> bool {
static_prefs::pref!("layout.css.system-ui.enabled")
#[cfg(feature = "gecko")]
return static_prefs::pref!("layout.css.system-ui.enabled");
#[cfg(feature = "servo")]
return false;
}
/// A generic font-family name.
@ -501,6 +504,7 @@ impl SingleFontFamily {
atom!("cursive") => return SingleFontFamily::Generic(GenericFontFamily::Cursive),
atom!("fantasy") => return SingleFontFamily::Generic(GenericFontFamily::Fantasy),
atom!("monospace") => return SingleFontFamily::Generic(GenericFontFamily::Monospace),
atom!("system-ui") => return SingleFontFamily::Generic(GenericFontFamily::SystemUi),
_ => {},
}
@ -510,6 +514,7 @@ impl SingleFontFamily {
"cursive" => return SingleFontFamily::Generic(GenericFontFamily::Cursive),
"fantasy" => return SingleFontFamily::Generic(GenericFontFamily::Fantasy),
"monospace" => return SingleFontFamily::Generic(GenericFontFamily::Monospace),
"system-ui" => return SingleFontFamily::Generic(GenericFontFamily::SystemUi),
_ => {}
}