From 323221051ff627cf3bc7d6d33c2e6fabf3a8d4b5 Mon Sep 17 00:00:00 2001 From: Nicholas Nethercote Date: Tue, 25 Jun 2019 10:36:59 +1000 Subject: [PATCH] style: Change `StaticPrefs` from a class to a namespace. This doesn't change the way C++ code uses static prefs. But it does slightly change how Rust code uses static prefs, specifically the name generated by bindgen is slightly different. The commit also improves some comments. Differential Revision: https://phabricator.services.mozilla.com/D35764 --- components/style/font_face.rs | 4 ++-- components/style/gecko/media_queries.rs | 2 +- components/style/gecko/pseudo_element_definition.mako.rs | 4 ++-- components/style/gecko/selector_parser.rs | 4 ++-- components/style/media_queries/media_feature_expression.rs | 2 +- components/style/properties/cascade.rs | 2 +- components/style/stylesheets/document_rule.rs | 4 ++-- components/style/stylesheets/supports_rule.rs | 2 +- components/style/values/generics/easing.rs | 2 +- components/style/values/generics/text.rs | 2 +- components/style/values/specified/basic_shape.rs | 2 +- components/style/values/specified/box.rs | 4 ++-- components/style/values/specified/grid.rs | 2 +- components/style/values/specified/svg.rs | 2 +- 14 files changed, 19 insertions(+), 19 deletions(-) diff --git a/components/style/font_face.rs b/components/style/font_face.rs index c8e7e65785b..50814c5f5e8 100644 --- a/components/style/font_face.rs +++ b/components/style/font_face.rs @@ -416,13 +416,13 @@ macro_rules! is_descriptor_enabled { ("font-display") => { unsafe { use crate::gecko_bindings::structs::mozilla; - mozilla::StaticPrefs_sVarCache_layout_css_font_display_enabled + mozilla::StaticPrefs::sVarCache_layout_css_font_display_enabled } }; ("font-variation-settings") => { unsafe { use crate::gecko_bindings::structs::mozilla; - mozilla::StaticPrefs_sVarCache_layout_css_font_variations_enabled != 0 + mozilla::StaticPrefs::sVarCache_layout_css_font_variations_enabled != 0 } }; ($name:tt) => { diff --git a/components/style/gecko/media_queries.rs b/components/style/gecko/media_queries.rs index 4c04d9573e5..459d58121ac 100644 --- a/components/style/gecko/media_queries.rs +++ b/components/style/gecko/media_queries.rs @@ -271,7 +271,7 @@ impl Device { return true; } let document_color_use = - unsafe { structs::StaticPrefs_sVarCache_browser_display_document_color_use }; + unsafe { structs::StaticPrefs::sVarCache_browser_display_document_color_use }; let prefs = self.pref_sheet_prefs(); match document_color_use { 1 => true, diff --git a/components/style/gecko/pseudo_element_definition.mako.rs b/components/style/gecko/pseudo_element_definition.mako.rs index a752d84c481..562b4c18444 100644 --- a/components/style/gecko/pseudo_element_definition.mako.rs +++ b/components/style/gecko/pseudo_element_definition.mako.rs @@ -112,7 +112,7 @@ impl PseudoElement { % for pseudo in PSEUDOS: ${pseudo_element_variant(pseudo)} => % if pseudo.is_tree_pseudo_element(): - if unsafe { structs::StaticPrefs_sVarCache_layout_css_xul_tree_pseudos_content_enabled } { + if unsafe { structs::StaticPrefs::sVarCache_layout_css_xul_tree_pseudos_content_enabled } { 0 } else { structs::CSS_PSEUDO_ELEMENT_ENABLED_IN_UA_SHEETS_AND_CHROME @@ -210,7 +210,7 @@ impl PseudoElement { return PseudoElement::tree_pseudo_element(name, Box::new([])) } if unsafe { - structs::StaticPrefs_sVarCache_layout_css_unknown_webkit_pseudo_element + structs::StaticPrefs::sVarCache_layout_css_unknown_webkit_pseudo_element } { const WEBKIT_PREFIX: &str = "-webkit-"; if starts_with_ignore_ascii_case(name, WEBKIT_PREFIX) { diff --git a/components/style/gecko/selector_parser.rs b/components/style/gecko/selector_parser.rs index fc27e1a8610..1da352249d4 100644 --- a/components/style/gecko/selector_parser.rs +++ b/components/style/gecko/selector_parser.rs @@ -175,7 +175,7 @@ impl NonTSPseudoClass { // For pseudo-classes with pref, the availability in content // depends on the pref. NonTSPseudoClass::Fullscreen => unsafe { - mozilla::StaticPrefs_sVarCache_full_screen_api_unprefix_enabled + mozilla::StaticPrefs::sVarCache_full_screen_api_unprefix_enabled }, // Otherwise, a pseudo-class is enabled in content when it // doesn't have any enabled flag. @@ -355,7 +355,7 @@ impl<'a, 'i> ::selectors::Parser<'i> for SelectorParser<'a> { #[inline] fn parse_part(&self) -> bool { self.chrome_rules_enabled() || - unsafe { structs::StaticPrefs_sVarCache_layout_css_shadow_parts_enabled } + unsafe { structs::StaticPrefs::sVarCache_layout_css_shadow_parts_enabled } } fn parse_non_ts_pseudo_class( diff --git a/components/style/media_queries/media_feature_expression.rs b/components/style/media_queries/media_feature_expression.rs index 5b5c4f4fad7..310cbd2b8bb 100644 --- a/components/style/media_queries/media_feature_expression.rs +++ b/components/style/media_queries/media_feature_expression.rs @@ -302,7 +302,7 @@ impl MediaFeatureExpression { feature_name = &feature_name[8..]; requirements.insert(ParsingRequirements::WEBKIT_PREFIX); if unsafe { - structs::StaticPrefs_sVarCache_layout_css_prefixes_device_pixel_ratio_webkit + structs::StaticPrefs::sVarCache_layout_css_prefixes_device_pixel_ratio_webkit } { requirements.insert( ParsingRequirements::WEBKIT_DEVICE_PIXEL_RATIO_PREF_ENABLED, diff --git a/components/style/properties/cascade.rs b/components/style/properties/cascade.rs index af6c563b319..1e362fb1bc4 100644 --- a/components/style/properties/cascade.rs +++ b/components/style/properties/cascade.rs @@ -686,7 +686,7 @@ impl<'a, 'b: 'a> Cascade<'a, 'b> { return; } - let use_document_fonts = unsafe { structs::StaticPrefs_sVarCache_browser_display_use_document_fonts != 0 }; + let use_document_fonts = unsafe { structs::StaticPrefs::sVarCache_browser_display_use_document_fonts != 0 }; let builder = &mut self.context.builder; let (default_font_type, prioritize_user_fonts) = { let font = builder.get_font().gecko(); diff --git a/components/style/stylesheets/document_rule.rs b/components/style/stylesheets/document_rule.rs index 8dd4306c179..62e814ac48b 100644 --- a/components/style/stylesheets/document_rule.rs +++ b/components/style/stylesheets/document_rule.rs @@ -260,12 +260,12 @@ impl DocumentCondition { return true; } - if unsafe { structs::StaticPrefs_sVarCache_layout_css_moz_document_content_enabled } { + if unsafe { structs::StaticPrefs::sVarCache_layout_css_moz_document_content_enabled } { return true; } if !unsafe { - structs::StaticPrefs_sVarCache_layout_css_moz_document_url_prefix_hack_enabled + structs::StaticPrefs::sVarCache_layout_css_moz_document_url_prefix_hack_enabled } { return false; } diff --git a/components/style/stylesheets/supports_rule.rs b/components/style/stylesheets/supports_rule.rs index a22acad1aa0..4b709974c7d 100644 --- a/components/style/stylesheets/supports_rule.rs +++ b/components/style/stylesheets/supports_rule.rs @@ -324,7 +324,7 @@ impl RawSelector { #[cfg(feature = "gecko")] { if unsafe { - !crate::gecko_bindings::structs::StaticPrefs_sVarCache_layout_css_supports_selector_enabled + !crate::gecko_bindings::structs::StaticPrefs::sVarCache_layout_css_supports_selector_enabled } { return false; } diff --git a/components/style/values/generics/easing.rs b/components/style/values/generics/easing.rs index 8817c3d2603..aab2ef547ba 100644 --- a/components/style/values/generics/easing.rs +++ b/components/style/values/generics/easing.rs @@ -70,7 +70,7 @@ pub enum TimingKeyword { #[cfg(feature = "gecko")] fn step_position_jump_enabled(_context: &ParserContext) -> bool { use crate::gecko_bindings::structs; - unsafe { structs::StaticPrefs_sVarCache_layout_css_step_position_jump_enabled } + unsafe { structs::StaticPrefs::sVarCache_layout_css_step_position_jump_enabled } } #[cfg(feature = "servo")] diff --git a/components/style/values/generics/text.rs b/components/style/values/generics/text.rs index a09260aa7e4..b55a9ad62dc 100644 --- a/components/style/values/generics/text.rs +++ b/components/style/values/generics/text.rs @@ -75,7 +75,7 @@ fn line_height_moz_block_height_enabled(context: &ParserContext) -> bool { use crate::gecko_bindings::structs; context.in_ua_sheet() || unsafe { - structs::StaticPrefs_sVarCache_layout_css_line_height_moz_block_height_content_enabled + structs::StaticPrefs::sVarCache_layout_css_line_height_moz_block_height_content_enabled } } diff --git a/components/style/values/specified/basic_shape.rs b/components/style/values/specified/basic_shape.rs index 7ee33d0580e..8dccf4594f0 100644 --- a/components/style/values/specified/basic_shape.rs +++ b/components/style/values/specified/basic_shape.rs @@ -60,7 +60,7 @@ pub type Polygon = generic::GenericPolygon; fn is_clip_path_path_enabled(context: &ParserContext) -> bool { use crate::gecko_bindings::structs::mozilla; context.chrome_rules_enabled() || - unsafe { mozilla::StaticPrefs_sVarCache_layout_css_clip_path_path_enabled } + unsafe { mozilla::StaticPrefs::sVarCache_layout_css_clip_path_path_enabled } } #[cfg(feature = "servo")] fn is_clip_path_path_enabled(_: &ParserContext) -> bool { diff --git a/components/style/values/specified/box.rs b/components/style/values/specified/box.rs index a64216087d7..3b8f1df005b 100644 --- a/components/style/values/specified/box.rs +++ b/components/style/values/specified/box.rs @@ -25,7 +25,7 @@ use style_traits::{SpecifiedValueInfo, StyleParseErrorKind, ToCss}; fn moz_display_values_enabled(context: &ParserContext) -> bool { use crate::gecko_bindings::structs; context.in_ua_or_chrome_sheet() || - unsafe { structs::StaticPrefs_sVarCache_layout_css_xul_display_values_content_enabled } + unsafe { structs::StaticPrefs::sVarCache_layout_css_xul_display_values_content_enabled } } #[cfg(feature = "gecko")] @@ -33,7 +33,7 @@ fn moz_box_display_values_enabled(context: &ParserContext) -> bool { use crate::gecko_bindings::structs; context.in_ua_or_chrome_sheet() || unsafe { - structs::StaticPrefs_sVarCache_layout_css_xul_box_display_values_content_enabled + structs::StaticPrefs::sVarCache_layout_css_xul_box_display_values_content_enabled } } diff --git a/components/style/values/specified/grid.rs b/components/style/values/specified/grid.rs index b3e18e66e8e..d91ae744d63 100644 --- a/components/style/values/specified/grid.rs +++ b/components/style/values/specified/grid.rs @@ -381,7 +381,7 @@ impl ToComputedValue for TrackList { #[inline] fn allow_grid_template_subgrids() -> bool { use crate::gecko_bindings::structs::mozilla; - unsafe { mozilla::StaticPrefs_sVarCache_layout_css_grid_template_subgrid_value_enabled } + unsafe { mozilla::StaticPrefs::sVarCache_layout_css_grid_template_subgrid_value_enabled } } #[cfg(feature = "servo")] diff --git a/components/style/values/specified/svg.rs b/components/style/values/specified/svg.rs index 2ce12ce467a..9acfad34723 100644 --- a/components/style/values/specified/svg.rs +++ b/components/style/values/specified/svg.rs @@ -36,7 +36,7 @@ pub type SVGStrokeDashArray = generic::SVGStrokeDashArray bool { use crate::gecko_bindings::structs::mozilla; - unsafe { mozilla::StaticPrefs_sVarCache_gfx_font_rendering_opentype_svg_enabled } + unsafe { mozilla::StaticPrefs::sVarCache_gfx_font_rendering_opentype_svg_enabled } } /// Whether the `context-value` value is enabled.