style: Forbid accessing the length and percentage parts of a LengthPercentage separately.

This is just not a thing you can do if you have min() / max() / etc, as the min
/ max value may depend on the percentage basis.

Differential Revision: https://phabricator.services.mozilla.com/D60168
This commit is contained in:
Emilio Cobos Álvarez 2020-01-23 09:18:39 +00:00
parent e7e6e62ed3
commit 5237d4fac8
No known key found for this signature in database
GPG key ID: E1152D0994E4BF8A

View file

@ -1168,10 +1168,11 @@ impl ComputeSquaredDistance for ComputedTransformOperation {
// However, dropping percentage makes us impossible to compute
// the distance for the percentage-percentage case, but Gecko
// uses the same formula, so it's fine for now.
let fx = fx.length_component().px();
let fy = fy.length_component().px();
let tx = tx.length_component().px();
let ty = ty.length_component().px();
let basis = Length::new(0.);
let fx = fx.resolve(basis).px();
let fy = fy.resolve(basis).px();
let tx = tx.resolve(basis).px();
let ty = ty.resolve(basis).px();
Ok(fx.compute_squared_distance(&tx)? +
fy.compute_squared_distance(&ty)? +