style: Clamp perspective() values to a minimum of 1px

Differential Revision: https://phabricator.services.mozilla.com/D118250
This commit is contained in:
Matt Woodrow 2023-05-22 09:56:09 +02:00 committed by Oriol Brufau
parent 2c5aa34bb0
commit f81ffda69d
2 changed files with 4 additions and 11 deletions

View file

@ -1204,8 +1204,8 @@ impl ComputeSquaredDistance for ComputedTransformOperation {
// FIXME(emilio): Is this right? Why interpolating this with
// Perspective but not with anything else?
let mut p_matrix = Matrix3D::identity();
if p.px() > 0. {
p_matrix.m34 = -1. / p.px();
if p.px() >= 0. {
p_matrix.m34 = -1. / p.px().max(1.);
}
p_matrix.compute_squared_distance(&m)
},