From 5237d4fac8a81ec682a1f1121a77295ff354755a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emilio=20Cobos=20=C3=81lvarez?= Date: Thu, 23 Jan 2020 09:18:39 +0000 Subject: [PATCH] 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 --- components/style/values/animated/transform.rs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/components/style/values/animated/transform.rs b/components/style/values/animated/transform.rs index 3d93ae93f6d..621ae60084d 100644 --- a/components/style/values/animated/transform.rs +++ b/components/style/values/animated/transform.rs @@ -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)? +