Make font-display descriptor behind the pref. r?heycam draft
authorXidorn Quan <me@upsuper.org>
Thu, 03 Aug 2017 10:44:37 +1000
changeset 620086 6e68969e09e5b08bddf76a440791808e1c1e8457
parent 620085 bbde7837c30b00d92b59b1a1ca5bb8c894cdc037
child 640574 c113ba417b95b7ef0cecb0c6268c0875169de959
push id71903
push userxquan@mozilla.com
push dateThu, 03 Aug 2017 00:46:00 +0000
reviewersheycam
milestone57.0a1
Make font-display descriptor behind the pref. r?heycam MozReview-Commit-ID: Fugic5ydDSE
servo/components/style/font_face.rs
servo/components/style/gecko/generated/structs_debug.rs
servo/components/style/gecko/generated/structs_release.rs
--- 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;
         }