style: Make will-change honor prefs properly, and clean it up while at it.

Bug: 1466008
Reviewed-by: xidorn
MozReview-Commit-ID: JyzwaRgf5Ct
This commit is contained in:
Emilio Cobos Álvarez 2018-06-01 11:35:57 +02:00
parent 93472bcdea
commit 5db1387f39
No known key found for this signature in database
GPG key ID: 056B727BB9C1027C
3 changed files with 103 additions and 66 deletions

View file

@ -1715,7 +1715,8 @@ impl PropertyId {
}
}
fn non_custom_id(&self) -> Option<NonCustomPropertyId> {
/// Returns the non-custom property id for this property.
pub fn non_custom_id(&self) -> Option<NonCustomPropertyId> {
Some(match *self {
PropertyId::Custom(_) => return None,
PropertyId::Shorthand(shorthand_id) => shorthand_id.into(),
@ -1750,7 +1751,8 @@ impl PropertyId {
id.enabled_for_all_content()
}
fn allowed_in(&self, context: &ParserContext) -> bool {
/// Returns whether the property is allowed in a given context.
pub fn allowed_in(&self, context: &ParserContext) -> bool {
let id = match self.non_custom_id() {
// Custom properties are allowed everywhere
None => return true,