aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBoris Chiou <boris.chiou@gmail.com>2017-08-21 14:58:41 +0800
committerBoris Chiou <boris.chiou@gmail.com>2017-08-23 17:10:29 +0800
commit172b4aaddacdeb6eeb70821ffe5762fd713e857d (patch)
treec0e712d518dfa8c25a40241bd9b119d2be7e3335
parent9b76cd9d1c2353d9e9f1edc38e609ecce9252526 (diff)
downloadservo-172b4aaddacdeb6eeb70821ffe5762fd713e857d.tar.gz
servo-172b4aaddacdeb6eeb70821ffe5762fd713e857d.zip
Use rewritten decomposition of 2d matrix to compute distance.
So we can align the result with interpolation.
-rw-r--r--components/style/properties/helpers/animated_properties.mako.rs12
1 files changed, 12 insertions, 0 deletions
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<SquaredDistance, ()> {
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<SquaredDistance, ()> {
+ 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<ComputedMatrix> for MatrixDecomposed2D {