Bug 1316236: Treat zero perspective as inf perspective. r?xidorn draft
authorMilan Sreckovic <milan@mozilla.com>
Mon, 16 Jan 2017 15:53:30 -0500
changeset 462220 28481267b58814c803dedc339528799c63fdc653
parent 460673 de67fccc4c64a49f261aea29141357b94c7b3b9c
child 542324 303880fa1d7238c1e32c92a0b22305614dd50a8f
push id41679
push userbmo:milan@mozilla.com
push dateMon, 16 Jan 2017 20:55:28 +0000
reviewersxidorn
bugs1316236
milestone53.0a1
Bug 1316236: Treat zero perspective as inf perspective. r?xidorn MozReview-Commit-ID: 8BE0vLsxbdS
layout/style/nsStyleTransformMatrix.cpp
--- a/layout/style/nsStyleTransformMatrix.cpp
+++ b/layout/style/nsStyleTransformMatrix.cpp
@@ -746,21 +746,22 @@ static void
 ProcessPerspective(Matrix4x4& aMatrix,
                    const nsCSSValue::Array* aData,
                    nsStyleContext *aContext,
                    nsPresContext *aPresContext,
                    RuleNodeCacheConditions& aConditions)
 {
   NS_PRECONDITION(aData->Count() == 2, "Invalid array!");
 
-  float depth = std::max(ProcessTranslatePart(aData->Item(1), aContext,
-                                              aPresContext, aConditions,
-                                              nullptr),
-                         std::numeric_limits<float>::epsilon());
-  aMatrix.Perspective(depth);
+  float depth = ProcessTranslatePart(aData->Item(1), aContext,
+                                     aPresContext, aConditions,
+                                     nullptr);
+  if (depth > 0) {
+    aMatrix.Perspective(depth);
+  }
 }
 
 
 /**
  * SetToTransformFunction is essentially a giant switch statement that fans
  * out to many smaller helper functions.
  */
 static void