Bug 1546955 - Part 2: Make all display item constructors take nsDisplayListBuilder and frame as the first two parameters r=mattwoodrow
authorMiko Mynttinen <mikokm@gmail.com>
Sun, 05 May 2019 21:45:31 +0000
changeset 531511 b16160b39a3f5a55211c18eaabc1e48e5b9ec505
parent 531510 f9c160fec2c4965a1942d62209dfded9b9701240
child 531512 0b4f4ccbe1c50cac32be3292424c5a0afc0a6964
push id11265
push userffxbld-merge
push dateMon, 13 May 2019 10:53:39 +0000
treeherdermozilla-beta@77e0fe8dbdd3 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmattwoodrow
bugs1546955
milestone68.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 1546955 - Part 2: Make all display item constructors take nsDisplayListBuilder and frame as the first two parameters r=mattwoodrow Depends on D28844 Differential Revision: https://phabricator.services.mozilla.com/D28846
layout/forms/nsButtonFrameRenderer.cpp
layout/generic/nsCanvasFrame.cpp
layout/generic/nsCanvasFrame.h
layout/painting/nsDisplayList.cpp
layout/painting/nsDisplayList.h
--- a/layout/forms/nsButtonFrameRenderer.cpp
+++ b/layout/forms/nsButtonFrameRenderer.cpp
@@ -58,18 +58,18 @@ void nsButtonFrameRenderer::SetDisabled(
 bool nsButtonFrameRenderer::isDisabled() {
   return mFrame->GetContent()->AsElement()->State().HasState(
       NS_EVENT_STATE_DISABLED);
 }
 
 class nsDisplayButtonBoxShadowOuter : public nsDisplayItem {
  public:
   nsDisplayButtonBoxShadowOuter(nsDisplayListBuilder* aBuilder,
-                                nsButtonFrameRenderer* aRenderer)
-      : nsDisplayItem(aBuilder, aRenderer->GetFrame()) {
+                                nsIFrame* aFrame)
+      : nsDisplayItem(aBuilder, aFrame) {
     MOZ_COUNT_CTOR(nsDisplayButtonBoxShadowOuter);
   }
 #ifdef NS_BUILD_REFCNT_LOGGING
   virtual ~nsDisplayButtonBoxShadowOuter() {
     MOZ_COUNT_DTOR(nsDisplayButtonBoxShadowOuter);
   }
 #endif
 
@@ -181,19 +181,19 @@ bool nsDisplayButtonBoxShadowOuter::Crea
                            wr::ToColorF(shadowColor), blurRadius, spreadRadius,
                            borderRadius, wr::BoxShadowClipMode::Outset);
   }
   return true;
 }
 
 class nsDisplayButtonBorder final : public nsDisplayItem {
  public:
-  nsDisplayButtonBorder(nsDisplayListBuilder* aBuilder,
+  nsDisplayButtonBorder(nsDisplayListBuilder* aBuilder, nsIFrame* aFrame,
                         nsButtonFrameRenderer* aRenderer)
-      : nsDisplayItem(aBuilder, aRenderer->GetFrame()), mBFR(aRenderer) {
+      : nsDisplayItem(aBuilder, aFrame), mBFR(aRenderer) {
     MOZ_COUNT_CTOR(nsDisplayButtonBorder);
   }
 #ifdef NS_BUILD_REFCNT_LOGGING
   virtual ~nsDisplayButtonBorder() { MOZ_COUNT_DTOR(nsDisplayButtonBorder); }
 #endif
   virtual bool MustPaintOnContentSide() const override { return true; }
 
   virtual void HitTest(nsDisplayListBuilder* aBuilder, const nsRect& aRect,
@@ -287,19 +287,19 @@ nsRect nsDisplayButtonBorder::GetBounds(
   return aBuilder->IsForEventDelivery()
              ? nsRect(ToReferenceFrame(), mFrame->GetSize())
              : mFrame->GetVisualOverflowRectRelativeToSelf() +
                    ToReferenceFrame();
 }
 
 class nsDisplayButtonForeground final : public nsDisplayItem {
  public:
-  nsDisplayButtonForeground(nsDisplayListBuilder* aBuilder,
+  nsDisplayButtonForeground(nsDisplayListBuilder* aBuilder, nsIFrame* aFrame,
                             nsButtonFrameRenderer* aRenderer)
-      : nsDisplayItem(aBuilder, aRenderer->GetFrame()), mBFR(aRenderer) {
+      : nsDisplayItem(aBuilder, aFrame), mBFR(aRenderer) {
     MOZ_COUNT_CTOR(nsDisplayButtonForeground);
   }
 #ifdef NS_BUILD_REFCNT_LOGGING
   virtual ~nsDisplayButtonForeground() {
     MOZ_COUNT_DTOR(nsDisplayButtonForeground);
   }
 #endif
 
@@ -381,30 +381,33 @@ bool nsDisplayButtonForeground::CreateWe
   br->CreateWebRenderCommands(this, aBuilder, aResources, aSc);
   return true;
 }
 
 nsresult nsButtonFrameRenderer::DisplayButton(nsDisplayListBuilder* aBuilder,
                                               nsDisplayList* aBackground,
                                               nsDisplayList* aForeground) {
   if (mFrame->StyleEffects()->mBoxShadow) {
-    aBackground->AppendNewToTop<nsDisplayButtonBoxShadowOuter>(aBuilder, this);
+    aBackground->AppendNewToTop<nsDisplayButtonBoxShadowOuter>(aBuilder,
+                                                               GetFrame());
   }
 
   nsRect buttonRect = mFrame->GetRectRelativeToSelf();
 
   nsDisplayBackgroundImage::AppendBackgroundItemsToTop(aBuilder, mFrame,
                                                        buttonRect, aBackground);
 
-  aBackground->AppendNewToTop<nsDisplayButtonBorder>(aBuilder, this);
+  aBackground->AppendNewToTop<nsDisplayButtonBorder>(aBuilder, GetFrame(),
+                                                     this);
 
   // Only display focus rings if we actually have them. Since at most one
   // button would normally display a focus ring, most buttons won't have them.
   if (mInnerFocusStyle && mInnerFocusStyle->StyleBorder()->HasBorder()) {
-    aForeground->AppendNewToTop<nsDisplayButtonForeground>(aBuilder, this);
+    aForeground->AppendNewToTop<nsDisplayButtonForeground>(aBuilder, GetFrame(),
+                                                           this);
   }
   return NS_OK;
 }
 
 void nsButtonFrameRenderer::GetButtonInnerFocusRect(const nsRect& aRect,
                                                     nsRect& aResult) {
   aResult = aRect;
   aResult.Deflate(mFrame->GetUsedBorderAndPadding());
--- a/layout/generic/nsCanvasFrame.cpp
+++ b/layout/generic/nsCanvasFrame.cpp
@@ -543,31 +543,32 @@ void nsCanvasFrame::BuildDisplayList(nsD
           asrSetter.SetCurrentActiveScrolledRoot(
               displayData->mContainingBlockActiveScrolledRoot);
           thisItemASR = displayData->mContainingBlockActiveScrolledRoot;
         }
         nsDisplayCanvasBackgroundImage* bgItem = nullptr;
         {
           DisplayListClipState::AutoSaveRestore bgImageClip(aBuilder);
           bgImageClip.Clear();
-          bgItem =
-              MakeDisplayItem<nsDisplayCanvasBackgroundImage>(aBuilder, bgData);
+          bgItem = MakeDisplayItem<nsDisplayCanvasBackgroundImage>(
+              aBuilder, this, bgData);
           if (bgItem) {
             bgItem->SetDependentFrame(aBuilder, dependentFrame);
           }
         }
         if (bgItem) {
           thisItemList.AppendToTop(
               nsDisplayFixedPosition::CreateForFixedBackground(aBuilder, this,
                                                                bgItem, i));
         }
 
       } else {
         nsDisplayCanvasBackgroundImage* bgItem =
-            MakeDisplayItem<nsDisplayCanvasBackgroundImage>(aBuilder, bgData);
+            MakeDisplayItem<nsDisplayCanvasBackgroundImage>(aBuilder, this,
+                                                            bgData);
         if (bgItem) {
           bgItem->SetDependentFrame(aBuilder, dependentFrame);
           thisItemList.AppendToTop(bgItem);
         }
       }
 
       if (layers.mLayers[i].mBlendMode != NS_STYLE_BLEND_NORMAL) {
         DisplayListClipState::AutoSaveRestore blendClip(aBuilder);
--- a/layout/generic/nsCanvasFrame.h
+++ b/layout/generic/nsCanvasFrame.h
@@ -187,18 +187,19 @@ class nsDisplayCanvasBackgroundColor fin
 #ifdef MOZ_DUMP_PAINTING
   virtual void WriteDebugInfo(std::stringstream& aStream) override;
 #endif
 };
 
 class nsDisplayCanvasBackgroundImage : public nsDisplayBackgroundImage {
  public:
   explicit nsDisplayCanvasBackgroundImage(nsDisplayListBuilder* aBuilder,
+                                          nsIFrame* aFrame,
                                           const InitData& aInitData)
-      : nsDisplayBackgroundImage(aBuilder, aInitData) {}
+      : nsDisplayBackgroundImage(aBuilder, aFrame, aInitData) {}
 
   virtual void Paint(nsDisplayListBuilder* aBuilder, gfxContext* aCtx) override;
 
   // We still need to paint a background color as well as an image for this
   // item, so we can't support this yet.
   virtual bool SupportsOptimizingToImage() const override { return false; }
 
   bool IsSingleFixedPositionImage(nsDisplayListBuilder* aBuilder,
--- a/layout/painting/nsDisplayList.cpp
+++ b/layout/painting/nsDisplayList.cpp
@@ -3571,27 +3571,25 @@ nsDisplayBackgroundImage::GetInitData(ns
       !isTransformedFixed;
 
   bool shouldFixToViewport = shouldTreatAsFixed && !layer.mImage.IsEmpty();
   bool isRasterImage = state.mImageRenderer.IsRasterImage();
   nsCOMPtr<imgIContainer> image;
   if (isRasterImage) {
     image = state.mImageRenderer.GetImage();
   }
-  return InitData{aBuilder,         aFrame,
-                  aBackgroundStyle, image,
-                  aBackgroundRect,  state.mFillArea,
-                  state.mDestArea,  aLayer,
-                  isRasterImage,    shouldFixToViewport};
+  return InitData{aBuilder,        aBackgroundStyle, image,
+                  aBackgroundRect, state.mFillArea,  state.mDestArea,
+                  aLayer,          isRasterImage,    shouldFixToViewport};
 }
 
 nsDisplayBackgroundImage::nsDisplayBackgroundImage(
-    nsDisplayListBuilder* aBuilder, const InitData& aInitData,
+    nsDisplayListBuilder* aBuilder, nsIFrame* aFrame, const InitData& aInitData,
     nsIFrame* aFrameForBounds)
-    : nsDisplayImageContainer(aBuilder, aInitData.frame),
+    : nsDisplayImageContainer(aBuilder, aFrame),
       mBackgroundStyle(aInitData.backgroundStyle),
       mImage(aInitData.image),
       mDependentFrame(nullptr),
       mBackgroundRect(aInitData.backgroundRect),
       mFillRect(aInitData.fillArea),
       mDestRect(aInitData.destArea),
       mLayer(aInitData.layer),
       mIsRasterImage(aInitData.isRasterImage),
@@ -3892,23 +3890,21 @@ bool nsDisplayBackgroundImage::AppendBac
       }
       nsDisplayBackgroundImage* bgItem = nullptr;
       {
         // The clip is captured by the nsDisplayFixedPosition, so clear the
         // clip for the nsDisplayBackgroundImage inside.
         DisplayListClipState::AutoSaveRestore bgImageClip(aBuilder);
         bgImageClip.Clear();
         if (aSecondaryReferenceFrame) {
-          nsDisplayBackgroundImage::InitData tableData = bgData;
-          nsIFrame* styleFrame = tableData.frame;
-          tableData.frame = aSecondaryReferenceFrame;
           bgItem = MakeDisplayItem<nsDisplayTableBackgroundImage>(
-              aBuilder, tableData, styleFrame);
+              aBuilder, aSecondaryReferenceFrame, bgData, aFrame);
         } else {
-          bgItem = MakeDisplayItem<nsDisplayBackgroundImage>(aBuilder, bgData);
+          bgItem = MakeDisplayItem<nsDisplayBackgroundImage>(aBuilder, aFrame,
+                                                             bgData);
         }
       }
       if (bgItem) {
         bgItem->SetDependentFrame(aBuilder, dependentFrame);
         if (aSecondaryReferenceFrame) {
           thisItemList.AppendToTop(
               nsDisplayTableFixedPosition::CreateForFixedBackground(
                   aBuilder, aSecondaryReferenceFrame, bgItem, i, aFrame));
@@ -3917,24 +3913,21 @@ bool nsDisplayBackgroundImage::AppendBac
               nsDisplayFixedPosition::CreateForFixedBackground(aBuilder, aFrame,
                                                                bgItem, i));
         }
       }
 
     } else {
       nsDisplayBackgroundImage* bgItem;
       if (aSecondaryReferenceFrame) {
-        nsDisplayBackgroundImage::InitData tableData = bgData;
-        nsIFrame* styleFrame = tableData.frame;
-        tableData.frame = aSecondaryReferenceFrame;
-
         bgItem = MakeDisplayItem<nsDisplayTableBackgroundImage>(
-            aBuilder, tableData, styleFrame);
+            aBuilder, aSecondaryReferenceFrame, bgData, aFrame);
       } else {
-        bgItem = MakeDisplayItem<nsDisplayBackgroundImage>(aBuilder, bgData);
+        bgItem =
+            MakeDisplayItem<nsDisplayBackgroundImage>(aBuilder, aFrame, bgData);
       }
       if (bgItem) {
         bgItem->SetDependentFrame(aBuilder, dependentFrame);
         thisItemList.AppendToTop(bgItem);
       }
     }
 
     if (bg->mImage.mLayers[i].mBlendMode != NS_STYLE_BLEND_NORMAL) {
@@ -4406,18 +4399,19 @@ nsRect nsDisplayBackgroundImage::GetBoun
   const nsStyleImageLayers::Layer& layer =
       mBackgroundStyle->StyleBackground()->mImage.mLayers[mLayer];
   return nsCSSRendering::GetBackgroundLayerRect(
       presContext, frame, mBackgroundRect, clipRect, layer,
       aBuilder->GetBackgroundPaintFlags());
 }
 
 nsDisplayTableBackgroundImage::nsDisplayTableBackgroundImage(
-    nsDisplayListBuilder* aBuilder, const InitData& aData, nsIFrame* aCellFrame)
-    : nsDisplayBackgroundImage(aBuilder, aData, aCellFrame),
+    nsDisplayListBuilder* aBuilder, nsIFrame* aFrame, const InitData& aData,
+    nsIFrame* aCellFrame)
+    : nsDisplayBackgroundImage(aBuilder, aFrame, aData, aCellFrame),
       mStyleFrame(aCellFrame),
       mTableType(GetTableTypeFromFrame(mStyleFrame)) {
   if (aBuilder->IsRetainingDisplayList()) {
     mStyleFrame->AddDisplayItem(this);
   }
 }
 
 nsDisplayTableBackgroundImage::~nsDisplayTableBackgroundImage() {
--- a/layout/painting/nsDisplayList.h
+++ b/layout/painting/nsDisplayList.h
@@ -2003,18 +2003,18 @@ class RetainedDisplayList;
   const char* Name() const override { return n; }                            \
   constexpr static DisplayItemType ItemType() { return DisplayItemType::e; } \
                                                                              \
  private:                                                                    \
   void* operator new(size_t aSize, nsDisplayListBuilder* aBuilder) {         \
     return aBuilder->Allocate(aSize, DisplayItemType::e);                    \
   }                                                                          \
                                                                              \
-  template <typename T, typename... Args>                                    \
-  friend T* ::MakeDisplayItem(nsDisplayListBuilder* aBuilder,                \
+  template <typename T, typename F, typename... Args>                        \
+  friend T* ::MakeDisplayItem(nsDisplayListBuilder* aBuilder, F* aFrame,     \
                               Args&&... aArgs);                              \
                                                                              \
  public:
 
 #define NS_DISPLAY_ALLOW_CLONING()                                          \
   template <typename T>                                                     \
   friend T* MakeClone(nsDisplayListBuilder* aBuilder, const T* aItem);      \
                                                                             \
@@ -2029,20 +2029,23 @@ MOZ_ALWAYS_INLINE T* MakeClone(nsDisplay
   item->SetPerFrameKey(item->CalculatePerFrameKey());
   return item;
 }
 
 #ifdef MOZ_DIAGNOSTIC_ASSERT_ENABLED
 void AssertUniqueItem(nsDisplayItem* aItem);
 #endif
 
-template <typename T, typename... Args>
-MOZ_ALWAYS_INLINE T* MakeDisplayItem(nsDisplayListBuilder* aBuilder,
+template <typename T, typename F, typename... Args>
+MOZ_ALWAYS_INLINE T* MakeDisplayItem(nsDisplayListBuilder* aBuilder, F* aFrame,
                                      Args&&... aArgs) {
-  T* item = new (aBuilder) T(aBuilder, std::forward<Args>(aArgs)...);
+  static_assert(std::is_base_of<nsIFrame, F>::value,
+                "Frame type is not derived from nsIFrame");
+
+  T* item = new (aBuilder) T(aBuilder, aFrame, std::forward<Args>(aArgs)...);
 
   if (T::ItemType() != DisplayItemType::TYPE_GENERIC) {
     item->SetType(T::ItemType());
   }
 
   item->SetPerFrameKey(item->CalculatePerFrameKey());
 
   // TODO: Ideally we'd determine this before constructing the item,
@@ -2173,18 +2176,21 @@ class nsDisplayItemBase : public nsDispl
    */
   virtual const char* Name() const = 0;
 
   /**
    * Some consecutive items should be rendered together as a unit, e.g.,
    * outlines for the same element. For this, we need a way for items to
    * identify their type. We use the type for other purposes too.
    */
-  DisplayItemType GetType() const { return mType; }
-  void SetType(const DisplayItemType aType) { mType = aType; }
+  DisplayItemType GetType() const {
+    MOZ_ASSERT(mType != DisplayItemType::TYPE_ZERO,
+               "Display item should have a valid type!");
+    return mType;
+  }
 
   /**
    * Pairing this with the Frame() pointer gives a key that
    * uniquely identifies this display item in the display item tree.
    */
   uint32_t GetPerFrameKey() const {
     // The top 8 bits are currently unused.
     // The middle 16 bits of the per frame key uniquely identify the display
@@ -2278,17 +2284,17 @@ class nsDisplayItemBase : public nsDispl
    * display list iterator to descend into the child display list.
    */
   virtual bool ShouldFlattenAway(nsDisplayListBuilder* aBuilder) {
     return false;
   }
 
  protected:
   nsDisplayItemBase(nsDisplayListBuilder* aBuilder, nsIFrame* aFrame)
-      : mFrame(aFrame) {
+      : mFrame(aFrame), mType(DisplayItemType::TYPE_ZERO) {
     MOZ_COUNT_CTOR(nsDisplayItemBase);
     MOZ_ASSERT(mFrame);
 
     if (aBuilder->IsRetainingDisplayList()) {
       mFrame->AddDisplayItem(this);
     }
   }
 
@@ -2303,16 +2309,17 @@ class nsDisplayItemBase : public nsDispl
 
   virtual ~nsDisplayItemBase() {
     MOZ_COUNT_DTOR(nsDisplayItemBase);
     if (mFrame) {
       mFrame->RemoveDisplayItem(this);
     }
   }
 
+  void SetType(const DisplayItemType aType) { mType = aType; }
   void SetPerFrameKey(const uint16_t aKey) { mKey = aKey; }
 
   void SetDeletedFrame();
 
   nsIFrame* mFrame;  // 8
 
  private:
   enum class ItemBaseFlag : uint8_t {
@@ -3227,20 +3234,21 @@ class nsDisplayList {
       return;
     }
     MOZ_ASSERT(!aItem->mAbove, "Already in a list!");
     mTop->mAbove = aItem;
     mTop = aItem;
     mLength++;
   }
 
-  template <typename T, typename... Args>
-  void AppendNewToTop(nsDisplayListBuilder* aBuilder, Args&&... aArgs) {
+  template <typename T, typename F, typename... Args>
+  void AppendNewToTop(nsDisplayListBuilder* aBuilder, F* aFrame,
+                      Args&&... aArgs) {
     nsDisplayItem* item =
-        MakeDisplayItem<T>(aBuilder, std::forward<Args>(aArgs)...);
+        MakeDisplayItem<T>(aBuilder, aFrame, std::forward<Args>(aArgs)...);
     if (item) {
       AppendToTop(item);
     }
   }
 
   /**
    * Append a new item to the bottom of the list. The item must be non-null
    * and not already in a list.
@@ -3253,20 +3261,21 @@ class nsDisplayList {
     aItem->mAbove = mSentinel.mAbove;
     mSentinel.mAbove = aItem;
     if (mTop == &mSentinel) {
       mTop = aItem;
     }
     mLength++;
   }
 
-  template <typename T, typename... Args>
-  void AppendNewToBottom(nsDisplayListBuilder* aBuilder, Args&&... aArgs) {
+  template <typename T, typename F, typename... Args>
+  void AppendNewToBottom(nsDisplayListBuilder* aBuilder, F* aFrame,
+                         Args&&... aArgs) {
     nsDisplayItem* item =
-        MakeDisplayItem<T>(aBuilder, std::forward<Args>(aArgs)...);
+        MakeDisplayItem<T>(aBuilder, aFrame, std::forward<Args>(aArgs)...);
     if (item) {
       AppendToBottom(item);
     }
   }
 
   /**
    * Removes all items from aList and appends them to the top of this list
    */
@@ -4009,18 +4018,19 @@ class nsDisplayGeneric : public nsDispla
     this->~nsDisplayGeneric();
     aBuilder->Destroy(DisplayItemType::TYPE_GENERIC, this);
   }
 
  protected:
   void* operator new(size_t aSize, nsDisplayListBuilder* aBuilder) {
     return aBuilder->Allocate(aSize, DisplayItemType::TYPE_GENERIC);
   }
-  template <typename T, typename... Args>
-  friend T* MakeDisplayItem(nsDisplayListBuilder* aBuilder, Args&&... aArgs);
+  template <typename T, typename F, typename... Args>
+  friend T* MakeDisplayItem(nsDisplayListBuilder* aBuilder, F* aFrame,
+                            Args&&... aArgs);
 
   PaintCallback mPaint;
   OldPaintCallback mOldPaint;  // XXX: should be removed eventually
   const char* mName;
 };
 
 #if defined(MOZ_REFLOW_PERF_DSP) && defined(MOZ_REFLOW_PERF)
 /**
@@ -4397,17 +4407,16 @@ class nsDisplaySolidColorRegion : public
  * image layer gets its own nsDisplayBackgroundImage.
  */
 class nsDisplayBackgroundImage : public nsDisplayImageContainer {
  public:
   typedef mozilla::StyleGeometryBox StyleGeometryBox;
 
   struct InitData {
     nsDisplayListBuilder* builder;
-    nsIFrame* frame;
     mozilla::ComputedStyle* backgroundStyle;
     nsCOMPtr<imgIContainer> image;
     nsRect backgroundRect;
     nsRect fillArea;
     nsRect destArea;
     uint32_t layer;
     bool isRasterImage;
     bool shouldFixToViewport;
@@ -4420,17 +4429,17 @@ class nsDisplayBackgroundImage : public 
    * nsCSSRendering::FindBackground, or null if FindBackground returned false.
    * aBackgroundRect is relative to aFrame.
    */
   static InitData GetInitData(nsDisplayListBuilder* aBuilder, nsIFrame* aFrame,
                               uint16_t aLayer, const nsRect& aBackgroundRect,
                               mozilla::ComputedStyle* aBackgroundStyle);
 
   explicit nsDisplayBackgroundImage(nsDisplayListBuilder* aBuilder,
-                                    const InitData& aInitData,
+                                    nsIFrame* aFrame, const InitData& aInitData,
                                     nsIFrame* aFrameForBounds = nullptr);
   ~nsDisplayBackgroundImage() override;
 
   NS_DISPLAY_DECL_NAME("Background", TYPE_BACKGROUND)
 
   // This will create and append new items for all the layers of the
   // background. Returns whether we appended a themed background.
   // aAllowWillPaintBorderOptimization should usually be left at true, unless
@@ -4611,17 +4620,17 @@ static uint16_t CalculateTablePerFrameKe
  * frame. And use mFrame and table type as key to generate DisplayItemData to
  * avoid sharing DisplayItemData.
  *
  * Also store ancestor frame as mStyleFrame for all rendering informations.
  */
 class nsDisplayTableBackgroundImage : public nsDisplayBackgroundImage {
  public:
   nsDisplayTableBackgroundImage(nsDisplayListBuilder* aBuilder,
-                                const InitData& aInitData,
+                                nsIFrame* aFrame, const InitData& aInitData,
                                 nsIFrame* aCellFrame);
   ~nsDisplayTableBackgroundImage() override;
 
   NS_DISPLAY_DECL_NAME("TableBackgroundImage", TYPE_TABLE_BACKGROUND_IMAGE)
 
   uint16_t CalculatePerFrameKey() const override {
     return CalculateTablePerFrameKey(mLayer, mTableType);
   }