Back out bug 1008301 for causing bug 1021564 and bug 1025914. a=backout
authorMarkus Stange <mstange@themasta.com>
Tue, 15 Jul 2014 17:39:43 +0200
changeset 207990 0fcb1dc73d58a2aeed2f616f471fb9700016575f
parent 207989 453aa9ce05b87eac3386917c6b879aed4d099223
child 207991 8d5e337d433bf0a79f7919ac2ce9eef108ea629c
push id3741
push userasasaki@mozilla.com
push dateMon, 21 Jul 2014 20:25:18 +0000
treeherdermozilla-beta@4d6f46f5af68 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbackout
bugs1008301, 1021564, 1025914
milestone32.0a2
Back out bug 1008301 for causing bug 1021564 and bug 1025914. a=backout
gfx/layers/LayerTreeInvalidation.cpp
layout/base/DisplayItemClip.cpp
layout/base/FrameLayerBuilder.cpp
layout/reftests/invalidation/inactive-layertree-visible-region-1.html
layout/reftests/invalidation/inactive-layertree-visible-region-2.html
layout/reftests/invalidation/reftest.list
--- a/gfx/layers/LayerTreeInvalidation.cpp
+++ b/gfx/layers/LayerTreeInvalidation.cpp
@@ -97,18 +97,16 @@ NotifySubdocumentInvalidationRecursive(L
 
 struct LayerPropertiesBase : public LayerProperties
 {
   LayerPropertiesBase(Layer* aLayer)
     : mLayer(aLayer)
     , mMaskLayer(nullptr)
     , mVisibleRegion(aLayer->GetVisibleRegion())
     , mInvalidRegion(aLayer->GetInvalidRegion())
-    , mPostXScale(aLayer->GetPostXScale())
-    , mPostYScale(aLayer->GetPostYScale())
     , mOpacity(aLayer->GetLocalOpacity())
     , mUseClipRect(!!aLayer->GetClipRect())
   {
     MOZ_COUNT_CTOR(LayerPropertiesBase);
     if (aLayer->GetMaskLayer()) {
       mMaskLayer = CloneLayerTreePropertiesInternal(aLayer->GetMaskLayer());
     }
     if (mUseClipRect) {
@@ -133,19 +131,17 @@ struct LayerPropertiesBase : public Laye
 
   virtual void MoveBy(const nsIntPoint& aOffset);
 
   nsIntRegion ComputeChange(NotifySubDocInvalidationFunc aCallback,
                             bool& aGeometryChanged)
   {
     gfx3DMatrix transform;
     gfx::To3DMatrix(mLayer->GetTransform(), transform);
-    bool transformChanged = !mTransform.FuzzyEqual(transform) ||
-                            mLayer->GetPostXScale() != mPostXScale ||
-                            mLayer->GetPostYScale() != mPostYScale;
+    bool transformChanged = !mTransform.FuzzyEqual(transform);
     Layer* otherMask = mLayer->GetMaskLayer();
     const nsIntRect* otherClip = mLayer->GetClipRect();
     nsIntRegion result;
     if ((mMaskLayer ? mMaskLayer->mLayer : nullptr) != otherMask ||
         (mUseClipRect != !!otherClip) ||
         mLayer->GetLocalOpacity() != mOpacity ||
         transformChanged) 
     {
@@ -159,16 +155,23 @@ struct LayerPropertiesBase : public Laye
       // layers then we can just stop here since we've already invalidated the entire
       // old and new bounds.
       if (!aCallback) {
         ClearInvalidations(mLayer);
         return result;
       }
     }
 
+    nsIntRegion visible;
+    visible.Xor(mVisibleRegion, mLayer->GetVisibleRegion());
+    if (!visible.IsEmpty()) {
+      aGeometryChanged = true;
+    }
+    AddTransformedRegion(result, visible, mTransform);
+
     AddRegion(result, ComputeChangeInternal(aCallback, aGeometryChanged));
     AddTransformedRegion(result, mLayer->GetInvalidRegion(), mTransform);
 
     if (mMaskLayer && otherMask) {
       AddTransformedRegion(result, mMaskLayer->ComputeChange(aCallback, aGeometryChanged),
                            mTransform);
     }
 
@@ -202,56 +205,37 @@ struct LayerPropertiesBase : public Laye
     return nsIntRect();
   }
 
   nsRefPtr<Layer> mLayer;
   nsAutoPtr<LayerPropertiesBase> mMaskLayer;
   nsIntRegion mVisibleRegion;
   nsIntRegion mInvalidRegion;
   gfx3DMatrix mTransform;
-  float mPostXScale;
-  float mPostYScale;
   float mOpacity;
   nsIntRect mClipRect;
   bool mUseClipRect;
 };
 
 struct ContainerLayerProperties : public LayerPropertiesBase
 {
   ContainerLayerProperties(ContainerLayer* aLayer)
     : LayerPropertiesBase(aLayer)
-    , mPreXScale(aLayer->GetPreXScale())
-    , mPreYScale(aLayer->GetPreYScale())
   {
     for (Layer* child = aLayer->GetFirstChild(); child; child = child->GetNextSibling()) {
       mChildren.AppendElement(CloneLayerTreePropertiesInternal(child));
     }
   }
 
   virtual nsIntRegion ComputeChangeInternal(NotifySubDocInvalidationFunc aCallback,
                                             bool& aGeometryChanged)
   {
     ContainerLayer* container = mLayer->AsContainerLayer();
     nsIntRegion result;
 
-    if (mPreXScale != container->GetPreXScale() ||
-        mPreYScale != container->GetPreYScale()) {
-      aGeometryChanged = true;
-      result = OldTransformedBounds();
-      AddRegion(result, NewTransformedBounds());
-
-      // If we don't have to generate invalidations separately for child
-      // layers then we can just stop here since we've already invalidated the entire
-      // old and new bounds.
-      if (!aCallback) {
-        ClearInvalidations(mLayer);
-        return result;
-      }
-    }
-
     // A low frame rate is especially visible to users when scrolling, so we
     // particularly want to avoid unnecessary invalidation at that time. For us
     // here, that means avoiding unnecessary invalidation of child items when
     // other children are added to or removed from our container layer, since
     // that may be caused by children being scrolled in or out of view. We are
     // less concerned with children changing order.
     // TODO: Consider how we could avoid unnecessary invalidation when children
     // change order, and whether the overhead would be worth it.
@@ -318,18 +302,16 @@ struct ContainerLayerProperties : public
     gfx3DMatrix transform;
     gfx::To3DMatrix(mLayer->GetTransform(), transform);
     result.Transform(transform);
     return result;
   }
 
   // The old list of children:
   nsAutoTArray<nsAutoPtr<LayerPropertiesBase>,1> mChildren;
-  float mPreXScale;
-  float mPreYScale;
 };
 
 struct ColorLayerProperties : public LayerPropertiesBase
 {
   ColorLayerProperties(ColorLayer *aLayer)
     : LayerPropertiesBase(aLayer)
     , mColor(aLayer->GetColor())
   { }
--- a/layout/base/DisplayItemClip.cpp
+++ b/layout/base/DisplayItemClip.cpp
@@ -270,25 +270,23 @@ DisplayItemClip::RemoveRoundedCorners()
 {
   if (mRoundedClipRects.IsEmpty())
     return;
 
   mClipRect = NonRoundedIntersection();
   mRoundedClipRects.Clear();
 }
 
-// Computes the difference between aR1 and aR2, limited to aBounds.
 static void
-AccumulateRectDifference(const nsRect& aR1, const nsRect& aR2, const nsRect& aBounds, nsRegion* aOut)
+AccumulateRectDifference(const nsRect& aR1, const nsRect& aR2, nsRegion* aOut)
 {
   if (aR1.IsEqualInterior(aR2))
     return;
   nsRegion r;
   r.Xor(aR1, aR2);
-  r.And(r, aBounds);
   aOut->Or(*aOut, r);
 }
 
 void
 DisplayItemClip::AddOffsetAndComputeDifference(const nsPoint& aOffset,
                                                const nsRect& aBounds,
                                                const DisplayItemClip& aOther,
                                                const nsRect& aOtherBounds,
@@ -296,18 +294,18 @@ DisplayItemClip::AddOffsetAndComputeDiff
 {
   if (mHaveClipRect != aOther.mHaveClipRect ||
       mRoundedClipRects.Length() != aOther.mRoundedClipRects.Length()) {
     aDifference->Or(*aDifference, aBounds);
     aDifference->Or(*aDifference, aOtherBounds);
     return;
   }
   if (mHaveClipRect) {
-    AccumulateRectDifference(mClipRect + aOffset, aOther.mClipRect,
-                             aBounds.Union(aOtherBounds),
+    AccumulateRectDifference((mClipRect + aOffset).Intersect(aBounds),
+                             aOther.mClipRect.Intersect(aOtherBounds),
                              aDifference);
   }
   for (uint32_t i = 0; i < mRoundedClipRects.Length(); ++i) {
     if (mRoundedClipRects[i] + aOffset != aOther.mRoundedClipRects[i]) {
       // The corners make it tricky so we'll just add both rects here.
       aDifference->Or(*aDifference, mRoundedClipRects[i].mRect.Intersect(aBounds));
       aDifference->Or(*aDifference, aOther.mRoundedClipRects[i].mRect.Intersect(aOtherBounds));
     }
--- a/layout/base/FrameLayerBuilder.cpp
+++ b/layout/base/FrameLayerBuilder.cpp
@@ -1484,21 +1484,16 @@ ContainerState::CreateOrRecycleThebesLay
       // to, or if we need to invalidate the entire layer, we can do that.
       // This needs to be done before we update the ThebesLayer to its new
       // transform. See nsGfxScrollFrame::InvalidateInternal, where
       // we ensure that mInvalidThebesContent is updated according to the
       // scroll position as of the most recent paint.
       if (!FuzzyEqual(data->mXScale, mParameters.mXScale, 0.00001f) ||
           !FuzzyEqual(data->mYScale, mParameters.mYScale, 0.00001f) ||
           data->mAppUnitsPerDevPixel != mAppUnitsPerDevPixel) {
-#ifdef MOZ_DUMP_PAINTING
-      if (nsLayoutUtils::InvalidationDebuggingIsEnabled()) {
-        printf_stderr("Recycled layer %p changed scale\n", layer.get());
-      }
-#endif
         InvalidateEntireThebesLayer(layer, aAnimatedGeometryRoot);
 #ifndef MOZ_ANDROID_OMTC
         didResetScrollPositionForLayerPixelAlignment = true;
 #endif
       }
       if (!data->mRegionToInvalidate.IsEmpty()) {
 #ifdef MOZ_DUMP_PAINTING
         if (nsLayoutUtils::InvalidationDebuggingIsEnabled()) {
deleted file mode 100644
--- a/layout/reftests/invalidation/inactive-layertree-visible-region-1.html
+++ /dev/null
@@ -1,56 +0,0 @@
-<!DOCTYPE html>
-<html lang="en" class="reftest-wait">
-<meta charset="utf-8">
-<title>Scrolling the horizontal bar away shouldn't invalidate the green rectangle</title>
-
-<style>
-
-.wrapper {
-  transform: translateY(1px);
-}
-
-.content {
-  box-sizing: border-box;
-  border: 1px solid rgba(0, 0, 0, 0.2);
-}
-
-.first {
-  height: 20px;
-}
-
-.second {
-  margin-left: auto;
-  width: 20px;
-  height: 200px;
-}
-
-.reftest-no-paint {
-  margin: -150px 100px 0;
-  height: 100px;
-  border-color: lime;
-}
-
-body {
-  margin: 0;
-  padding: 50px;
-  height: 3000px;
-}
-
-</style>
-
-<div class="wrapper">
-  <div class="first content"></div>
-  <div class="second content"></div>
-</div>
-
-<div class="reftest-no-paint content"></div>
-
-<script>
-
-function doTest() {
-  document.documentElement.scrollTop = 100;
-  document.documentElement.removeAttribute("class");
-}
-document.addEventListener("MozReftestInvalidate", doTest, false);
-
-</script>
\ No newline at end of file
deleted file mode 100644
--- a/layout/reftests/invalidation/inactive-layertree-visible-region-2.html
+++ /dev/null
@@ -1,58 +0,0 @@
-<!DOCTYPE html>
-<html lang="en" class="reftest-wait">
-<meta charset="utf-8">
-<title>Scrolling the horizontal bar away shouldn't invalidate the green rectangle</title>
-
-<style>
-
-.wrapper {
-  transform: translateY(1px);
-}
-
-.content {
-  box-sizing: border-box;
-  border: 1px solid rgba(0, 0, 0, 0.2);
-}
-
-.first {
-  height: 20px;
-}
-
-.second {
-  margin-left: auto;
-  width: 20px;
-  height: 200px;
-}
-
-.reftest-no-paint {
-  margin: -150px 100px 0;
-  height: 100px;
-  border-color: lime;
-}
-
-body {
-  margin: 0;
-  padding: 50px;
-  height: 3000px;
-}
-
-</style>
-
-<div class="wrapper">
-  <div class="wrapper">
-    <div class="first content"></div>
-    <div class="second content"></div>
-  </div>
-</div>
-
-<div class="reftest-no-paint content"></div>
-
-<script>
-
-function doTest() {
-  document.documentElement.scrollTop = 100;
-  document.documentElement.removeAttribute("class");
-}
-document.addEventListener("MozReftestInvalidate", doTest, false);
-
-</script>
\ No newline at end of file
--- a/layout/reftests/invalidation/reftest.list
+++ b/layout/reftests/invalidation/reftest.list
@@ -35,14 +35,12 @@ pref(layout.animated-image-layers.enable
 == filter-userspace-offset.svg?offsetContainer=rect&mask=userSpace-at100 filter-userspace-offset.svg
 == filter-userspace-offset.svg?offsetContainer=use&mask=userSpace-at100 filter-userspace-offset.svg
 == filter-userspace-offset.svg?offsetContainer=innerSVG&mask=userSpace-atZero filter-userspace-offset.svg
 == filter-userspace-offset.svg?offsetContainer=foreignObject&mask=userSpace-at100 filter-userspace-offset.svg
 == filter-userspace-offset.svg?offsetContainer=rect&filter=matrix-fillPaint-boundingBox filter-userspace-offset.svg
 == filter-userspace-offset.svg?offsetContainer=rect&filter=matrix-fillPaint-userSpace-at100 filter-userspace-offset.svg
 == scroll-inactive-layers.html scroll-inactive-layers.html
 == scroll-inactive-layers-2.html scroll-inactive-layers-2.html
-!= inactive-layertree-visible-region-1.html about:blank
-!= inactive-layertree-visible-region-2.html about:blank
 != transform-floating-point-invalidation.html about:blank
 != transform-floating-point-invalidation.html?reverse about:blank
 != nudge-to-integer-invalidation.html about:blank
 != nudge-to-integer-invalidation.html?reverse about:blank