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.
This commit is contained in:
Boris Chiou 2017-08-09 19:15:03 +08:00
parent 5964be7721
commit a5433ad68a

View file

@ -78,7 +78,8 @@ impl ComputeSquaredDistance for CalcLengthOrPercentage {
// FIXME(nox): This looks incorrect to me, to add a distance between lengths // FIXME(nox): This looks incorrect to me, to add a distance between lengths
// with a distance between percentages. // with a distance between percentages.
Ok( 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())?, self.percentage().compute_squared_distance(&other.percentage())?,
) )
} }