mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-26 06:11:37 +00:00
Backed out changeset b7e1a728dfd2 (bug 1717161) for causing failures at perspective-zero-2.html. CLOSED TREE
This commit is contained in:
parent
711df33fa5
commit
8a0cd56061
@ -7649,9 +7649,10 @@ bool nsDisplayTransform::ComputePerspectiveMatrix(const nsIFrame* aFrame,
|
||||
}
|
||||
|
||||
MOZ_ASSERT(perspectiveDisplay->mChildPerspective.IsLength());
|
||||
float perspective =
|
||||
perspectiveDisplay->mChildPerspective.length._0.ToCSSPixels();
|
||||
perspective = std::max(1.0f, perspective);
|
||||
// TODO(emilio): Seems quite silly to go through app units just to convert to
|
||||
// float pixels below.
|
||||
nscoord perspective =
|
||||
perspectiveDisplay->mChildPerspective.length._0.ToAppUnits();
|
||||
if (perspective < std::numeric_limits<Float>::epsilon()) {
|
||||
return true;
|
||||
}
|
||||
@ -7678,8 +7679,7 @@ bool nsDisplayTransform::ComputePerspectiveMatrix(const nsIFrame* aFrame,
|
||||
perspectiveOrigin += frameToPerspectiveGfxOffset;
|
||||
|
||||
aOutMatrix._34 =
|
||||
-1.0 / NSAppUnitsToFloatPixels(CSSPixel::ToAppUnits(perspective),
|
||||
aAppUnitsPerPixel);
|
||||
-1.0 / NSAppUnitsToFloatPixels(perspective, aAppUnitsPerPixel);
|
||||
|
||||
aOutMatrix.ChangeBasis(Point3D(perspectiveOrigin.x, perspectiveOrigin.y, 0));
|
||||
return true;
|
||||
|
@ -39,8 +39,8 @@ enum class MatrixTransformOperator : uint8_t { Interpolate, Accumulate };
|
||||
// follows CSSWG's resolution on perspective(0). See bug 1316236.
|
||||
inline void ApplyPerspectiveToMatrix(mozilla::gfx::Matrix4x4& aMatrix,
|
||||
float aDepth) {
|
||||
if (aDepth > 0) {
|
||||
aMatrix.Perspective(std::max(aDepth, 1.0f));
|
||||
if (aDepth >= std::numeric_limits<float>::epsilon()) {
|
||||
aMatrix.Perspective(aDepth);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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().max(1.);
|
||||
if p.px() > 0. {
|
||||
p_matrix.m34 = -1. / p.px();
|
||||
}
|
||||
p_matrix.compute_squared_distance(&m)
|
||||
},
|
||||
|
@ -582,10 +582,17 @@ impl<T: ToMatrix> Transform<T> {
|
||||
/// Return the transform matrix from a perspective length.
|
||||
#[inline]
|
||||
pub fn create_perspective_matrix(d: CSSFloat) -> Transform3D<CSSFloat> {
|
||||
if d < 0.0 {
|
||||
// TODO(gw): The transforms spec says that perspective length must
|
||||
// be positive. However, there is some confusion between the spec
|
||||
// and browser implementations as to handling the case of 0 for the
|
||||
// perspective value. Until the spec bug is resolved, at least ensure
|
||||
// that a provided perspective value of <= 0.0 doesn't cause panics
|
||||
// and behaves as it does in other browsers.
|
||||
// See https://lists.w3.org/Archives/Public/www-style/2016Jan/0020.html for more details.
|
||||
if d <= 0.0 {
|
||||
Transform3D::identity()
|
||||
} else {
|
||||
Transform3D::perspective(d.max(1.))
|
||||
Transform3D::perspective(d)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -0,0 +1,2 @@
|
||||
[perspective-zero-2.html]
|
||||
expected: FAIL
|
@ -0,0 +1,2 @@
|
||||
[perspective-zero-3.html]
|
||||
expected: FAIL
|
@ -0,0 +1,2 @@
|
||||
[perspective-zero.html]
|
||||
expected: FAIL
|
@ -0,0 +1,2 @@
|
||||
[transform3d-perspective-005.html]
|
||||
expected: FAIL
|
@ -0,0 +1,4 @@
|
||||
[interpolation-per-property-002.html]
|
||||
[transform: perspective]
|
||||
expected: FAIL
|
||||
|
Loading…
Reference in New Issue
Block a user