Bug 1400618 part 6 - Remove the workaround for the broken IsPrimaryFrame() in nsFrame::DestroyFrom since it now works also for NAC frames. r=bz
authorMats Palmgren <mats@mozilla.com>
Tue, 07 Nov 2017 01:20:34 +0100
changeset 434938 cd9f14f9ea6d4bcd175874352c402613503a86d8
parent 434937 e46bd0b42454a446bd1080a4d32f92386d2d2336
child 434939 89513063a10631897ae55d14828e965c8ebe7aab
push id117
push userfmarier@mozilla.com
push dateTue, 28 Nov 2017 20:17:16 +0000
reviewersbz
bugs1400618
milestone58.0a1
Bug 1400618 part 6 - Remove the workaround for the broken IsPrimaryFrame() in nsFrame::DestroyFrom since it now works also for NAC frames. r=bz MozReview-Commit-ID: 1DFyWZBpzwP
layout/generic/nsFrame.cpp
--- a/layout/generic/nsFrame.cpp
+++ b/layout/generic/nsFrame.cpp
@@ -758,24 +758,17 @@ nsFrame::DestroyFrom(nsIFrame* aDestruct
                  nsLayoutUtils::IsProperAncestorFrame(aDestructRoot, placeholder),
                  "Placeholder relationship should have been torn down already; "
                  "this might mean we have a stray placeholder in the tree.");
     if (placeholder) {
       placeholder->SetOutOfFlowFrame(nullptr);
     }
   }
 
-  // XXXneerja All instances of 'mContent->GetPrimaryFrame() == this' have been
-  // replaced with IsPrimaryFrame() except for this one.  The reason is that
-  // for native anonymous content our subclass Destroy method has already
-  // called UnbindFromTree so nsINode::mSubtreeRoot might be in use here and
-  // we don't want to call mContent->SetPrimaryFrame(nullptr) in that case.
-  // (bug 1400618 will fix that order)
-  bool isPrimaryFrame = (mContent && mContent->GetPrimaryFrame() == this);
-  if (isPrimaryFrame) {
+  if (IsPrimaryFrame()) {
     // This needs to happen before we clear our Properties() table.
     ActiveLayerTracker::TransferActivityToContent(this, mContent);
 
     // Unfortunately, we need to do this for all frames being reframed
     // and not only those whose current style involves CSS transitions,
     // because what matters is whether the new style (not the old)
     // specifies CSS transitions.
     if (presContext->RestyleManager()->IsGecko()) {
@@ -820,17 +813,17 @@ nsFrame::DestroyFrom(nsIFrame* aDestruct
 
   nsView* view = GetView();
   if (view) {
     view->SetFrame(nullptr);
     view->Destroy();
   }
 
   // Make sure that our deleted frame can't be returned from GetPrimaryFrame()
-  if (isPrimaryFrame) {
+  if (IsPrimaryFrame()) {
     mContent->SetPrimaryFrame(nullptr);
 
     // Pass the root of a generated content subtree (e.g. ::after/::before) to
     // aPostDestroyData to unbind it after frame destruction is done.
     if (HasAnyStateBits(NS_FRAME_GENERATED_CONTENT) &&
         mContent->IsRootOfNativeAnonymousSubtree()) {
       aPostDestroyData.AddGeneratedContent(mContent.forget());
     }