style: Refactor some enabledness checks.

There are some common checks that could get some easy-to-use aliases.

Differential Revision: https://phabricator.services.mozilla.com/D25117
This commit is contained in:
Emilio Cobos Álvarez 2019-03-29 11:12:12 +00:00
parent 76c0ae565e
commit bd77cd64b9
4 changed files with 111 additions and 105 deletions

View file

@ -223,8 +223,7 @@ impl SupportsCondition {
#[cfg(feature = "gecko")]
fn eval_moz_bool_pref(name: &CStr, cx: &ParserContext) -> bool {
use crate::gecko_bindings::bindings;
use crate::stylesheets::Origin;
if cx.stylesheet_origin != Origin::UserAgent && !cx.chrome_rules_enabled() {
if !cx.in_ua_or_chrome_sheet() {
return false;
}
unsafe { bindings::Gecko_GetBoolPrefValue(name.as_ptr()) }