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:
Hiroyuki Ikezoe 2018-05-29 12:33:16 +09:00 committed by Emilio Cobos Álvarez
parent f0fbcf204e
commit 378fcc2b6a
No known key found for this signature in database
GPG key ID: 056B727BB9C1027C

View file

@ -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 } => {