Make PropertyDeclarationBlock::important_count private.

This commit is contained in:
Simon Sapin 2017-03-07 19:45:12 +01:00
parent 460fd6eba8
commit da4e5146e9
10 changed files with 183 additions and 219 deletions

View file

@ -56,7 +56,7 @@ pub struct PropertyDeclarationBlock {
pub declarations: Vec<(PropertyDeclaration, Importance)>,
/// The number of entries in `self.declaration` with `Importance::Important`
pub important_count: usize,
important_count: usize,
}
impl PropertyDeclarationBlock {
@ -68,6 +68,14 @@ impl PropertyDeclarationBlock {
}
}
/// Create a block with a single declaration
pub fn with_one(declaration: PropertyDeclaration, importance: Importance) -> Self {
PropertyDeclarationBlock {
declarations: vec![(declaration, importance)],
important_count: if importance.important() { 1 } else { 0 },
}
}
/// Returns wheather this block contains any declaration with `!important`.
///
/// This is based on the `important_count` counter,

View file

@ -168,23 +168,19 @@ impl ComputedValues {
% for prop in data.longhands:
% if prop.animatable:
PropertyDeclarationId::Longhand(LonghandId::${prop.camel_case}) => {
PropertyDeclarationBlock {
declarations: vec![
(PropertyDeclaration::${prop.camel_case}(DeclaredValue::Value(
% if prop.boxed:
Box::new(
% endif
longhands::${prop.ident}::SpecifiedValue::from_computed_value(
&self.get_${prop.style_struct.ident.strip("_")}().clone_${prop.ident}())
% if prop.boxed:
)
% endif
)),
Importance::Normal)
],
important_count: 0
}
PropertyDeclarationBlock::with_one(
PropertyDeclaration::${prop.camel_case}(DeclaredValue::Value(
% if prop.boxed:
Box::new(
% endif
longhands::${prop.ident}::SpecifiedValue::from_computed_value(
&self.get_${prop.style_struct.ident.strip("_")}().clone_${prop.ident}())
% if prop.boxed:
)
% endif
)),
Importance::Normal
)
},
% endif
% endfor