From 172b4aaddacdeb6eeb70821ffe5762fd713e857d Mon Sep 17 00:00:00 2001 From: Boris Chiou Date: Mon, 21 Aug 2017 14:58:41 +0800 Subject: [PATCH] Use rewritten decomposition of 2d matrix to compute distance. So we can align the result with interpolation. --- .../properties/helpers/animated_properties.mako.rs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/components/style/properties/helpers/animated_properties.mako.rs b/components/style/properties/helpers/animated_properties.mako.rs index 08afe9308de..683c23555ce 100644 --- a/components/style/properties/helpers/animated_properties.mako.rs +++ b/components/style/properties/helpers/animated_properties.mako.rs @@ -1443,6 +1443,7 @@ impl Animate for ComputedMatrix { impl ComputeSquaredDistance for ComputedMatrix { #[inline] + #[cfg(feature = "servo")] fn compute_squared_distance(&self, other: &Self) -> Result { if self.is_3d() || other.is_3d() { let from = decompose_3d_matrix(*self)?; @@ -1454,6 +1455,17 @@ impl ComputeSquaredDistance for ComputedMatrix { from.compute_squared_distance(&to) } } + + #[inline] + #[cfg(feature = "gecko")] + fn compute_squared_distance(&self, other: &Self) -> Result { + let (from, to) = if self.is_3d() || other.is_3d() { + (decompose_3d_matrix(*self)?, decompose_3d_matrix(*other)?) + } else { + (decompose_2d_matrix(self)?, decompose_2d_matrix(other)?) + }; + from.compute_squared_distance(&to) + } } impl From for MatrixDecomposed2D {