Convert StylePrefs to StaticPrefs.

This commit is contained in:
Nicholas Nethercote 2018-04-03 11:41:03 +10:00
parent a208d4246c
commit 8705fb3783
9 changed files with 46 additions and 46 deletions

View file

@ -224,13 +224,13 @@ macro_rules! is_descriptor_enabled {
("font-display") => { ("font-display") => {
unsafe { unsafe {
use gecko_bindings::structs::mozilla; use gecko_bindings::structs::mozilla;
mozilla::StylePrefs_sFontDisplayEnabled mozilla::StaticPrefs_sVarCache_layout_css_font_display_enabled
} }
}; };
("font-variation-settings") => { ("font-variation-settings") => {
unsafe { unsafe {
use gecko_bindings::structs::mozilla; use gecko_bindings::structs::mozilla;
mozilla::StylePrefs_sFontVariationsEnabled mozilla::StaticPrefs_sVarCache_layout_css_font_variations_enabled
} }
}; };
($name: tt) => { true } ($name: tt) => { true }

View file

@ -188,7 +188,7 @@ impl PerDocumentStyleDataImpl {
/// Returns whether visited links are enabled. /// Returns whether visited links are enabled.
fn visited_links_enabled(&self) -> bool { 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. /// Returns whether visited styles are enabled.

View file

@ -11974,79 +11974,79 @@ pub mod root {
} }
#[repr(C)] #[repr(C)]
#[derive(Debug, Copy)] #[derive(Debug, Copy)]
pub struct StylePrefs { pub struct StaticPrefs {
pub _address: u8, pub _address: u8,
} }
extern "C" { extern "C" {
#[link_name = "\u{1}_ZN7mozilla10StylePrefs19sFontDisplayEnabledE"] #[link_name = "\u{1}_ZN7mozilla11StaticPrefs41sVarCache_layout_css_font_display_enabledE"]
pub static mut StylePrefs_sFontDisplayEnabled: bool; pub static mut StaticPrefs_sVarCache_layout_css_font_display_enabled: bool;
} }
extern "C" { extern "C" {
#[link_name = "\u{1}_ZN7mozilla10StylePrefs19sOpentypeSVGEnabledE"] #[link_name = "\u{1}_ZN7mozilla11StaticPrefs49sVarCache_gfx_font_rendering_opentype_svg_enabledE"]
pub static mut StylePrefs_sOpentypeSVGEnabled: bool; pub static mut StaticPrefs_sVarCache_gfx_font_rendering_opentype_svg_enabled: bool;
} }
extern "C" { extern "C" {
#[link_name = "\u{1}_ZN7mozilla10StylePrefs29sWebkitPrefixedAliasesEnabledE"] #[link_name = "\u{1}_ZN7mozilla11StaticPrefs36sVarCache_layout_css_prefixes_webkitE"]
pub static mut StylePrefs_sWebkitPrefixedAliasesEnabled: bool; pub static mut StaticPrefs_sVarCache_layout_css_prefixes_webkit: bool;
} }
extern "C" { extern "C" {
#[link_name = "\u{1}_ZN7mozilla10StylePrefs30sWebkitDevicePixelRatioEnabledE"] #[link_name = "\u{1}_ZN7mozilla11StaticPrefs55sVarCache_layout_css_prefixes_device_pixel_ratio_webkitE"]
pub static mut StylePrefs_sWebkitDevicePixelRatioEnabled: bool; pub static mut StaticPrefs_sVarCache_layout_css_prefixes_device_pixel_ratio_webkit: bool;
} }
extern "C" { extern "C" {
#[link_name = "\u{1}_ZN7mozilla10StylePrefs20sMozGradientsEnabledE"] #[link_name = "\u{1}_ZN7mozilla11StaticPrefs39sVarCache_layout_css_prefixes_gradientsE"]
pub static mut StylePrefs_sMozGradientsEnabled: bool; pub static mut StaticPrefs_sVarCache_layout_css_prefixes_gradients: bool;
} }
extern "C" { extern "C" {
#[link_name = "\u{1}_ZN7mozilla10StylePrefs22sControlCharVisibilityE"] #[link_name = "\u{1}_ZN7mozilla11StaticPrefs47sVarCache_layout_css_control_characters_visibleE"]
pub static mut StylePrefs_sControlCharVisibility: bool; pub static mut StaticPrefs_sVarCache_layout_css_control_characters_visible: bool;
} }
extern "C" { extern "C" {
#[link_name = "\u{1}_ZN7mozilla10StylePrefs28sFramesTimingFunctionEnabledE"] #[link_name = "\u{1}_ZN7mozilla11StaticPrefs42sVarCache_layout_css_frames_timing_enabledE"]
pub static mut StylePrefs_sFramesTimingFunctionEnabled: bool; pub static mut StaticPrefs_sVarCache_layout_css_frames_timing_enabled: bool;
} }
extern "C" { extern "C" {
#[link_name = "\u{1}_ZN7mozilla10StylePrefs31sUnprefixedFullscreenApiEnabledE"] #[link_name = "\u{1}_ZN7mozilla11StaticPrefs42sVarCache_full_screen_api_unprefix_enabledE"]
pub static mut StylePrefs_sUnprefixedFullscreenApiEnabled: bool; pub static mut StaticPrefs_sVarCache_full_screen_api_unprefix_enabled: bool;
} }
extern "C" { extern "C" {
#[link_name = "\u{1}_ZN7mozilla10StylePrefs20sVisitedLinksEnabledE"] #[link_name = "\u{1}_ZN7mozilla11StaticPrefs42sVarCache_layout_css_visited_links_enabledE"]
pub static mut StylePrefs_sVisitedLinksEnabled: bool; pub static mut StaticPrefs_sVarCache_layout_css_visited_links_enabled: bool;
} }
extern "C" { extern "C" {
#[link_name = "\u{1}_ZN7mozilla10StylePrefs28sMozDocumentEnabledInContentE"] #[link_name = "\u{1}_ZN7mozilla11StaticPrefs49sVarCache_layout_css_moz_document_content_enabledE"]
pub static mut StylePrefs_sMozDocumentEnabledInContent: bool; pub static mut StaticPrefs_sVarCache_layout_css_moz_document_content_enabled: bool;
} }
extern "C" { extern "C" {
#[link_name = "\u{1}_ZN7mozilla10StylePrefs32sMozDocumentURLPrefixHackEnabledE"] #[link_name = "\u{1}_ZN7mozilla11StaticPrefs57sVarCache_layout_css_moz_document_url_prefix_hack_enabledE"]
pub static mut StylePrefs_sMozDocumentURLPrefixHackEnabled: bool; pub static mut StaticPrefs_sVarCache_layout_css_moz_document_url_prefix_hack_enabled: bool;
} }
extern "C" { extern "C" {
#[link_name = "\u{1}_ZN7mozilla10StylePrefs32sGridTemplateSubgridValueEnabledE"] #[link_name = "\u{1}_ZN7mozilla11StaticPrefs56sVarCache_layout_css_grid_template_subgrid_value_enabledE"]
pub static mut StylePrefs_sGridTemplateSubgridValueEnabled: bool; pub static mut StaticPrefs_sVarCache_layout_css_grid_template_subgrid_value_enabled: bool;
} }
extern "C" { extern "C" {
#[link_name = "\u{1}_ZN7mozilla10StylePrefs22sFontVariationsEnabledE"] #[link_name = "\u{1}_ZN7mozilla11StaticPrefs44sVarCache_layout_css_font_variations_enabledE"]
pub static mut StylePrefs_sFontVariationsEnabled: bool; pub static mut StaticPrefs_sVarCache_layout_css_font_variations_enabled: bool;
} }
extern "C" { extern "C" {
#[link_name = "\u{1}_ZN7mozilla10StylePrefs22sEmulateMozBoxWithFlexE"] #[link_name = "\u{1}_ZN7mozilla11StaticPrefs46sVarCache_layout_css_emulate_moz_box_with_flexE"]
pub static mut StylePrefs_sEmulateMozBoxWithFlex: bool; pub static mut StaticPrefs_sVarCache_layout_css_emulate_moz_box_with_flex: bool;
} }
#[test] #[test]
fn bindgen_test_layout_StylePrefs() { fn bindgen_test_layout_StaticPrefs() {
assert_eq!( assert_eq!(
::std::mem::size_of::<StylePrefs>(), ::std::mem::size_of::<StaticPrefs>(),
1usize, 1usize,
concat!("Size of: ", stringify!(StylePrefs)) concat!("Size of: ", stringify!(StaticPrefs))
); );
assert_eq!( assert_eq!(
::std::mem::align_of::<StylePrefs>(), ::std::mem::align_of::<StaticPrefs>(),
1usize, 1usize,
concat!("Alignment of ", stringify!(StylePrefs)) concat!("Alignment of ", stringify!(StaticPrefs))
); );
} }
impl Clone for StylePrefs { impl Clone for StaticPrefs {
fn clone(&self) -> Self { fn clone(&self) -> Self {
*self *self
} }

View file

@ -610,11 +610,11 @@ impl Expression {
let result = { let result = {
let mut feature_name = &**ident; 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-") { starts_with_ignore_ascii_case(feature_name, "-webkit-") {
feature_name = &feature_name[8..]; feature_name = &feature_name[8..];
flags |= structs::nsMediaFeature_RequirementFlags_eHasWebkitPrefix; 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; flags |= structs::nsMediaFeature_RequirementFlags_eWebkitDevicePixelRatioPrefEnabled;
} }
} }

View file

@ -179,7 +179,7 @@ impl NonTSPseudoClass {
// For pseudo-classes with pref, the availability in content // For pseudo-classes with pref, the availability in content
// depends on the pref. // depends on the pref.
NonTSPseudoClass::Fullscreen => 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 // Otherwise, a pseudo-class is enabled in content when it
// doesn't have any enabled flag. // doesn't have any enabled flag.
_ => !self.has_any_flag(NonTSPseudoClassFlag::PSEUDO_CLASS_ENABLED_IN_UA_SHEETS_AND_CHROME), _ => !self.has_any_flag(NonTSPseudoClassFlag::PSEUDO_CLASS_ENABLED_IN_UA_SHEETS_AND_CHROME),

View file

@ -220,11 +220,11 @@ impl DocumentCondition {
return true; return true;
} }
if unsafe { structs::StylePrefs_sMozDocumentEnabledInContent } { if unsafe { structs::StaticPrefs_sVarCache_layout_css_moz_document_content_enabled } {
return true; return true;
} }
if !unsafe { structs::StylePrefs_sMozDocumentURLPrefixHackEnabled } { if !unsafe { structs::StaticPrefs_sVarCache_layout_css_moz_document_url_prefix_hack_enabled } {
return false; return false;
} }

View file

@ -329,7 +329,7 @@ impl ToComputedValue for TrackList<LengthOrPercentage, Integer> {
#[inline] #[inline]
fn allow_grid_template_subgrids() -> bool { fn allow_grid_template_subgrids() -> bool {
use gecko_bindings::structs::mozilla; use gecko_bindings::structs::mozilla;
unsafe { mozilla::StylePrefs_sGridTemplateSubgridValueEnabled } unsafe { mozilla::StaticPrefs_sVarCache_layout_css_grid_template_subgrid_value_enabled }
} }
#[cfg(feature = "servo")] #[cfg(feature = "servo")]

View file

@ -28,7 +28,7 @@ fn is_context_value_enabled() -> bool {
// to read whenever we are on the main thread or the main thread is // to read whenever we are on the main thread or the main thread is
// blocked. // blocked.
use gecko_bindings::structs::mozilla; use gecko_bindings::structs::mozilla;
unsafe { mozilla::StylePrefs_sOpentypeSVGEnabled } unsafe { mozilla::StaticPrefs_sVarCache_gfx_font_rendering_opentype_svg_enabled }
} }
#[cfg(not(feature = "gecko"))] #[cfg(not(feature = "gecko"))]
fn is_context_value_enabled() -> bool { fn is_context_value_enabled() -> bool {

View file

@ -355,7 +355,7 @@ impl<S> OriginComponent<S> {
#[inline] #[inline]
fn allow_frames_timing() -> bool { fn allow_frames_timing() -> bool {
use gecko_bindings::structs::mozilla; use gecko_bindings::structs::mozilla;
unsafe { mozilla::StylePrefs_sFramesTimingFunctionEnabled } unsafe { mozilla::StaticPrefs_sVarCache_layout_css_frames_timing_enabled }
} }
#[cfg(feature = "servo")] #[cfg(feature = "servo")]