Bug 1274962 - Part 7: Clean up unecessary parameter for RecomputePerspectiveChildrenOverflow. r=dbaron
authorMatt Woodrow <mwoodrow@mozilla.com>
Fri, 03 Jun 2016 14:26:40 +1200
changeset 341452 656235d7f868ed8147d65aaa0031760863b343a9
parent 341451 3c80b670cfe6517b19c8c8fd6578532dfa9c6657
child 341453 dc8e4c1174b29a330d8f63e97b20e537d1076cf1
push id1183
push userraliiev@mozilla.com
push dateMon, 05 Sep 2016 20:01:49 +0000
treeherdermozilla-release@3148731bed45 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdbaron
bugs1274962
milestone49.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1274962 - Part 7: Clean up unecessary parameter for RecomputePerspectiveChildrenOverflow. r=dbaron
layout/generic/nsFrame.cpp
layout/generic/nsGfxScrollFrame.cpp
layout/generic/nsIFrame.h
--- a/layout/generic/nsFrame.cpp
+++ b/layout/generic/nsFrame.cpp
@@ -8111,84 +8111,79 @@ nsIFrame::FinishAndStoreOverflow(nsOverf
     NS_FOR_FRAME_OVERFLOW_TYPES(otype) {
       nsRect& o = aOverflowAreas.Overflow(otype);
       o.IntersectRect(o, clipPropClipRect);
     }
   }
 
   /* If we're transformed, transform the overflow rect by the current transformation. */
   bool hasTransform = IsTransformed();
-  nsSize oldSize = aOldSize ? *aOldSize : mRect.Size();
-  bool sizeChanged = (oldSize != aNewSize);
+  nsSize oldSize = mRect.Size();
+  bool sizeChanged = ((aOldSize ? *aOldSize : oldSize) != aNewSize);
+
+  /* Since our size might not actually have been computed yet, we need to make sure that we use the
+   * correct dimensions by overriding the stored bounding rectangle with the value the caller has
+   * ensured us we'll use.
+   */
+  SetSize(aNewSize);
 
   if (ChildrenHavePerspective() && sizeChanged) {
     nsRect newBounds(nsPoint(0, 0), aNewSize);
-    RecomputePerspectiveChildrenOverflow(this, &newBounds);
+    RecomputePerspectiveChildrenOverflow(this);
   }
 
   if (hasTransform) {
     Properties().Set(nsIFrame::PreTransformOverflowAreasProperty(),
                      new nsOverflowAreas(aOverflowAreas));
 
     if (Combines3DTransformWithAncestors()) {
       /* If we're a preserve-3d leaf frame, then our pre-transform overflow should be correct. Our
        * post-transform overflow is empty though, because we only contribute to the overflow area
        * of the preserve-3d root frame.
        * If we're an intermediate frame then the pre-transform overflow should contain all our
        * non-preserve-3d children, which is what we want. Again we have no post-transform overflow.
        */
       aOverflowAreas.SetAllTo(nsRect());
     } else {
-      /* Since our size might not actually have been computed yet, we need to make sure that we use the
-       * correct dimensions by overriding the stored bounding rectangle with the value the caller has
-       * ensured us we'll use.
-       */
-      SetSize(aNewSize);
-
       NS_FOR_FRAME_OVERFLOW_TYPES(otype) {
         nsRect& o = aOverflowAreas.Overflow(otype);
         o = nsDisplayTransform::TransformRect(o, this);
       }
 
       /* If we're the root of the 3d context, then we want to include the overflow areas of all
        * the participants. This won't have happened yet as the code above set their overflow
        * area to empty. Manually collect these overflow areas now.
        */
       if (Extend3DContext()) {
         ComputePreserve3DChildrenOverflow(aOverflowAreas);
       }
-
-      /* Revert the size change in case some caller is depending on this. */
-      SetSize(oldSize);
     }
   } else {
     Properties().Delete(nsIFrame::PreTransformOverflowAreasProperty());
   }
 
