Make font-display descriptor behind the pref. r?heycam
draft
Make font-display descriptor behind the pref. r?heycam
MozReview-Commit-ID: Fugic5ydDSE
--- a/servo/components/style/font_face.rs
+++ b/servo/components/style/font_face.rs
@@ -205,16 +205,26 @@ impl Parse for Source {
Ok(Source::Url(UrlSource {
url: url,
format_hints: format_hints,
}))
}
}
+macro_rules! is_descriptor_enabled {
+ ("font-display") => {
+ unsafe {
+ use gecko_bindings::structs::mozilla;
+ mozilla::StylePrefs_sFontDisplayEnabled
+ }
+ };
+ ($name: tt) => { true }
+}
+
macro_rules! font_face_descriptors_common {
(
$( #[$doc: meta] $name: tt $ident: ident / $gecko_ident: ident: $ty: ty, )*
) => {
/// Data inside a `@font-face` rule.
///
/// https://drafts.csswg.org/css-fonts/#font-face-rule
#[derive(Clone, Debug, PartialEq, Eq)]
@@ -270,17 +280,17 @@ macro_rules! font_face_descriptors_commo
impl<'a, 'b, 'i> DeclarationParser<'i> for FontFaceRuleParser<'a, 'b> {
type Declaration = ();
type Error = SelectorParseError<'i, StyleParseError<'i>>;
fn parse_value<'t>(&mut self, name: CowRcStr<'i>, input: &mut Parser<'i, 't>)
-> Result<(), ParseError<'i>> {
match_ignore_ascii_case! { &*name,
$(
- $name => {
+ $name if is_descriptor_enabled!($name) => {
// DeclarationParser also calls parse_entirely
// so we’d normally not need to,
// but in this case we do because we set the value as a side effect
// rather than returning it.
let value = input.parse_entirely(|i| Parse::parse(self.context, i))?;
self.rule.$ident = Some(value)
}
)*
--- a/servo/components/style/gecko/generated/structs_debug.rs
+++ b/servo/components/style/gecko/generated/structs_debug.rs
@@ -9026,16 +9026,20 @@ pub mod root {
fn clone(&self) -> Self { *self }
}
#[repr(C)]
#[derive(Debug, Copy)]
pub struct StylePrefs {
pub _address: u8,
}
extern "C" {
+ #[link_name = "_ZN7mozilla10StylePrefs19sFontDisplayEnabledE"]
+ pub static mut StylePrefs_sFontDisplayEnabled: bool;
+ }
+ extern "C" {
#[link_name = "_ZN7mozilla10StylePrefs19sOpentypeSVGEnabledE"]
pub static mut StylePrefs_sOpentypeSVGEnabled: bool;
}
extern "C" {
#[link_name =
"_ZN7mozilla10StylePrefs29sWebkitPrefixedAliasesEnabledE"]
pub static mut StylePrefs_sWebkitPrefixedAliasesEnabled: bool;
}
--- a/servo/components/style/gecko/generated/structs_release.rs
+++ b/servo/components/style/gecko/generated/structs_release.rs
@@ -8872,16 +8872,20 @@ pub mod root {
fn clone(&self) -> Self { *self }
}
#[repr(C)]
#[derive(Debug, Copy)]
pub struct StylePrefs {
pub _address: u8,
}
extern "C" {
+ #[link_name = "_ZN7mozilla10StylePrefs19sFontDisplayEnabledE"]
+ pub static mut StylePrefs_sFontDisplayEnabled: bool;
+ }
+ extern "C" {
#[link_name = "_ZN7mozilla10StylePrefs19sOpentypeSVGEnabledE"]
pub static mut StylePrefs_sOpentypeSVGEnabled: bool;
}
extern "C" {
#[link_name =
"_ZN7mozilla10StylePrefs29sWebkitPrefixedAliasesEnabledE"]
pub static mut StylePrefs_sWebkitPrefixedAliasesEnabled: bool;
}