From a5433ad68a26bcf410a5c6784f0a38652e0d677b Mon Sep 17 00:00:00 2001 From: Boris Chiou Date: Wed, 9 Aug 2017 19:15:03 +0800 Subject: [PATCH] Tweak CalcLengthOrPercentage to use pixel value. We compute the distance for eCSSUnit_Calc by pixel value in Gecko, so let's follow the same rules. --- components/style/values/computed/length.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/components/style/values/computed/length.rs b/components/style/values/computed/length.rs index fbe3b56e724..402ec36552a 100644 --- a/components/style/values/computed/length.rs +++ b/components/style/values/computed/length.rs @@ -78,7 +78,8 @@ impl ComputeSquaredDistance for CalcLengthOrPercentage { // FIXME(nox): This looks incorrect to me, to add a distance between lengths // with a distance between percentages. Ok( - self.unclamped_length().compute_squared_distance(&other.unclamped_length())? + + self.unclamped_length().to_f64_px().compute_squared_distance( + &other.unclamped_length().to_f64_px())? + self.percentage().compute_squared_distance(&other.percentage())?, ) }