+  /* Revert the size change in case some caller is depending on this. */
+  SetSize(oldSize);
+
   bool anyOverflowChanged;
   if (aOverflowAreas != nsOverflowAreas(bounds, bounds)) {
     anyOverflowChanged = SetOverflowAreas(aOverflowAreas);
   } else {
     anyOverflowChanged = ClearOverflowRects();
   }
 
   if (anyOverflowChanged) {
     nsSVGEffects::InvalidateDirectRenderingObservers(this);
   }
   return anyOverflowChanged;
 }
 
 void
-nsIFrame::RecomputePerspectiveChildrenOverflow(const nsIFrame* aStartFrame, const nsRect* aBounds)
-{
-  // Children may check our size when getting our transform, make sure it's valid.
-  nsSize oldSize = GetSize();
-  if (aBounds) {
-    SetSize(aBounds->Size());
-  }
+nsIFrame::RecomputePerspectiveChildrenOverflow(const nsIFrame* aStartFrame)
+{
   nsIFrame::ChildListIterator lists(this);
   for (; !lists.IsDone(); lists.Next()) {
     nsFrameList::Enumerator childFrames(lists.CurrentList());
     for (; !childFrames.AtEnd(); childFrames.Next()) {
       nsIFrame* child = childFrames.get();
       if (!child->FrameMaintainsOverflow()) {
         continue; // frame does not maintain overflow rects
       }
@@ -8205,22 +8200,20 @@ nsIFrame::RecomputePerspectiveChildrenOv
           child->FinishAndStoreOverflow(boundsOverflow, bounds.Size());
         }
       } else if (child->GetContainingBlock(SKIP_SCROLLED_FRAME) == aStartFrame) {
         // If a frame is using perspective, then the size used to compute
         // perspective-origin is the size of the frame belonging to its parent
         // style context. We must find any descendant frames using our size
         // (by recursing into frames that have the same containing block)
         // to update their overflow rects too.
-        child->RecomputePerspectiveChildrenOverflow(aStartFrame, nullptr);
-      }
-    }
-  }
-  // Restore our old size just in case something depends on this elesewhere.
-  SetSize(oldSize);
+        child->RecomputePerspectiveChildrenOverflow(aStartFrame);
+      }
+    }
+  }
 }
 
 void
 nsIFrame::ComputePreserve3DChildrenOverflow(nsOverflowAreas& aOverflowAreas)
 {
   // Find all descendants that participate in the 3d context, and include their overflow.
   // These descendants have an empty overflow, so won't have been included in the normal
   // overflow calculation. Any children that don't participate have normal overflow,
--- a/layout/generic/nsGfxScrollFrame.cpp
+++ b/layout/generic/nsGfxScrollFrame.cpp
@@ -2794,17 +2794,17 @@ ScrollFrameHelper::ScrollToImpl(nsPoint 
     if (needFrameVisibilityUpdate) {
       presContext->PresShell()->ScheduleApproximateFrameVisibilityUpdateNow();
     }
   }
 
   if (mOuter->ChildrenHavePerspective()) {
     // The overflow areas of descendants may depend on the scroll position,
     // so ensure they get updated.
-    mOuter->RecomputePerspectiveChildrenOverflow(mOuter, nullptr);
+    mOuter->RecomputePerspectiveChildrenOverflow(mOuter);
   }
 
   ScheduleSyntheticMouseMove();
 
   { // scope the AutoScrollbarRepaintSuppression
     AutoScrollbarRepaintSuppression repaintSuppression(this, !schedulePaint);
     nsWeakFrame weakFrame(mOuter);
     UpdateScrollbarPosition();
--- a/layout/generic/nsIFrame.h
+++ b/layout/generic/nsIFrame.h
@@ -1432,17 +1432,17 @@ public:
   bool ChildrenHavePerspective() const;
 
   /**
    * Includes the overflow area of all descendants that participate in the current
    * 3d context into aOverflowAreas.
    */
   void ComputePreserve3DChildrenOverflow(nsOverflowAreas& aOverflowAreas);
 
-  void RecomputePerspectiveChildrenOverflow(const nsIFrame* aStartFrame, const nsRect* aBounds);
+  void RecomputePerspectiveChildrenOverflow(const nsIFrame* aStartFrame);
 
   /**
    * Returns the number of ancestors between this and the root of our frame tree
    */
   uint32_t GetDepthInFrameTree() const;
 
   /**
    * Event handling of GUI events.