Refactor util::prefs operations to be methods on static struct.

This commit is contained in:
Corey Farwell 2016-07-02 13:51:17 -04:00
parent 307844a8c1
commit 22928f50ac
30 changed files with 166 additions and 162 deletions

View file

@ -59,7 +59,7 @@
% for value in values:
"${value}" => {
% if value in experimental_values:
if !::util::prefs::get_pref("layout.${value}.enabled")
if !::util::prefs::PREFS.get("layout.${value}.enabled")
.as_boolean().unwrap_or(false) {
return Err(())
}

View file

@ -950,7 +950,7 @@ impl PropertyDeclaration {
}
% endif
% if property.experimental:
if !::util::prefs::get_pref("${property.experimental}")
if !::util::prefs::PREFS.get("${property.experimental}")
.as_boolean().unwrap_or(false) {
return PropertyDeclarationParseResult::ExperimentalProperty
}
@ -975,7 +975,7 @@ impl PropertyDeclaration {
}
% endif
% if shorthand.experimental:
if !::util::prefs::get_pref("${shorthand.experimental}")
if !::util::prefs::PREFS.get("${shorthand.experimental}")
.as_boolean().unwrap_or(false) {
return PropertyDeclarationParseResult::ExperimentalProperty
}

View file

@ -499,7 +499,7 @@ impl<'a, 'b, Impl: SelectorImpl> AtRuleParser for NestedRuleParser<'a, 'b, Impl>
Ok(AtRuleType::WithBlock(AtRulePrelude::FontFace))
},
"viewport" => {
if ::util::prefs::get_pref("layout.viewport.enabled").as_boolean().unwrap_or(false) {
if ::util::prefs::PREFS.get("layout.viewport.enabled").as_boolean().unwrap_or(false) {
Ok(AtRuleType::WithBlock(AtRulePrelude::Viewport))
} else {
Err(())