Bug 1209100 - Back out bug 1165185. a=lizzard
authorMarkus Stange <mstange@themasta.com>
Mon, 21 Mar 2016 16:45:32 -0400
changeset 323758 a8ef0ccf056ce8956b89cb9d16939c075ae0f167
parent 323757 a425d7a0ddb725d59ae9d506c9a0efaaecbdc236
child 323759 470551cf10ebceb65c7b36c4fb6d6f51c2974562
push id5913
push userjlund@mozilla.com
push dateMon, 25 Apr 2016 16:57:49 +0000
treeherdermozilla-beta@dcaf0a6fa115 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerslizzard
bugs1209100, 1165185
milestone47.0a2
Bug 1209100 - Back out bug 1165185. a=lizzard MozReview-Commit-ID: JqohyXNvjiU
gfx/2d/Matrix.h
gfx/layers/LayerTreeInvalidation.cpp
layout/base/FrameLayerBuilder.cpp
layout/reftests/backgrounds/vector/empty/reftest.list
layout/reftests/invalidation/fractional-transform-1.html
layout/reftests/invalidation/fractional-transform-2.html
layout/reftests/invalidation/fractional-transform-3.html
layout/reftests/invalidation/reftest.list
mfbt/FloatingPoint.h
--- a/gfx/2d/Matrix.h
+++ b/gfx/2d/Matrix.h
@@ -1246,34 +1246,16 @@ public:
     static const float error = 1e-5f;
     NudgeToInteger(&_41, error);
     NudgeToInteger(&_42, error);
     NudgeToInteger(&_43, error);
     NudgeToInteger(&_44, error);
     return *this;
   }
 
