Skip to content

Commit

Permalink
Convert StylePrefs to StaticPrefs.
Browse files Browse the repository at this point in the history
  • Loading branch information
nnethercote committed Apr 3, 2018
1 parent a208d42 commit 8705fb3
Show file tree
Hide file tree
Showing 9 changed files with 46 additions and 46 deletions.
4 changes: 2 additions & 2 deletions components/style/font_face.rs
Expand Up @@ -224,13 +224,13 @@ 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 }
Expand Down
2 changes: 1 addition & 1 deletion components/style/gecko/data.rs
Expand Up @@ -188,7 +188,7 @@ impl PerDocumentStyleDataImpl {

/// 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.
Expand Down
70 changes: 35 additions & 35 deletions components/style/gecko/generated/structs.rs
Expand Up @@ -11974,79 +11974,79 @@ pub mod root {
}
#[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;
#[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_StylePrefs() {
fn bindgen_test_layout_StaticPrefs() {
assert_eq!(
::std::mem::size_of::<StylePrefs>(),
::std::mem::size_of::<StaticPrefs>(),
1usize,
concat!("Size of: ", stringify!(StylePrefs))
concat!("Size of: ", stringify!(StaticPrefs))
);
assert_eq!(
::std::mem::align_of::<StylePrefs>(),
::std::mem::align_of::<StaticPrefs>(),
1usize,
concat!("Alignment of ", stringify!(StylePrefs))
concat!("Alignment of ", stringify!(StaticPrefs))
);
}
impl Clone for StylePrefs {
impl Clone for StaticPrefs {
fn clone(&self) -> Self {
*self
}
Expand Down
4 changes: 2 additions & 2 deletions components/style/gecko/media_queries.rs
Expand Up @@ -610,11 +610,11 @@ impl Expression {
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;
}
}
Expand Down
2 changes: 1 addition & 1 deletion components/style/gecko/selector_parser.rs
Expand Up @@ -179,7 +179,7 @@ impl NonTSPseudoClass {
// 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),
Expand Down
4 changes: 2 additions & 2 deletions components/style/stylesheets/document_rule.rs
Expand Up @@ -220,11 +220,11 @@ impl DocumentCondition {
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;
}

Expand Down
2 changes: 1 addition & 1 deletion components/style/values/specified/grid.rs
Expand Up @@ -329,7 +329,7 @@ impl ToComputedValue for TrackList<LengthOrPercentage, Integer> {
#[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")]
Expand Down
2 changes: 1 addition & 1 deletion components/style/values/specified/svg.rs
Expand Up @@ -28,7 +28,7 @@ fn is_context_value_enabled() -> bool {
// 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 {
Expand Down
2 changes: 1 addition & 1 deletion components/style/values/specified/transform.rs
Expand Up @@ -355,7 +355,7 @@ impl<S> OriginComponent<S> {
#[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")]
Expand Down

0 comments on commit 8705fb3

Please sign in to comment.