Bug 1440177 - Part 5: Don't call GetDisplayItemDataForManager in AddPaintedDisplayItem since we already have it passed in as a parameter. r=jnicol
authorMatt Woodrow <mwoodrow@mozilla.com>
Mon, 19 Feb 2018 12:37:01 +1300
changeset 461224 4c62cca5f3ecb2ee93b4d50a4c9427b3fa8f8ccd
parent 461223 992b8e378397da808cc9c8f0a9b962c8ca469f39
child 461225 58025bcb77cbc6505af35f4ac4e0cd8a0878841b
push id1683
push usersfraser@mozilla.com
push dateThu, 26 Apr 2018 16:43:40 +0000
treeherdermozilla-release@5af6cb21869d [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: CfHL0Kqto6X
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)