-  // Nudge the 3D components to integer so that this matrix will become 2D if
-  // it's very close to already being 2D.
-  // This doesn't change the _41 and _42 components.
-  Matrix4x4Typed &NudgeTo2D()
-  {
-    NudgeToInteger(&_13);
-    NudgeToInteger(&_14);
-    NudgeToInteger(&_23);
-    NudgeToInteger(&_24);
-    NudgeToInteger(&_31);
-    NudgeToInteger(&_32);
-    NudgeToInteger(&_33);
-    NudgeToInteger(&_34);
-    NudgeToInteger(&_43);
-    NudgeToInteger(&_44);
-    return *this;
-  }
-
   Point4D TransposedVector(int aIndex) const
   {
       MOZ_ASSERT(aIndex >= 0 && aIndex <= 3, "Invalid matrix array index");
       return Point4D(*((&_11)+aIndex), *((&_21)+aIndex), *((&_31)+aIndex), *((&_41)+aIndex));
   }
 
   void SetTransposedVector(int aIndex, Point4D &aVector)
   {
--- a/gfx/layers/LayerTreeInvalidation.cpp
+++ b/gfx/layers/LayerTreeInvalidation.cpp
@@ -166,17 +166,17 @@ struct LayerPropertiesBase : public Laye
                                          NotifySubDocInvalidationFunc aCallback,
                                          bool* aGeometryChanged);
 
   virtual void MoveBy(const IntPoint& aOffset);
 
   nsIntRegion ComputeChange(NotifySubDocInvalidationFunc aCallback,
                             bool& aGeometryChanged)
   {
-    bool transformChanged = !mTransform.FuzzyEqualsMultiplicative(GetTransformForInvalidation(mLayer)) ||
+    bool transformChanged = !mTransform.FuzzyEqual(GetTransformForInvalidation(mLayer)) ||
                              mLayer->GetPostXScale() != mPostXScale ||
                              mLayer->GetPostYScale() != mPostYScale;
     const Maybe<ParentLayerIntRect>& otherClip = mLayer->GetEffectiveClipRect();
     nsIntRegion result;
 
     bool ancestorMaskChanged = mAncestorMaskLayers.Length() != mLayer->GetAncestorMaskLayerCount();
     if (!ancestorMaskChanged) {
       for (size_t i = 0; i < mAncestorMaskLayers.Length(); i++) {
--- a/layout/base/FrameLayerBuilder.cpp
+++ b/layout/base/FrameLayerBuilder.cpp
@@ -4974,25 +4974,16 @@ ContainerState::Finish(uint32_t* aTextCo
   *aTextContentFlags = textContentFlags;
 }
 
 static inline gfxSize RoundToFloatPrecision(const gfxSize& aSize)
 {
   return gfxSize(float(aSize.width), float(aSize.height));
 }
 
-static inline gfxSize NudgedToIntegerSize(const gfxSize& aSize)
-{
-  float width = aSize.width;
-  float height = aSize.height;
-  gfx::NudgeToInteger(&width);
-  gfx::NudgeToInteger(&height);
-  return gfxSize(width, height);
-}
-
 static void RestrictScaleToMaxLayerSize(gfxSize& aScale,
                                         const nsRect& aVisibleRect,
                                         nsIFrame* aContainerFrame,
                                         Layer* aContainerLayer)
 {
   if (!aContainerLayer->Manager()->IsWidgetLayerManager()) {
     return;
   }
@@ -5028,23 +5019,22 @@ ChooseScaleAndSetTransform(FrameLayerBui
 {
   nsIntPoint offset;
 
   Matrix4x4 transform =
     Matrix4x4::Scaling(aIncomingScale.mXScale, aIncomingScale.mYScale, 1.0);
   if (aTransform) {
     // aTransform is applied first, then the scale is applied to the result
     transform = (*aTransform)*transform;
-    // Set relevant 3d matrix entries that are close to integers to be those
-    // exact integers. This protects against floating-point inaccuracies
-    // causing problems in the CanDraw2D / Is2D checks below.
-    // We don't nudge all matrix components here. In particular, we don't want to
-    // nudge the X/Y translation components, because those include the scroll
-    // offset, and we don't want scrolling to affect whether we nudge or not.
-    transform.NudgeTo2D();
+    // Set any matrix entries close to integers to be those exact integers.
+    // This protects against floating-point inaccuracies causing problems
+    // in the checks below.
+    // We use the fixed epsilon version here because we don't want the nudging
+    // to depend on the scroll position.
+    transform.NudgeToIntegersFixedEpsilon();
   }
   Matrix transform2d;
   if (aContainerFrame &&
       (aState == LAYER_INACTIVE || aState == LAYER_SVG_EFFECTS) &&
       (!aTransform || (aTransform->Is2D(&transform2d) &&
                        !transform2d.HasNonTranslation()))) {
     // When we have an inactive ContainerLayer, translate the container by the offset to the
     // reference frame (and offset all child layers by the reverse) so that the coordinate
@@ -5124,17 +5114,17 @@ ChooseScaleAndSetTransform(FrameLayerBui
             clamp = false;
           }
         }
         if (clamp) {
           scale.width = gfxUtils::ClampToScaleFactor(scale.width);
           scale.height = gfxUtils::ClampToScaleFactor(scale.height);
         }
       } else {
-        scale = NudgedToIntegerSize(scale);
+        // XXX Do we need to move nearly-integer values to integers here?
       }
     }
     // If the scale factors are too small, just use 1.0. The content is being
     // scaled out of sight anyway.
     if (fabs(scale.width) < 1e-8 || fabs(scale.height) < 1e-8) {
       scale = gfxSize(1.0, 1.0);
     }
     // If this is a transform container layer, then pre-rendering might
--- a/layout/reftests/backgrounds/vector/empty/reftest.list
+++ b/layout/reftests/backgrounds/vector/empty/reftest.list
@@ -1,17 +1,18 @@
 == tall--contain--height.html ref-tall-empty.html
 == tall--contain--width.html ref-tall-empty.html
 == wide--contain--height.html ref-wide-empty.html
 == wide--contain--width.html ref-wide-empty.html
 
-== tall--cover--height.html ref-tall-lime.html
-== tall--cover--width.html ref-tall-lime.html
-== wide--cover--height.html ref-wide-lime.html
-== wide--cover--width.html ref-wide-lime.html
+# These tests fail because of integer overflow; see bug 894555.
+fails == tall--cover--height.html ref-tall-lime.html
+fails == tall--cover--width.html ref-tall-lime.html
+fails == wide--cover--height.html ref-wide-lime.html
+fails == wide--cover--width.html ref-wide-lime.html
 
 == zero-height-ratio-contain.html ref-tall-empty.html
 == zero-height-ratio-cover.html ref-tall-empty.html
 == zero-height-ratio-auto-auto.html ref-tall-empty.html
 == zero-height-ratio-auto-5px.html ref-tall-empty.html
 == zero-height-ratio-5px-auto.html ref-tall-empty.html
 == zero-width-ratio-contain.html ref-tall-empty.html
 == zero-width-ratio-cover.html ref-tall-empty.html
deleted file mode 100644
--- a/layout/reftests/invalidation/fractional-transform-1.html
+++ /dev/null
@@ -1,36 +0,0 @@
-<!DOCTYPE html>
-<html lang="en" class="reftest-wait">
-<meta charset="utf-8">
-<title>Scrolling shouldn't invalidate either rect.</title>
-
-<style>
-body {
-  margin: 0;
-  height: 5000px;
-}
-</style>
-
-<body>
-
-<svg width="768" height="1000">
-
-  <g transform="translate(0 -2000.3234)">
-    <rect x="100" y="2300" height="50" width="50" fill="grey" class="reftest-no-paint"/>
-  </g>
-
-  <g transform="translate(0 -4000.6468)">
-    <rect x="200" y="4300" height="50" width="50" fill="grey" class="reftest-no-paint"/>
-  </g>
-
-</svg>
-
-<script>
-
-document.documentElement.scrollTop = 177;
-
-window.addEventListener("MozReftestInvalidate", function (e) {
-  document.documentElement.scrollTop = 30;
-  document.documentElement.removeAttribute("class");
-});
-
-</script>
deleted file mode 100644
--- a/layout/reftests/invalidation/fractional-transform-2.html
+++ /dev/null
@@ -1,32 +0,0 @@
-<!DOCTYPE html>
-<html lang="en" class="reftest-wait">
-<meta charset="utf-8">
-<title>Scrolling shouldn't invalidate the square.</title>
-
-<style>
-body {
-  margin: 0;
-  height: 5000px;
-}
-</style>
-
-<body>
-
-<svg width="768" height="1000">
-
-  <g transform="translate(0 112.152992)">
-    <rect x="100" y="650" height="50" width="50" fill="grey" class="reftest-no-paint"/>
-  </g>
-
-</svg>
-
-<script>
-
-document.documentElement.scrollTop = 709;
-
-window.addEventListener("MozReftestInvalidate", function (e) {
-  document.documentElement.scrollTop = 617;
-  document.documentElement.removeAttribute("class");
-});
-
-</script>
deleted file mode 100644
--- a/layout/reftests/invalidation/fractional-transform-3.html
+++ /dev/null
@@ -1,32 +0,0 @@
-<!DOCTYPE html>
-<html lang="en" class="reftest-wait">
-<meta charset="utf-8">
-<title>Scrolling shouldn't invalidate the square.</title>
-
-<style>
-body {
-  margin: 0;
-  height: 5000px;
-}
-</style>
-
-<body>
-
-<svg width="768" height="1000">
-
-  <g transform="translate(0 0.999948799610138)">
-    <rect x="100" y="100" height="50" width="50" fill="grey" class="reftest-no-paint"/>
-  </g>
-
-</svg>
-
-<script>
-
-document.documentElement.scrollTop = 11;
-
-window.addEventListener("MozReftestInvalidate", function (e) {
-  document.documentElement.scrollTop = 51;
-  document.documentElement.removeAttribute("class");
-});
-
-</script>
--- a/layout/reftests/invalidation/reftest.list
+++ b/layout/reftests/invalidation/reftest.list
@@ -63,15 +63,12 @@ pref(layers.single-tile.enabled,false) !
 != layer-splitting-3.html about:blank
 != layer-splitting-4.html about:blank
 != layer-splitting-5.html about:blank
 != layer-splitting-6.html about:blank
 != layer-splitting-7.html about:blank
 fuzzy-if(gtkWidget,2,4) fuzzy-if(asyncPan,2,3955) fuzzy-if(OSX,179,30) fuzzy-if(skiaContent,16,3230) == image-scrolling-zoom-1.html image-scrolling-zoom-1-ref.html
 != image-scrolling-zoom-1-ref.html image-scrolling-zoom-1-notref.html
 pref(layers.single-tile.enabled,false) != fast-scrolling.html about:blank
-!= fractional-transform-1.html about:blank
-!= fractional-transform-2.html about:blank
-!= fractional-transform-3.html about:blank
 == background-position-1.html background-position-1-ref.html
 == zero-opacity-animation.html about:blank
 == zero-opacity-text.html about:blank
 == negative-w-component.html negative-w-component-ref.html
--- a/mfbt/FloatingPoint.h
+++ b/mfbt/FloatingPoint.h
@@ -396,23 +396,16 @@ FuzzyEqualsAdditive(T aValue1, T aValue2
  * magnitude those numbers are at.
  */
 template<typename T>
 static MOZ_ALWAYS_INLINE bool
 FuzzyEqualsMultiplicative(T aValue1, T aValue2,
                           T aEpsilon = detail::FuzzyEqualsEpsilon<T>::value())
 {
   static_assert(IsFloatingPoint<T>::value, "floating point type required");
-
-  // Short-circuit the common case in order to avoid the expensive operations
-  // below.
-  if (aValue1 == aValue2) {
-    return true;
-  }
-
   // can't use std::min because of bug 965340
   T smaller = Abs(aValue1) < Abs(aValue2) ? Abs(aValue1) : Abs(aValue2);
   return Abs(aValue1 - aValue2) <= aEpsilon * smaller;
 }
 
 /**
  * Returns true if the given value can be losslessly represented as an IEEE-754
  * single format number, false otherwise.  All NaN values are considered