mirror of
https://github.com/servo/servo.git
synced 2025-08-08 06:55:31 +01:00
style: Animate logical properties.
The setup is that AnimationValue only contains physical properties, and we physicalize when building keyframes and transitions. Bug: 1309752 Reviewed-by: birtles MozReview-Commit-ID: 9dI20N0LFrk
This commit is contained in:
parent
be9acba801
commit
5504cbdfd7
4 changed files with 121 additions and 59 deletions
|
@ -131,12 +131,15 @@ impl<'a> DoubleEndedIterator for DeclarationImportanceIterator<'a> {
|
|||
}
|
||||
|
||||
/// Iterator over `PropertyDeclaration` for Importance::Normal.
|
||||
///
|
||||
/// TODO(emilio): This should be replaced by `impl Trait`, returning a
|
||||
/// filter()ed iterator when available instead, and all the boilerplate below
|
||||
/// should go.
|
||||
pub struct NormalDeclarationIterator<'a>(DeclarationImportanceIterator<'a>);
|
||||
|
||||
impl<'a> NormalDeclarationIterator<'a> {
|
||||
/// Constructor.
|
||||
#[inline]
|
||||
pub fn new(declarations: &'a [PropertyDeclaration], important: &'a SmallBitVec) -> Self {
|
||||
fn new(declarations: &'a [PropertyDeclaration], important: &'a SmallBitVec) -> Self {
|
||||
NormalDeclarationIterator(
|
||||
DeclarationImportanceIterator::new(declarations, important)
|
||||
)
|
||||
|
@ -146,6 +149,7 @@ impl<'a> NormalDeclarationIterator<'a> {
|
|||
impl<'a> Iterator for NormalDeclarationIterator<'a> {
|
||||
type Item = &'a PropertyDeclaration;
|
||||
|
||||
#[inline]
|
||||
fn next(&mut self) -> Option<Self::Item> {
|
||||
loop {
|
||||
let (decl, importance) = self.0.iter.next()?;
|
||||
|
@ -155,11 +159,24 @@ impl<'a> Iterator for NormalDeclarationIterator<'a> {
|
|||
}
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn size_hint(&self) -> (usize, Option<usize>) {
|
||||
self.0.iter.size_hint()
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> DoubleEndedIterator for NormalDeclarationIterator<'a> {
|
||||
#[inline]
|
||||
fn next_back(&mut self) -> Option<Self::Item> {
|
||||
loop {
|
||||
let (decl, importance) = self.0.iter.next_back()?;
|
||||
if !importance {
|
||||
return Some(decl);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Iterator for AnimationValue to be generated from PropertyDeclarationBlock.
|
||||
pub struct AnimationValueIterator<'a, 'cx, 'cx_a:'cx> {
|
||||
iter: NormalDeclarationIterator<'a>,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue