mirror of
https://github.com/servo/servo.git
synced 2025-08-05 21:50:18 +01:00
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
This commit is contained in:
parent
84a5ab2ba8
commit
323221051f
14 changed files with 19 additions and 19 deletions
|
@ -416,13 +416,13 @@ macro_rules! is_descriptor_enabled {
|
||||||
("font-display") => {
|
("font-display") => {
|
||||||
unsafe {
|
unsafe {
|
||||||
use crate::gecko_bindings::structs::mozilla;
|
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") => {
|
("font-variation-settings") => {
|
||||||
unsafe {
|
unsafe {
|
||||||
use crate::gecko_bindings::structs::mozilla;
|
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) => {
|
($name:tt) => {
|
||||||
|
|
|
@ -271,7 +271,7 @@ impl Device {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
let document_color_use =
|
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();
|
let prefs = self.pref_sheet_prefs();
|
||||||
match document_color_use {
|
match document_color_use {
|
||||||
1 => true,
|
1 => true,
|
||||||
|
|
|
@ -112,7 +112,7 @@ impl PseudoElement {
|
||||||
% for pseudo in PSEUDOS:
|
% for pseudo in PSEUDOS:
|
||||||
${pseudo_element_variant(pseudo)} =>
|
${pseudo_element_variant(pseudo)} =>
|
||||||
% if pseudo.is_tree_pseudo_element():
|
% 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
|
0
|
||||||
} else {
|
} else {
|
||||||
structs::CSS_PSEUDO_ELEMENT_ENABLED_IN_UA_SHEETS_AND_CHROME
|
structs::CSS_PSEUDO_ELEMENT_ENABLED_IN_UA_SHEETS_AND_CHROME
|
||||||
|
@ -210,7 +210,7 @@ impl PseudoElement {
|
||||||
return PseudoElement::tree_pseudo_element(name, Box::new([]))
|
return PseudoElement::tree_pseudo_element(name, Box::new([]))
|
||||||
}
|
}
|
||||||
if unsafe {
|
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-";
|
const WEBKIT_PREFIX: &str = "-webkit-";
|
||||||
if starts_with_ignore_ascii_case(name, WEBKIT_PREFIX) {
|
if starts_with_ignore_ascii_case(name, WEBKIT_PREFIX) {
|
||||||
|
|
|
@ -175,7 +175,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 => unsafe {
|
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
|
// Otherwise, a pseudo-class is enabled in content when it
|
||||||
// doesn't have any enabled flag.
|
// doesn't have any enabled flag.
|
||||||
|
@ -355,7 +355,7 @@ impl<'a, 'i> ::selectors::Parser<'i> for SelectorParser<'a> {
|
||||||
#[inline]
|
#[inline]
|
||||||
fn parse_part(&self) -> bool {
|
fn parse_part(&self) -> bool {
|
||||||
self.chrome_rules_enabled() ||
|
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(
|
fn parse_non_ts_pseudo_class(
|
||||||
|
|
|
@ -302,7 +302,7 @@ impl MediaFeatureExpression {
|
||||||
feature_name = &feature_name[8..];
|
feature_name = &feature_name[8..];
|
||||||
requirements.insert(ParsingRequirements::WEBKIT_PREFIX);
|
requirements.insert(ParsingRequirements::WEBKIT_PREFIX);
|
||||||
if unsafe {
|
if unsafe {
|
||||||
structs::StaticPrefs_sVarCache_layout_css_prefixes_device_pixel_ratio_webkit
|
structs::StaticPrefs::sVarCache_layout_css_prefixes_device_pixel_ratio_webkit
|
||||||
} {
|
} {
|
||||||
requirements.insert(
|
requirements.insert(
|
||||||
ParsingRequirements::WEBKIT_DEVICE_PIXEL_RATIO_PREF_ENABLED,
|
ParsingRequirements::WEBKIT_DEVICE_PIXEL_RATIO_PREF_ENABLED,
|
||||||
|
|
|
@ -686,7 +686,7 @@ impl<'a, 'b: 'a> Cascade<'a, 'b> {
|
||||||
return;
|
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 builder = &mut self.context.builder;
|
||||||
let (default_font_type, prioritize_user_fonts) = {
|
let (default_font_type, prioritize_user_fonts) = {
|
||||||
let font = builder.get_font().gecko();
|
let font = builder.get_font().gecko();
|
||||||
|
|
|
@ -260,12 +260,12 @@ impl DocumentCondition {
|
||||||
return true;
|
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;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if !unsafe {
|
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;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -324,7 +324,7 @@ impl RawSelector {
|
||||||
#[cfg(feature = "gecko")]
|
#[cfg(feature = "gecko")]
|
||||||
{
|
{
|
||||||
if unsafe {
|
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;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -70,7 +70,7 @@ pub enum TimingKeyword {
|
||||||
#[cfg(feature = "gecko")]
|
#[cfg(feature = "gecko")]
|
||||||
fn step_position_jump_enabled(_context: &ParserContext) -> bool {
|
fn step_position_jump_enabled(_context: &ParserContext) -> bool {
|
||||||
use crate::gecko_bindings::structs;
|
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")]
|
#[cfg(feature = "servo")]
|
||||||
|
|
|
@ -75,7 +75,7 @@ fn line_height_moz_block_height_enabled(context: &ParserContext) -> bool {
|
||||||
use crate::gecko_bindings::structs;
|
use crate::gecko_bindings::structs;
|
||||||
context.in_ua_sheet() ||
|
context.in_ua_sheet() ||
|
||||||
unsafe {
|
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
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -60,7 +60,7 @@ pub type Polygon = generic::GenericPolygon<LengthPercentage>;
|
||||||
fn is_clip_path_path_enabled(context: &ParserContext) -> bool {
|
fn is_clip_path_path_enabled(context: &ParserContext) -> bool {
|
||||||
use crate::gecko_bindings::structs::mozilla;
|
use crate::gecko_bindings::structs::mozilla;
|
||||||
context.chrome_rules_enabled() ||
|
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")]
|
#[cfg(feature = "servo")]
|
||||||
fn is_clip_path_path_enabled(_: &ParserContext) -> bool {
|
fn is_clip_path_path_enabled(_: &ParserContext) -> bool {
|
||||||
|
|
|
@ -25,7 +25,7 @@ use style_traits::{SpecifiedValueInfo, StyleParseErrorKind, ToCss};
|
||||||
fn moz_display_values_enabled(context: &ParserContext) -> bool {
|
fn moz_display_values_enabled(context: &ParserContext) -> bool {
|
||||||
use crate::gecko_bindings::structs;
|
use crate::gecko_bindings::structs;
|
||||||
context.in_ua_or_chrome_sheet() ||
|
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")]
|
#[cfg(feature = "gecko")]
|
||||||
|
@ -33,7 +33,7 @@ fn moz_box_display_values_enabled(context: &ParserContext) -> bool {
|
||||||
use crate::gecko_bindings::structs;
|
use crate::gecko_bindings::structs;
|
||||||
context.in_ua_or_chrome_sheet() ||
|
context.in_ua_or_chrome_sheet() ||
|
||||||
unsafe {
|
unsafe {
|
||||||
structs::StaticPrefs_sVarCache_layout_css_xul_box_display_values_content_enabled
|
structs::StaticPrefs::sVarCache_layout_css_xul_box_display_values_content_enabled
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -381,7 +381,7 @@ impl ToComputedValue for TrackList<LengthPercentage, Integer> {
|
||||||
#[inline]
|
#[inline]
|
||||||
fn allow_grid_template_subgrids() -> bool {
|
fn allow_grid_template_subgrids() -> bool {
|
||||||
use crate::gecko_bindings::structs::mozilla;
|
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")]
|
#[cfg(feature = "servo")]
|
||||||
|
|
|
@ -36,7 +36,7 @@ pub type SVGStrokeDashArray = generic::SVGStrokeDashArray<NonNegativeLengthPerce
|
||||||
#[cfg(feature = "gecko")]
|
#[cfg(feature = "gecko")]
|
||||||
pub fn is_context_value_enabled() -> bool {
|
pub fn is_context_value_enabled() -> bool {
|
||||||
use crate::gecko_bindings::structs::mozilla;
|
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.
|
/// Whether the `context-value` value is enabled.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue