servo: Merge #20508 - Convert StylePrefs to StaticPrefs (from nnethercote:bug-1448225); r=emilio
authorNicholas Nethercote <nnethercote@mozilla.com>
Tue, 03 Apr 2018 01:54:24 -0400
changeset 411440 3fe0b81bd9de17b369e6f4eb189babf4b65a5203
parent 411439 20614b63d378254fc8f3caecaec9b02cd7522e2c
child 411441 2ee160335e150f20df3471b60b5e58ce873e2ff6
push id101651
push useraiakab@mozilla.com
push dateTue, 03 Apr 2018 09:42:02 +0000
treeherdermozilla-inbound@99a953f1823f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersemilio
milestone61.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
servo: Merge #20508 - Convert StylePrefs to StaticPrefs (from nnethercote:bug-1448225); r=emilio <!-- Please describe your changes on the following line: --> This is the Servo part of https://bugzilla.mozilla.org/show_bug.cgi?id=1448225. --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: --> - [x] `./mach build -d` does not report any errors - [x] `./mach test-tidy` does not report any errors - [x] These changes fix https://bugzilla.mozilla.org/show_bug.cgi?id=1448225 <!-- Either: --> - [ ] There are tests for these changes OR - [X] These changes do not require tests because tested on the Gecko side. <!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.--> <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> r? emilio Source-Repo: https://github.com/servo/servo Source-Revision: 0a3ffc0c6045eb6983273010d91a35267d8ec3fa
servo/components/style/font_face.rs
servo/components/style/gecko/data.rs
servo/components/style/gecko/generated/structs.rs
servo/components/style/gecko/media_queries.rs
servo/components/style/gecko/selector_parser.rs
servo/components/style/stylesheets/document_rule.rs
servo/components/style/values/specified/grid.rs
servo/components/style/values/specified/svg.rs
servo/components/style/values/specified/transform.rs
--- a/servo/components/style/font_face.rs
+++ b/servo/components/style/font_face.rs
@@ -219,23 +219,23 @@ impl Parse for Source {
         }))
     }
 }
 
 macro_rules! is_descriptor_enabled {
     ("font-display") => {
         unsafe {
             use gecko_bindings::structs::mozilla;
-            mozilla::StylePrefs_sFontDisplayEnabled
+            mozilla::StaticPrefs_sVarCache_layout_css_font_display_enabled
         }
     };
     ("font-variation-settings") => {
         unsafe {
             use gecko_bindings::structs::mozilla;
-            mozilla::StylePrefs_sFontVariationsEnabled
+            mozilla::StaticPrefs_sVarCache_layout_css_font_variations_enabled
         }
     };
     ($name: tt) => { true }
 }
 
 macro_rules! font_face_descriptors_common {
     (
         $( #[$doc: meta] $name: tt $ident: ident / $gecko_ident: ident: $ty: ty, )*
--- a/servo/components/style/gecko/data.rs
+++ b/servo/components/style/gecko/data.rs
@@ -183,17 +183,17 @@ impl PerDocumentStyleDataImpl {
 
     /// Get the default computed values for this document.
     pub fn default_computed_values(&self) -> &Arc<ComputedValues> {
         self.stylist.device().default_computed_values_arc()
     }
 
     /// Returns whether visited links are enabled.
     fn visited_links_enabled(&self) -> bool {
-        unsafe { structs::StylePrefs_sVisitedLinksEnabled }
+        unsafe { structs::StaticPrefs_sVarCache_layout_css_visited_links_enabled }
     }
 
     /// Returns whether visited styles are enabled.
     pub fn visited_styles_enabled(&self) -> bool {
         if !self.visited_links_enabled() {
             return false;
         }
 
--- a/servo/components/style/gecko/generated/structs.rs
+++ b/servo/components/style/gecko/generated/structs.rs
@@ -11969,89 +11969,89 @@ pub mod root {
         }
         impl Clone for LookAndFeel {
             fn clone(&self) -> Self {
                 *self
             }
         }
         #[repr(C)]
         #[derive(Debug, Copy)]
-        pub struct StylePrefs {
+        pub struct StaticPrefs {
             pub _address: u8,
         }
         extern "C" {
-            #[link_name = "\u{1}_ZN7mozilla10StylePrefs19sFontDisplayEnabledE"]
-            pub static mut StylePrefs_sFontDisplayEnabled: bool;
+            #[link_name = "\u{1}_ZN7mozilla11StaticPrefs41sVarCache_layout_css_font_display_enabledE"]
+            pub static mut StaticPrefs_sVarCache_layout_css_font_display_enabled: bool;
         }
         extern "C" {
-            #[link_name = "\u{1}_ZN7mozilla10StylePrefs19sOpentypeSVGEnabledE"]
-            pub static mut StylePrefs_sOpentypeSVGEnabled: bool;
+            #[link_name = "\u{1}_ZN7mozilla11StaticPrefs49sVarCache_gfx_font_rendering_opentype_svg_enabledE"]
+            pub static mut StaticPrefs_sVarCache_gfx_font_rendering_opentype_svg_enabled: bool;
         }
         extern "C" {
-            #[link_name = "\u{1}_ZN7mozilla10StylePrefs29sWebkitPrefixedAliasesEnabledE"]
-            pub static mut StylePrefs_sWebkitPrefixedAliasesEnabled: bool;
+            #[link_name = "\u{1}_ZN7mozilla11StaticPrefs36sVarCache_layout_css_prefixes_webkitE"]
+            pub static mut StaticPrefs_sVarCache_layout_css_prefixes_webkit: bool;
         }
         extern "C" {
-            #[link_name = "\u{1}_ZN7mozilla10StylePrefs30sWebkitDevicePixelRatioEnabledE"]
-            pub static mut StylePrefs_sWebkitDevicePixelRatioEnabled: bool;
+            #[link_name = "\u{1}_ZN7mozilla11StaticPrefs55sVarCache_layout_css_prefixes_device_pixel_ratio_webkitE"]
+            pub static mut StaticPrefs_sVarCache_layout_css_prefixes_device_pixel_ratio_webkit: bool;
         }
         extern "C" {
-            #[link_name = "\u{1}_ZN7mozilla10StylePrefs20sMozGradientsEnabledE"]
-            pub static mut StylePrefs_sMozGradientsEnabled: bool;
+            #[link_name = "\u{1}_ZN7mozilla11StaticPrefs39sVarCache_layout_css_prefixes_gradientsE"]
+            pub static mut StaticPrefs_sVarCache_layout_css_prefixes_gradients: bool;
         }
         extern "C" {
-            #[link_name = "\u{1}_ZN7mozilla10StylePrefs22sControlCharVisibilityE"]
-            pub static mut StylePrefs_sControlCharVisibility: bool;
+            #[link_name = "\u{1}_ZN7mozilla11StaticPrefs47sVarCache_layout_css_control_characters_visibleE"]
+            pub static mut StaticPrefs_sVarCache_layout_css_control_characters_visible: bool;
         }
         extern "C" {
-            #[link_name = "\u{1}_ZN7mozilla10StylePrefs28sFramesTimingFunctionEnabledE"]
-            pub static mut StylePrefs_sFramesTimingFunctionEnabled: bool;
+            #[link_name = "\u{1}_ZN7mozilla11StaticPrefs42sVarCache_layout_css_frames_timing_enabledE"]
+            pub static mut StaticPrefs_sVarCache_layout_css_frames_timing_enabled: bool;
         }
         extern "C" {
-            #[link_name = "\u{1}_ZN7mozilla10StylePrefs31sUnprefixedFullscreenApiEnabledE"]
-            pub static mut StylePrefs_sUnprefixedFullscreenApiEnabled: bool;
+            #[link_name = "\u{1}_ZN7mozilla11StaticPrefs42sVarCache_full_screen_api_unprefix_enabledE"]
+            pub static mut StaticPrefs_sVarCache_full_screen_api_unprefix_enabled: bool;
         }
         extern "C" {
-            #[link_name = "\u{1}_ZN7mozilla10StylePrefs20sVisitedLinksEnabledE"]
-            pub static mut StylePrefs_sVisitedLinksEnabled: bool;
+            #[link_name = "\u{1}_ZN7mozilla11StaticPrefs42sVarCache_layout_css_visited_links_enabledE"]
+            pub static mut StaticPrefs_sVarCache_layout_css_visited_links_enabled: bool;
         }
         extern "C" {
-            #[link_name = "\u{1}_ZN7mozilla10StylePrefs28sMozDocumentEnabledInContentE"]
-            pub static mut StylePrefs_sMozDocumentEnabledInContent: bool;
+            #[link_name = "\u{1}_ZN7mozilla11StaticPrefs49sVarCache_layout_css_moz_document_content_enabledE"]
+            pub static mut StaticPrefs_sVarCache_layout_css_moz_document_content_enabled: bool;
         }
         extern "C" {
-            #[link_name = "\u{1}_ZN7mozilla10StylePrefs32sMozDocumentURLPrefixHackEnabledE"]
-            pub static mut StylePrefs_sMozDocumentURLPrefixHackEnabled: bool;
+            #[link_name = "\u{1}_ZN7mozilla11StaticPrefs57sVarCache_layout_css_moz_document_url_prefix_hack_enabledE"]
+            pub static mut StaticPrefs_sVarCache_layout_css_moz_document_url_prefix_hack_enabled: bool;
         }
         extern "C" {
-            #[link_name = "\u{1}_ZN7mozilla10StylePrefs32sGridTemplateSubgridValueEnabledE"]
-            pub static mut StylePrefs_sGridTemplateSubgridValueEnabled: bool;
+            #[link_name = "\u{1}_ZN7mozilla11StaticPrefs56sVarCache_layout_css_grid_template_subgrid_value_enabledE"]
+            pub static mut StaticPrefs_sVarCache_layout_css_grid_template_subgrid_value_enabled: bool;
         }
         extern "C" {
-            #[link_name = "\u{1}_ZN7mozilla10StylePrefs22sFontVariationsEnabledE"]
-            pub static mut StylePrefs_sFontVariationsEnabled: bool;
+            #[link_name = "\u{1}_ZN7mozilla11StaticPrefs44sVarCache_layout_css_font_variations_enabledE"]
+            pub static mut StaticPrefs_sVarCache_layout_css_font_variations_enabled: bool;
         }
         extern "C" {
-            #[link_name = "\u{1}_ZN7mozilla10StylePrefs22sEmulateMozBoxWithFlexE"]
-            pub static mut StylePrefs_sEmulateMozBoxWithFlex: bool;
-        }
-        #[test]
-        fn bindgen_test_layout_StylePrefs() {
-            assert_eq!(
-                ::std::mem::size_of::<StylePrefs>(),
+            #[link_name = "\u{1}_ZN7mozilla11StaticPrefs46sVarCache_layout_css_emulate_moz_box_with_flexE"]
+            pub static mut StaticPrefs_sVarCache_layout_css_emulate_moz_box_with_flex: bool;
+        }
+        #[test]
+        fn bindgen_test_layout_StaticPrefs() {
+            assert_eq!(
+                ::std::mem::size_of::<StaticPrefs>(),
                 1usize,
-                concat!("Size of: ", stringify!(StylePrefs))
-            );
-            assert_eq!(
-                ::std::mem::align_of::<StylePrefs>(),
+                concat!("Size of: ", stringify!(StaticPrefs))
+            );
+            assert_eq!(
+                ::std::mem::align_of::<StaticPrefs>(),
                 1usize,
-                concat!("Alignment of ", stringify!(StylePrefs))
-            );
-        }
-        impl Clone for StylePrefs {
+                concat!("Alignment of ", stringify!(StaticPrefs))
+            );
+        }
+        impl Clone for StaticPrefs {
             fn clone(&self) -> Self {
                 *self
             }
         }
         #[repr(C)]
         #[derive(Debug, Copy)]
         pub struct NonOwningAnimationTarget {
             pub mElement: *mut root::mozilla::dom::Element,
--- a/servo/components/style/gecko/media_queries.rs
+++ b/servo/components/style/gecko/media_queries.rs
@@ -605,21 +605,21 @@ impl Expression {
                 if context.chrome_rules_enabled() ||
                     context.stylesheet_origin == Origin::UserAgent {
                     flags |= structs::nsMediaFeature_RequirementFlags_eUserAgentAndChromeOnly;
                 }
 
                 let result = {
                     let mut feature_name = &**ident;
 
-                    if unsafe { structs::StylePrefs_sWebkitPrefixedAliasesEnabled } &&
+                    if unsafe { structs::StaticPrefs_sVarCache_layout_css_prefixes_webkit } &&
                        starts_with_ignore_ascii_case(feature_name, "-webkit-") {
                         feature_name = &feature_name[8..];
                         flags |= structs::nsMediaFeature_RequirementFlags_eHasWebkitPrefix;
-                        if unsafe { structs::StylePrefs_sWebkitDevicePixelRatioEnabled } {
+                        if unsafe { structs::StaticPrefs_sVarCache_layout_css_prefixes_device_pixel_ratio_webkit } {
                             flags |= structs::nsMediaFeature_RequirementFlags_eWebkitDevicePixelRatioPrefEnabled;
                         }
                     }
 
                     let range = if starts_with_ignore_ascii_case(feature_name, "min-") {
                         feature_name = &feature_name[4..];
                         Range::Min
                     } else if starts_with_ignore_ascii_case(feature_name, "max-") {
--- a/servo/components/style/gecko/selector_parser.rs
+++ b/servo/components/style/gecko/selector_parser.rs
@@ -174,17 +174,17 @@ impl NonTSPseudoClass {
 
     /// Returns whether the pseudo-class is enabled in content sheets.
     fn is_enabled_in_content(&self) -> bool {
         use gecko_bindings::structs::mozilla;
         match *self {
             // For pseudo-classes with pref, the availability in content
             // depends on the pref.
             NonTSPseudoClass::Fullscreen =>
-                unsafe { mozilla::StylePrefs_sUnprefixedFullscreenApiEnabled },
+                unsafe { mozilla::StaticPrefs_sVarCache_full_screen_api_unprefix_enabled },
             // Otherwise, a pseudo-class is enabled in content when it
             // doesn't have any enabled flag.
             _ => !self.has_any_flag(NonTSPseudoClassFlag::PSEUDO_CLASS_ENABLED_IN_UA_SHEETS_AND_CHROME),
         }
     }
 
     /// <https://drafts.csswg.org/selectors-4/#useraction-pseudos>
     ///
--- a/servo/components/style/stylesheets/document_rule.rs
+++ b/servo/components/style/stylesheets/document_rule.rs
@@ -215,21 +215,21 @@ impl DocumentCondition {
     fn allowed_in(&self, context: &ParserContext) -> bool {
         use gecko_bindings::structs;
         use stylesheets::Origin;
 
         if context.stylesheet_origin != Origin::Author {
             return true;
         }
 
-        if unsafe { structs::StylePrefs_sMozDocumentEnabledInContent } {
+        if unsafe { structs::StaticPrefs_sVarCache_layout_css_moz_document_content_enabled } {
             return true;
         }
 
-        if !unsafe { structs::StylePrefs_sMozDocumentURLPrefixHackEnabled } {
+        if !unsafe { structs::StaticPrefs_sVarCache_layout_css_moz_document_url_prefix_hack_enabled } {
             return false;
         }
 
         // Allow a single url-prefix() for compatibility.
         //
         // See bug 1446470 and dependencies.
         if self.0.len() != 1 {
             return false;
--- a/servo/components/style/values/specified/grid.rs
+++ b/servo/components/style/values/specified/grid.rs
@@ -324,17 +324,17 @@ impl ToComputedValue for TrackList<Lengt
         }
     }
 }
 
 #[cfg(feature = "gecko")]
 #[inline]
 fn allow_grid_template_subgrids() -> bool {
     use gecko_bindings::structs::mozilla;
-    unsafe { mozilla::StylePrefs_sGridTemplateSubgridValueEnabled }
+    unsafe { mozilla::StaticPrefs_sVarCache_layout_css_grid_template_subgrid_value_enabled }
 }
 
 #[cfg(feature = "servo")]
 #[inline]
 fn allow_grid_template_subgrids() -> bool {
     false
 }
 
--- a/servo/components/style/values/specified/svg.rs
+++ b/servo/components/style/values/specified/svg.rs
@@ -23,17 +23,17 @@ pub type SVGPaint = generic::SVGPaint<RG
 pub type SVGPaintKind = generic::SVGPaintKind<RGBAColor, SpecifiedUrl>;
 
 #[cfg(feature = "gecko")]
 fn is_context_value_enabled() -> bool {
     // The prefs can only be mutated on the main thread, so it is safe
     // to read whenever we are on the main thread or the main thread is
     // blocked.
     use gecko_bindings::structs::mozilla;
-    unsafe { mozilla::StylePrefs_sOpentypeSVGEnabled }
+    unsafe { mozilla::StaticPrefs_sVarCache_gfx_font_rendering_opentype_svg_enabled }
 }
 #[cfg(not(feature = "gecko"))]
 fn is_context_value_enabled() -> bool {
     false
 }
 
 fn parse_context_value<'i, 't, T>(
     input: &mut Parser<'i, 't>,
--- a/servo/components/style/values/specified/transform.rs
+++ b/servo/components/style/values/specified/transform.rs
@@ -350,17 +350,17 @@ impl<S> OriginComponent<S> {
         OriginComponent::Length(LengthOrPercentage::Percentage(ComputedPercentage::zero()))
     }
 }
 
 #[cfg(feature = "gecko")]
 #[inline]
 fn allow_frames_timing() -> bool {
     use gecko_bindings::structs::mozilla;
-    unsafe { mozilla::StylePrefs_sFramesTimingFunctionEnabled }
+    unsafe { mozilla::StaticPrefs_sVarCache_layout_css_frames_timing_enabled }
 }
 
 #[cfg(feature = "servo")]
 #[inline]
 fn allow_frames_timing() -> bool {
     true
 }