Bug 1382213 - Simplify the overflow child frame reparenting in nsInlineFrame::DestroyFrom. r=dholbert
authorMats Palmgren <mats@mozilla.com>
Tue, 10 Oct 2017 18:45:16 +0200
changeset 436227 3d92004f2c025d5dd602742496e954efdc9aca48
parent 436226 aec2dd18f42a4ba816476d2262da02e632902b72
child 436228 656d53c7fd810507564844a6b0b732c116ad8efd
push id8114
push userjlorenzo@mozilla.com
push dateThu, 02 Nov 2017 16:33:21 +0000
treeherdermozilla-beta@73e0d89a540f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdholbert
bugs1382213
milestone58.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 1382213 - Simplify the overflow child frame reparenting in nsInlineFrame::DestroyFrom. r=dholbert MozReview-Commit-ID: FYVZvNYurIi
layout/generic/nsInlineFrame.cpp
layout/generic/nsInlineFrame.h
--- a/layout/generic/nsInlineFrame.cpp
+++ b/layout/generic/nsInlineFrame.cpp
@@ -188,18 +188,17 @@ nsInlineFrame::PeekOffsetCharacter(bool 
 void
 nsInlineFrame::DestroyFrom(nsIFrame* aDestructRoot)
 {
   nsFrameList* overflowFrames = GetOverflowFrames();
   if (overflowFrames) {
     // Fixup the parent pointers for any child frames on the OverflowList.
     // nsIFrame::DestroyFrom depends on that to find the sticky scroll
     // container (an ancestor).
-    nsIFrame* lineContainer = nsLayoutUtils::FindNearestBlockAncestor(this);
-    DrainSelfOverflowListInternal(eForDestroy, lineContainer);
+    overflowFrames->ApplySetParent(this);
   }
   nsContainerFrame::DestroyFrom(aDestructRoot);
 }
 
 nsresult
 nsInlineFrame::StealFrame(nsIFrame* aChild)
 {
   if (MaybeStealOverflowContainerFrame(aChild)) {
@@ -455,18 +454,17 @@ nsInlineFrame::DrainSelfOverflowListInte
     // The frames on our own overflowlist may have been pushed by a
     // previous lazilySetParentPointer Reflow so we need to ensure the
     // correct parent pointer.  This is sometimes skipped by Reflow.
     if (!(aFlags & eDontReparentFrames)) {
       nsIFrame* firstChild = overflowFrames->FirstChild();
       if (aLineContainer && aLineContainer->GetPrevContinuation()) {
         ReparentFloatsForInlineChild(aLineContainer, firstChild, true);
       }
-      const bool doReparentSC =
-        (aFlags & eInFirstLine) && !(aFlags & eForDestroy);
+      const bool doReparentSC = (aFlags & eInFirstLine);
       RestyleManager* restyleManager = PresContext()->RestyleManager();
       for (nsIFrame* f = firstChild; f; f = f->GetNextSibling()) {
         f->SetParent(this);
         if (doReparentSC) {
           restyleManager->ReparentStyleContext(f);
           nsLayoutUtils::MarkDescendantsDirty(f);
         }
       }
--- a/layout/generic/nsInlineFrame.h
+++ b/layout/generic/nsInlineFrame.h
@@ -172,19 +172,16 @@ private:
     : nsInlineFrame(aContext, kClassID)
   {}
 
   // Helper method for DrainSelfOverflowList() to deal with lazy parenting
   // (which we only do for nsInlineFrame, not nsFirstLineFrame).
   enum DrainFlags {
     eDontReparentFrames = 1, // skip reparenting the overflow list frames
     eInFirstLine = 2, // the request is for an inline descendant of a nsFirstLineFrame
-    eForDestroy = 4, // the request is from DestroyFrom; in this case we do the
-                     // minimal work required since the frame is about to be
-                     // destroyed (just fixup parent pointers)
   };
   /**
    * Move any frames on our overflow list to the end of our principal list.
    * @param aFlags one or more of the above DrainFlags
    * @param aLineContainer the nearest line container ancestor
    * @return true if there were any overflow frames
    */
   bool DrainSelfOverflowListInternal(DrainFlags aFlags,