Bug 1452464. r=miko, a=RyanVM
authorMatt Woodrow <mwoodrow@mozilla.com>
Thu, 10 May 2018 16:34:25 +1200
changeset 473351 064b3540e831abdb746ecb36f50c7d8cc01762d0
parent 473350 1d11b6bedc3057a1cfea8762d17874b6567c836b
child 473352 a5b962b8bb3d9a9301430bc47ce975e5279b2043
push id1728
push userjlund@mozilla.com
push dateMon, 18 Jun 2018 21:12:27 +0000
treeherdermozilla-release@c296fde26f5f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmiko, RyanVM
bugs1452464
milestone61.0
Bug 1452464. r=miko, a=RyanVM
layout/painting/nsDisplayList.cpp
layout/painting/nsDisplayList.h
--- a/layout/painting/nsDisplayList.cpp
+++ b/layout/painting/nsDisplayList.cpp
@@ -7092,23 +7092,49 @@ nsDisplaySubDocument::nsDisplaySubDocume
   MOZ_COUNT_CTOR(nsDisplaySubDocument);
 
   // The SubDocument display item is conceptually outside the viewport frame,
   // so in cases where the viewport frame is an AGR, the SubDocument's AGR
   // should be not the viewport frame itself, but its parent AGR.
   if (*mAnimatedGeometryRoot == mFrame && mAnimatedGeometryRoot->mParentAGR) {
     mAnimatedGeometryRoot = mAnimatedGeometryRoot->mParentAGR;
   }
-}
-
-#ifdef NS_BUILD_REFCNT_LOGGING
+
+  if (mSubDocFrame && mSubDocFrame != mFrame) {
+    mSubDocFrame->AddDisplayItem(this);
+  }
+}
+
 nsDisplaySubDocument::~nsDisplaySubDocument() {
   MOZ_COUNT_DTOR(nsDisplaySubDocument);
-}
-#endif
+  if (mSubDocFrame) {
+    mSubDocFrame->RemoveDisplayItem(this);
+  }
+}
+
+nsIFrame*
+nsDisplaySubDocument::FrameForInvalidation() const
+{
+  return mSubDocFrame ? mSubDocFrame : mFrame;
+}
+
+bool
+nsDisplaySubDocument::HasDeletedFrame() const
+{
+  return !mSubDocFrame || nsDisplayItem::HasDeletedFrame();
+}
+
+void
+nsDisplaySubDocument::RemoveFrame(nsIFrame* aFrame)
+{
+  if (aFrame == mSubDocFrame) {
+    mSubDocFrame = nullptr;
+  }
+  nsDisplayItem::RemoveFrame(aFrame);
+}
 
 UniquePtr<ScrollMetadata>
 nsDisplaySubDocument::ComputeScrollMetadata(LayerManager* aLayerManager,
                                             const ContainerLayerParameters& aContainerParameters)
 {
   if (!(mFlags & nsDisplayOwnLayerFlags::eGenerateScrollableLayer)) {
     return UniquePtr<ScrollMetadata>(nullptr);
   }
--- a/layout/painting/nsDisplayList.h
+++ b/layout/painting/nsDisplayList.h
@@ -5673,19 +5673,17 @@ protected:
  * except that it always populates the FrameMetrics instance on the ContainerLayer it
  * builds.
  */
 class nsDisplaySubDocument : public nsDisplayOwnLayer {
 public:
   nsDisplaySubDocument(nsDisplayListBuilder* aBuilder,
                        nsIFrame* aFrame, nsSubDocumentFrame* aSubDocFrame,
                        nsDisplayList* aList, nsDisplayOwnLayerFlags aFlags);
-#ifdef NS_BUILD_REFCNT_LOGGING
   virtual ~nsDisplaySubDocument();
-#endif
 
   virtual nsRect GetBounds(nsDisplayListBuilder* aBuilder,
                            bool* aSnap) const override;
 
   virtual nsSubDocumentFrame* SubDocumentFrame() { return mSubDocFrame; }
 
   virtual bool ComputeVisibility(nsDisplayListBuilder* aBuilder,
                                  nsRegion* aVisibleRegion) override;
@@ -5715,16 +5713,22 @@ public:
   virtual nsRegion GetOpaqueRegion(nsDisplayListBuilder* aBuilder,
                                    bool* aSnap) const override;
 
   NS_DISPLAY_DECL_NAME("SubDocument", TYPE_SUBDOCUMENT)
 
   mozilla::UniquePtr<ScrollMetadata> ComputeScrollMetadata(LayerManager* aLayerManager,
                                                            const ContainerLayerParameters& aContainerParameters);
 
+  virtual nsIFrame* FrameForInvalidation() const override;
+
+  virtual bool HasDeletedFrame() const override;
+
+  virtual void RemoveFrame(nsIFrame* aFrame) override;
+
 protected:
   ViewID mScrollParentId;
   bool mForceDispatchToContentRegion;
   bool mShouldFlatten;
   nsSubDocumentFrame* mSubDocFrame;
 };
 
 /**