Bug 1552104. Ensure that nsDisplaySubDocument::Disown calls SetDeletedFrame when it clears mFrame. r=mattwoodrow
authorTimothy Nikkel <tnikkel@gmail.com>
Fri, 17 May 2019 04:44:56 +0000
changeset 474294 aa06b77b2d6b613e2c0d51cf19f730ad3a1f27d7
parent 474293 877ae9359a2774f9ccee1f68935b4e7194a5711e
child 474295 a056128cc98626d1e89fdb681a39ee5ce4801a1f
push id113144
push usershindli@mozilla.com
push dateFri, 17 May 2019 16:44:55 +0000
treeherdermozilla-inbound@f4c4b796f845 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmattwoodrow
bugs1552104
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 1552104. Ensure that nsDisplaySubDocument::Disown calls SetDeletedFrame when it clears mFrame. r=mattwoodrow Differential Revision: https://phabricator.services.mozilla.com/D31541
layout/painting/nsDisplayList.cpp
--- a/layout/painting/nsDisplayList.cpp
+++ b/layout/painting/nsDisplayList.cpp
@@ -3177,19 +3177,21 @@ void nsDisplayItemBase::SetModifiedFrame
   }
 }
 
 void nsDisplayItemBase::SetDeletedFrame() {
   mItemFlags += ItemBaseFlag::DeletedFrame;
 }
 
 bool nsDisplayItemBase::HasDeletedFrame() const {
-  return mItemFlags.contains(ItemBaseFlag::DeletedFrame) ||
-         (GetType() == DisplayItemType::TYPE_REMOTE &&
-          !static_cast<const nsDisplayRemote*>(this)->GetFrameLoader());
+  bool retval = mItemFlags.contains(ItemBaseFlag::DeletedFrame) ||
+                (GetType() == DisplayItemType::TYPE_REMOTE &&
+                 !static_cast<const nsDisplayRemote*>(this)->GetFrameLoader());
+  MOZ_ASSERT(retval || mFrame);
+  return retval;
 }
 
 #if !defined(DEBUG) && !defined(MOZ_DIAGNOSTIC_ASSERT_ENABLED)
 static_assert(sizeof(nsDisplayItem) <= 176, "nsDisplayItem has grown");
 #endif
 
 nsDisplayItem::nsDisplayItem(nsDisplayListBuilder* aBuilder, nsIFrame* aFrame)
     : nsDisplayItem(aBuilder, aFrame, aBuilder->CurrentActiveScrolledRoot()) {}
@@ -6726,21 +6728,21 @@ void nsDisplaySubDocument::RemoveFrame(n
     SetDeletedFrame();
   }
   nsDisplayOwnLayer::RemoveFrame(aFrame);
 }
 
 void nsDisplaySubDocument::Disown() {
   if (mFrame) {
     mFrame->RemoveDisplayItem(this);
-    mFrame = nullptr;
+    RemoveFrame(mFrame);
   }
   if (mSubDocFrame) {
     mSubDocFrame->RemoveDisplayItem(this);
-    mSubDocFrame = nullptr;
+    RemoveFrame(mSubDocFrame);
   }
 }
 
 UniquePtr<ScrollMetadata> nsDisplaySubDocument::ComputeScrollMetadata(
     LayerManager* aLayerManager,
     const ContainerLayerParameters& aContainerParameters) {
   if (!(mFlags & nsDisplayOwnLayerFlags::GenerateScrollableLayer)) {
     return UniquePtr<ScrollMetadata>(nullptr);