Auto merge of #12178 - frewsxcv:prefs, r=emilio

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

<!-- Please describe your changes on the following line: -->

---
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: -->
- [X] `./mach build -d` does not report any errors
- [X] `./mach test-tidy` does not report any errors
- [ ] These changes fix #__ (github issue number if applicable).

<!-- Either: -->
- [ ] There are tests for these changes OR
- [X] These changes do not require tests because _____

<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="35" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/12178)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2016-07-03 08:19:04 -07:00 committed by GitHub
commit b0a8ce5341
30 changed files with 167 additions and 163 deletions

View file

@ -58,7 +58,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(())