mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
style: Implement the smarter interporation for transform.
Corresponding to this spec change;
32812668df
The expected value in test_transitions_per_property.html can be calculated;
'start' + ('end' - 'start') * 0.25
Bug: 1464647
Reviewed-by: birtles, emilio
MozReview-Commit-ID: NI9gOUuPnG
This commit is contained in:
parent
f0fbcf204e
commit
378fcc2b6a
1 changed files with 25 additions and 0 deletions
|
@ -2564,6 +2564,31 @@ impl Animate for ComputedTransform {
|
|||
owned_other = other;
|
||||
}
|
||||
|
||||
// https://drafts.csswg.org/css-transforms-1/#transform-transform-neutral-extend-animation
|
||||
fn match_operations_if_possible(
|
||||
this: &mut Vec<ComputedTransformOperation>,
|
||||
other: &mut Vec<ComputedTransformOperation>,
|
||||
) -> Result<(), ()> {
|
||||
if !this.iter().zip(other.iter()).all(|(this, other)| is_matched_operation(this, other)) {
|
||||
return Err(());
|
||||
}
|
||||
|
||||
if this.len() == other.len() {
|
||||
return Ok(())
|
||||
}
|
||||
|
||||
let (shorter, longer) = if this.len() < other.len() { (this, other) } else { (other, this) };
|
||||
shorter.reserve(longer.len());
|
||||
for op in longer.iter().skip(shorter.len()) {
|
||||
shorter.push(op.to_animated_zero()?);
|
||||
}
|
||||
Ok(())
|
||||
};
|
||||
|
||||
if match_operations_if_possible(&mut owned_this, &mut owned_other).is_ok() {
|
||||
return animate_equal_lists(&owned_this, &owned_other)
|
||||
}
|
||||
|
||||
match procedure {
|
||||
Procedure::Add => Err(()),
|
||||
Procedure::Interpolate { progress } => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue