mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
Make PropertyDeclarationBlock fields private
This commit is contained in:
parent
da4e5146e9
commit
f70a49974a
8 changed files with 31 additions and 33 deletions
|
@ -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,
|
||||
|
|
|
@ -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)| {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue