Make PropertyDeclarationBlock fields private

This commit is contained in:
Simon Sapin 2017-03-07 19:30:51 +01:00
parent da4e5146e9
commit f70a49974a
8 changed files with 31 additions and 33 deletions

View file

@ -40,20 +40,13 @@ impl Importance {
}
}
impl Default for Importance {
#[inline]
fn default() -> Self {
Importance::Normal
}
}
/// Overridden declarations are skipped.
#[derive(Debug, PartialEq, Clone)]
pub struct PropertyDeclarationBlock {
/// The group of declarations, along with their importance.
///
/// Only deduplicated declarations appear here.
pub declarations: Vec<(PropertyDeclaration, Importance)>,
declarations: Vec<(PropertyDeclaration, Importance)>,
/// The number of entries in `self.declaration` with `Importance::Important`
important_count: usize,
@ -76,6 +69,11 @@ impl PropertyDeclarationBlock {
}
}
/// The declarations in this block
pub fn declarations(&self) -> &[(PropertyDeclaration, Importance)] {
&self.declarations
}
/// Returns wheather this block contains any declaration with `!important`.
///
/// This is based on the `important_count` counter,

View file

@ -1817,7 +1817,7 @@ pub fn cascade(viewport_size: Size2D<Au>,
}).collect::<Vec<_>>();
let iter_declarations = || {
lock_guards.iter().flat_map(|&(ref source, source_importance)| {
source.declarations.iter()
source.declarations().iter()
// Yield declarations later in source order (with more precedence) first.
.rev()
.filter_map(move |&(ref declaration, declaration_importance)| {