style: Use static_prefs::pref!.

It's much nicer.

One nice thing about this is that the new code is subject to the existing
threadedness checking, which identified that several of these should be atomic
because they're accessed off the main thread.

Differential Revision: https://phabricator.services.mozilla.com/D40792
This commit is contained in:
Nicholas Nethercote 2019-08-07 22:58:55 +00:00 committed by Emilio Cobos Álvarez
parent ad1d028e40
commit bb032c1ddc
No known key found for this signature in database
GPG key ID: E1152D0994E4BF8A
17 changed files with 26 additions and 60 deletions

View file

@ -5,7 +5,7 @@
//! Gecko-specific bits for selector-parsing.
use crate::element_state::{DocumentState, ElementState};
use crate::gecko_bindings::structs::{self, RawServoSelectorList};
use crate::gecko_bindings::structs::RawServoSelectorList;
use crate::gecko_bindings::sugar::ownership::{HasBoxFFI, HasFFI, HasSimpleFFI};
use crate::invalidation::element::document_state::InvalidationMatchingData;
use crate::selector_parser::{Direction, SelectorParser};
@ -170,13 +170,10 @@ impl NonTSPseudoClass {
/// Returns whether the pseudo-class is enabled in content sheets.
fn is_enabled_in_content(&self) -> bool {
use crate::gecko_bindings::structs::mozilla;
match *self {
// For pseudo-classes with pref, the availability in content
// depends on the pref.
NonTSPseudoClass::Fullscreen => unsafe {
mozilla::StaticPrefs::sVarCache_full_screen_api_unprefix_enabled
},
NonTSPseudoClass::Fullscreen => static_prefs::pref!("full-screen-api.unprefix.enabled"),
// Otherwise, a pseudo-class is enabled in content when it
// doesn't have any enabled flag.
_ => !self
@ -354,8 +351,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 }
self.chrome_rules_enabled() || static_prefs::pref!("layout.css.shadow-parts.enabled")
}
fn parse_non_ts_pseudo_class(