diff --git a/components/style/properties/helpers/animated_properties.mako.rs b/components/style/properties/helpers/animated_properties.mako.rs index 1e72fb1cbc9..ee3f601cdb9 100644 --- a/components/style/properties/helpers/animated_properties.mako.rs +++ b/components/style/properties/helpers/animated_properties.mako.rs @@ -1453,11 +1453,10 @@ impl Animate for ComputedMatrix { (Ok(this), Ok(other)) => { Ok(ComputedMatrix::from(this.animate(&other, procedure)?)) }, - _ => { - let (this_weight, other_weight) = procedure.weights(); - let result = if this_weight > other_weight { *self } else { *other }; - Ok(result) - }, + // Matrices can be undecomposable due to couple reasons, e.g., + // non-invertible matrices. In this case, we should report Err + // here, and let the caller do the fallback procedure. + _ => Err(()) } } else { let this = MatrixDecomposed2D::from(*self); @@ -1477,11 +1476,10 @@ impl Animate for ComputedMatrix { (Ok(from), Ok(to)) => { Ok(ComputedMatrix::from(from.animate(&to, procedure)?)) }, - _ => { - let (this_weight, other_weight) = procedure.weights(); - let result = if this_weight > other_weight { *self } else { *other }; - Ok(result) - }, + // Matrices can be undecomposable due to couple reasons, e.g., + // non-invertible matrices. In this case, we should report Err here, + // and let the caller do the fallback procedure. + _ => Err(()) } } } diff --git a/ports/geckolib/glue.rs b/ports/geckolib/glue.rs index 0409ead88f5..18f7afb224f 100644 --- a/ports/geckolib/glue.rs +++ b/ports/geckolib/glue.rs @@ -2218,9 +2218,13 @@ pub extern "C" fn Servo_MatrixTransform_Operate(matrix_operator: MatrixTransform }; let output = unsafe { output.as_mut() }.expect("not a valid 'output' matrix"); - if let Ok(result) = result { + if let Ok(result) = result { *output = result.into(); - }; + } else if progress < 0.5 { + *output = from.clone().into(); + } else { + *output = to.clone().into(); + } } #[no_mangle]