mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
Filter out !important property in keyframes for stylo.
This commit is contained in:
parent
c6381c66a0
commit
a940999795
3 changed files with 48 additions and 6 deletions
|
@ -112,6 +112,40 @@ impl<'a> DoubleEndedIterator for DeclarationImportanceIterator<'a> {
|
|||
}
|
||||
}
|
||||
|
||||
/// Iterator over `PropertyDeclaration` for Importance::Normal.
|
||||
pub struct NormalDeclarationIterator<'a>(DeclarationImportanceIterator<'a>);
|
||||
|
||||
impl<'a> NormalDeclarationIterator<'a> {
|
||||
/// Constructor
|
||||
pub fn new(declarations: &'a [PropertyDeclaration], important: &'a SmallBitVec) -> Self {
|
||||
NormalDeclarationIterator(
|
||||
DeclarationImportanceIterator::new(declarations, important)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> Iterator for NormalDeclarationIterator<'a> {
|
||||
type Item = &'a PropertyDeclaration;
|
||||
|
||||
fn next(&mut self) -> Option<Self::Item> {
|
||||
loop {
|
||||
let next = self.0.iter.next();
|
||||
match next {
|
||||
Some((decl, importance)) => {
|
||||
if !importance {
|
||||
return Some(decl);
|
||||
}
|
||||
},
|
||||
None => return None,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn size_hint(&self) -> (usize, Option<usize>) {
|
||||
self.0.iter.size_hint()
|
||||
}
|
||||
}
|
||||
|
||||
/// Iterator for AnimationValue to be generated from PropertyDeclarationBlock.
|
||||
pub struct AnimationValueIterator<'a, 'cx, 'cx_a:'cx> {
|
||||
iter: DeclarationImportanceIterator<'a>,
|
||||
|
@ -208,6 +242,11 @@ impl PropertyDeclarationBlock {
|
|||
DeclarationImportanceIterator::new(&self.declarations, &self.declarations_importance)
|
||||
}
|
||||
|
||||
/// Iterate over `PropertyDeclaration` for Importance::Normal
|
||||
pub fn normal_declaration_iter(&self) -> NormalDeclarationIterator {
|
||||
NormalDeclarationIterator::new(&self.declarations, &self.declarations_importance)
|
||||
}
|
||||
|
||||
/// Return an iterator of (AnimatableLonghand, AnimationValue).
|
||||
pub fn to_animation_value_iter<'a, 'cx, 'cx_a:'cx>(&'a self,
|
||||
context: &'cx mut Context<'cx_a>,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue