Bug 1440177 - Part 5: Don't call GetDisplayItemDataForManager in AddPaintedDisplayItem since we already have it passed in as a parameter. r=jnicol
☠☠ backed out by 13adabb75562 ☠ ☠
authorMatt Woodrow <mwoodrow@mozilla.com>
Mon, 19 Feb 2018 12:37:01 +1300
changeset 406150 928770efc9a3dab8eedf0e97357bd475d67c724a
parent 406149 49b285030492a1f490844fa721750def4fc4d112
child 406151 a77d06b2cf03b3b8824130a1e32c0b09d3ec138c
push id33545
push useraciure@mozilla.com
push dateFri, 02 Mar 2018 10:14:13 +0000
treeherdermozilla-central@b5159a80934f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjnicol
bugs1440177
milestone60.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 1440177 - Part 5: Don't call GetDisplayItemDataForManager in AddPaintedDisplayItem since we already have it passed in as a parameter. r=jnicol MozReview-Commit-ID: IHrVPutPSC5
layout/painting/DisplayItemClip.cpp
layout/painting/DisplayItemClip.h
layout/painting/FrameLayerBuilder.cpp
layout/painting/FrameLayerBuilder.h
--- a/layout/painting/DisplayItemClip.cpp
+++ b/layout/painting/DisplayItemClip.cpp
@@ -405,17 +405,17 @@ DisplayItemClip::GetCommonRoundedRectCou
 void
 DisplayItemClip::AppendRoundedRects(nsTArray<RoundedRect>* aArray, uint32_t aCount) const
 {
   size_t count = std::min(mRoundedClipRects.Length(), size_t(aCount));
   aArray->AppendElements(mRoundedClipRects.Elements(), count);
 }
 
 bool
-DisplayItemClip::ComputeRegionInClips(DisplayItemClip* aOldClip,
+DisplayItemClip::ComputeRegionInClips(const DisplayItemClip* aOldClip,
                                       const nsPoint& aShift,
                                       nsRegion* aCombined) const
 {
   if (!mHaveClipRect || (aOldClip && !aOldClip->mHaveClipRect)) {
     return false;
   }
 
   if (aOldClip) {
--- a/layout/painting/DisplayItemClip.h
+++ b/layout/painting/DisplayItemClip.h
@@ -116,17 +116,17 @@ public:
 
   /*
    * Computes a region which contains the clipped area of this DisplayItemClip,
    * or if aOldClip is non-null, the union of the clipped area of this
    * DisplayItemClip with the clipped area of aOldClip translated by aShift.
    * The result is stored in aCombined. If the result would be infinite
    * (because one or both of the clips does no clipping), returns false.
    */
-  bool ComputeRegionInClips(DisplayItemClip* aOldClip,
+  bool ComputeRegionInClips(const DisplayItemClip* aOldClip,
                             const nsPoint& aShift,
                             nsRegion* aCombined) const;
 
   // Returns false if aRect is definitely not clipped by a rounded corner in
   // this clip. Returns true if aRect is clipped by a rounded corner in this
   // clip or it can not be quickly determined that it is not clipped by a
   // rounded corner in this clip.
   bool IsRectClippedByRoundedCorner(const nsRect& aRect) const;
--- a/layout/painting/FrameLayerBuilder.cpp
+++ b/layout/painting/FrameLayerBuilder.cpp
@@ -4847,37 +4847,32 @@ FrameLayerBuilder::AddPaintedDisplayItem
   PaintedLayer* layer = aLayerData->mLayer;
   PaintedDisplayItemLayerUserData* paintedData =
     static_cast<PaintedDisplayItemLayerUserData*>
       (layer->GetUserData(&gPaintedDisplayItemLayerUserData));
   RefPtr<BasicLayerManager> tempManager;
   nsIntRect intClip;
   bool hasClip = false;
   if (aLayerState != LAYER_NONE) {
-    DisplayItemData *data = GetDisplayItemDataForManager(aItem, layer->Manager());
-    if (data) {
-      tempManager = data->mInactiveManager;
+    if (aData) {
+      tempManager = aData->mInactiveManager;
+
+      // We need to grab these before calling AddLayerDisplayItem because it will overwrite them.
+      nsRegion clip;
+      if (aClip.ComputeRegionInClips(&aData->GetClip(),
+                                     aTopLeft - paintedData->mLastAnimatedGeometryRootOrigin,
+                                     &clip)) {
+        intClip = clip.GetBounds().ScaleToOutsidePixels(paintedData->mXScale,
+                                                        paintedData->mYScale,
+                                                        paintedData->mAppUnitsPerDevPixel);
+      }
     }
     if (!tempManager) {
       tempManager = new BasicLayerManager(BasicLayerManager::BLM_INACTIVE);
     }
-
-    // We need to grab these before calling AddLayerDisplayItem because it will overwrite them.
-    nsRegion clip;
-    DisplayItemClip* oldClip = nullptr;
-    GetOldLayerFor(aItem, nullptr, &oldClip);
-    hasClip = aClip.ComputeRegionInClips(oldClip,
-                                         aTopLeft - paintedData->mLastAnimatedGeometryRootOrigin,
-                                         &clip);
-
-    if (hasClip) {
-      intClip = clip.GetBounds().ScaleToOutsidePixels(paintedData->mXScale,
-                                                      paintedData->mYScale,
-                                                      paintedData->mAppUnitsPerDevPixel);
-    }
   }
 
   AddLayerDisplayItem(layer, aItem, aLayerState, tempManager, aData);
 
   if (tempManager) {
     FLB_LOG_PAINTED_LAYER_DECISION(aLayerData, "Creating nested FLB for item %p\n", aItem);
     FrameLayerBuilder* layerBuilder = new FrameLayerBuilder();
     layerBuilder->Init(mDisplayListBuilder, tempManager, aLayerData, true,
--- a/layout/painting/FrameLayerBuilder.h
+++ b/layout/painting/FrameLayerBuilder.h
@@ -64,16 +64,17 @@ class PaintedDisplayItemLayerUserData;
 class DisplayItemData final {
 public:
   friend class FrameLayerBuilder;
   friend class ContainerState;
 
   uint32_t GetDisplayItemKey() { return mDisplayItemKey; }
   layers::Layer* GetLayer() const { return mLayer; }
   nsDisplayItemGeometry* GetGeometry() const { return mGeometry.get(); }
+  const DisplayItemClip& GetClip() const { return mClip; }
   void Invalidate() { mIsInvalid = true; }
   void ClearAnimationCompositorState();
 
   bool HasMergedFrames() const { return mFrameList.Length() > 1; }
 
   static DisplayItemData* AssertDisplayItemData(DisplayItemData* aData);
 
   void* operator new(size_t sz, nsPresContext* aPresContext)