Bug 1397091: Merge InsertionKind and LazyConstructionAllowed. r=bz
authorEmilio Cobos Álvarez <emilio@crisal.io>
Thu, 07 Sep 2017 17:02:20 +0200
changeset 429240 cb5a5cf16f1bd33cb02e238f80f6fe48d6945c53
parent 429239 e51ad458391342c3b9e37fd827c1bc4f4b2264c3
child 429241 1e3f27bf4b47013a2a94efa3dfc9c1ba128458f4
push id7761
push userjlund@mozilla.com
push dateFri, 15 Sep 2017 00:19:52 +0000
treeherdermozilla-beta@c38455951db4 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbz
bugs1397091
milestone57.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 1397091: Merge InsertionKind and LazyConstructionAllowed. r=bz They now map 1-to-1, so there's no reason to keep them separate. MozReview-Commit-ID: A2Wqa3QNdw8
layout/base/PresShell.cpp
layout/base/RestyleManager.cpp
layout/base/nsCSSFrameConstructor.cpp
layout/base/nsCSSFrameConstructor.h
--- a/layout/base/PresShell.cpp
+++ b/layout/base/PresShell.cpp
@@ -1810,17 +1810,17 @@ PresShell::Initialize(nscoord aWidth, ns
   if (root) {
     {
       nsAutoCauseReflowNotifier reflowNotifier(this);
       mFrameConstructor->BeginUpdate();
 
       // Have the style sheet processor construct frame for the root
       // content object down
       mFrameConstructor->ContentInserted(
-          nullptr, root, nullptr, nsCSSFrameConstructor::LazyConstructionAllowed::No);
+          nullptr, root, nullptr, nsCSSFrameConstructor::InsertionKind::Sync);
       VERIFY_STYLE_TREE;
 
       // Something in mFrameConstructor->ContentInserted may have caused
       // Destroy() to get called, bug 337586.
       NS_ENSURE_STATE(!mHaveShutDown);
 
       mFrameConstructor->EndUpdate();
     }
@@ -4424,17 +4424,17 @@ PresShell::ContentAppended(nsIDocument *
   // Call this here so it only happens for real content mutations and
   // not cases when the frame constructor calls its own methods to force
   // frame reconstruction.
   mPresContext->RestyleManager()->ContentAppended(aContainer, aFirstNewContent);
 
   mFrameConstructor->ContentAppended(
       aContainer,
       aFirstNewContent,
-      nsCSSFrameConstructor::LazyConstructionAllowed::Yes);
+      nsCSSFrameConstructor::InsertionKind::Async);
 
   VERIFY_STYLE_TREE;
 }
 
 void
 PresShell::ContentInserted(nsIDocument* aDocument,
                            nsIContent*  aMaybeContainer,
                            nsIContent*  aChild,
@@ -4454,17 +4454,17 @@ PresShell::ContentInserted(nsIDocument* 
   // not cases when the frame constructor calls its own methods to force
   // frame reconstruction.
   mPresContext->RestyleManager()->ContentInserted(container, aChild);
 
   mFrameConstructor->ContentInserted(
       aMaybeContainer,
       aChild,
       nullptr,
-      nsCSSFrameConstructor::LazyConstructionAllowed::Yes);
+      nsCSSFrameConstructor::InsertionKind::Async);
 
   if (aChild->NodeType() == nsIDOMNode::DOCUMENT_TYPE_NODE) {
     MOZ_ASSERT(container == aDocument);
     NotifyFontSizeInflationEnabledIsDirty();
   }
 
   VERIFY_STYLE_TREE;
 }
--- a/layout/base/RestyleManager.cpp
+++ b/layout/base/RestyleManager.cpp
@@ -1399,24 +1399,24 @@ RestyleManager::ProcessRestyledFrames(ns
       nsIContent* start = aChangeList[lazyRangeStart].mContent;
       nsIContent* end = NextSiblingWhichMayHaveFrame(aChangeList[i-1].mContent);
       nsIContent* container = start->GetParent();
       MOZ_ASSERT(container);
       if (!end) {
         frameConstructor->ContentAppended(
             container,
             start,
-            nsCSSFrameConstructor::LazyConstructionAllowed::No);
+            nsCSSFrameConstructor::InsertionKind::Sync);
       } else {
         frameConstructor->ContentRangeInserted(
             container,
             start,
             end,
             nullptr,
-            nsCSSFrameConstructor::LazyConstructionAllowed::No);
+            nsCSSFrameConstructor::InsertionKind::Sync);
       }
     }
     for (size_t j = lazyRangeStart; j < i; ++j) {
       MOZ_ASSERT(!aChangeList[j].mContent->GetPrimaryFrame() ||
                  !aChangeList[j].mContent->HasFlag(NODE_NEEDS_FRAME));
     }
     if (i == aChangeList.Length()) {
       break;
--- a/layout/base/nsCSSFrameConstructor.cpp
+++ b/layout/base/nsCSSFrameConstructor.cpp
@@ -7202,17 +7202,17 @@ nsCSSFrameConstructor::ReframeTextIfNeed
       !aContent->HasFlag(NS_CREATE_FRAME_IF_NON_WHITESPACE)) {
     // Not text, or not suppressed due to being all-whitespace (if it
     // were being suppressed, it would have the
     // NS_CREATE_FRAME_IF_NON_WHITESPACE flag)
     return;
   }
   NS_ASSERTION(!aContent->GetPrimaryFrame(),
                "Text node has a frame and NS_CREATE_FRAME_IF_NON_WHITESPACE");
-  ContentInserted(aParentContent, aContent, nullptr, LazyConstructionAllowed::Yes);
+  ContentInserted(aParentContent, aContent, nullptr, InsertionKind::Async);
 }
 
 #ifdef DEBUG
 void
 nsCSSFrameConstructor::CheckBitsForLazyFrameConstruction(nsIContent* aParent)
 {
   // If we hit a node with no primary frame, or the NODE_NEEDS_FRAME bit set
   // we want to assert, but leaf frames that process their own children and may
@@ -7375,26 +7375,26 @@ nsCSSFrameConstructor::CreateNeededFrame
         inRun = true;
         firstChildInRun = child;
       }
     } else {
       if (inRun) {
         inRun = false;
         // generate a ContentRangeInserted for [startOfRun,i)
         ContentRangeInserted(aContent, firstChildInRun, child, nullptr,
-                             LazyConstructionAllowed::No,
+                             InsertionKind::Sync,
                              true,  // aForReconstruction
                              &aTreeMatchContext);
       }
     }
   }
 
   if (inRun) {
     ContentAppended(aContent, firstChildInRun,
-                    LazyConstructionAllowed::No,
+                    InsertionKind::Sync,
                     true,  // aForReconstruction
                     &aTreeMatchContext);
   }
 
   // Now descend.
   FlattenedChildIterator iter(aContent);
   for (nsIContent* child = iter.GetNextChild(); child; child = iter.GetNextChild()) {
     if (child->HasFlag(NODE_DESCENDANTS_NEED_FRAMES)) {
@@ -7433,17 +7433,17 @@ nsCSSFrameConstructor::CreateNeededFrame
     EndUpdate();
   }
 }
 
 void
 nsCSSFrameConstructor::IssueSingleInsertNofications(nsIContent* aContainer,
                                                     nsIContent* aStartChild,
                                                     nsIContent* aEndChild,
-                                                    LazyConstructionAllowed aLazyConstructionAllowed,
+                                                    InsertionKind aInsertionKind,
                                                     bool aForReconstruction)
 {
   for (nsIContent* child = aStartChild;
        child != aEndChild;
        child = child->GetNextSibling()) {
     if ((child->GetPrimaryFrame() || GetDisplayNoneStyleFor(child) ||
          GetDisplayContentsStyleFor(child))
 #ifdef MOZ_XUL
@@ -7454,26 +7454,26 @@ nsCSSFrameConstructor::IssueSingleInsert
         ) {
       // Already have a frame or undisplayed entry for this content; a
       // previous ContentRangeInserted in this loop must have reconstructed
       // its insertion parent.  Skip it.
       continue;
     }
     // Call ContentRangeInserted with this node.
     ContentRangeInserted(aContainer, child, child->GetNextSibling(),
-                         mTempFrameTreeState, aLazyConstructionAllowed,
+                         mTempFrameTreeState, aInsertionKind,
                          aForReconstruction, nullptr);
   }
 }
 
 nsCSSFrameConstructor::InsertionPoint
 nsCSSFrameConstructor::GetRangeInsertionPoint(nsIContent* aContainer,
                                               nsIContent* aStartChild,
                                               nsIContent* aEndChild,
-                                              LazyConstructionAllowed aLazyConstructionAllowed,
+                                              InsertionKind aInsertionKind,
                                               bool aForReconstruction)
 {
   // See if we have an XBL insertion point. If so, then that's our
   // real parent frame; if not, then the frame hasn't been built yet
   // and we just bail.
   InsertionPoint insertionPoint = GetInsertionPoint(aContainer, nullptr);
   if (!insertionPoint.mParentFrame && !insertionPoint.mMultiple) {
     return insertionPoint; // Don't build the frames.
@@ -7513,17 +7513,17 @@ nsCSSFrameConstructor::GetRangeInsertion
     // If we have multiple insertion points or if we have an insertion point
     // and the operation is not a true append or if the insertion point already
     // has explicit children, then we must fall back.
     if (insertionPoint.mMultiple || aEndChild != nullptr || childCount > 0) {
       // Now comes the fun part.  For each inserted child, make a
       // ContentInserted call as if it had just gotten inserted and
       // let ContentInserted handle the mess.
       IssueSingleInsertNofications(aContainer, aStartChild, aEndChild,
-                                   aLazyConstructionAllowed, aForReconstruction);
+                                   aInsertionKind, aForReconstruction);
       insertionPoint.mParentFrame = nullptr;
     }
   }
 
   return insertionPoint;
 }
 
 bool
@@ -7585,40 +7585,34 @@ nsCSSFrameConstructor::StyleNewChildRang
       }
     }
   }
 }
 
 void
 nsCSSFrameConstructor::ContentAppended(nsIContent* aContainer,
                                        nsIContent* aFirstNewContent,
-                                       LazyConstructionAllowed aLazyConstructionAllowed,
+                                       InsertionKind aInsertionKind,
                                        bool aForReconstruction,
                                        TreeMatchContext* aProvidedTreeMatchContext)
 {
   MOZ_ASSERT(!aProvidedTreeMatchContext ||
-             aLazyConstructionAllowed == LazyConstructionAllowed::No);
-  MOZ_ASSERT(aLazyConstructionAllowed == LazyConstructionAllowed::No ||
-             !RestyleManager()->IsInStyleRefresh());
-
-  const InsertionKind insertionKind =
-    aLazyConstructionAllowed == LazyConstructionAllowed::Yes
-      ? InsertionKind::Async
-      : InsertionKind::Sync;
+             aInsertionKind == InsertionKind::Sync);
+  MOZ_ASSERT(aInsertionKind == InsertionKind::Sync || !RestyleManager()->IsInStyleRefresh());
 
   AUTO_LAYOUT_PHASE_ENTRY_POINT(mPresShell->GetPresContext(), FrameC);
   NS_PRECONDITION(mUpdateCount != 0,
                   "Should be in an update while creating frames");
 
 #ifdef DEBUG
   if (gNoisyContentUpdates) {
     printf("nsCSSFrameConstructor::ContentAppended container=%p "
            "first-child=%p lazy=%d\n",
            static_cast<void*>(aContainer), aFirstNewContent,
-           static_cast<int>(aLazyConstructionAllowed));
+           aInsertionKind == InsertionKind::Async);
     if (gReallyNoisyContentUpdates && aContainer) {
       aContainer->List(stdout, 0);
     }
   }
 #endif
 
 #ifdef DEBUG
   for (nsIContent* child = aFirstNewContent;
@@ -7663,23 +7657,23 @@ nsCSSFrameConstructor::ContentAppended(n
     // See comment in ContentRangeInserted for why this is necessary.
     if (!GetContentInsertionFrameFor(aContainer) &&
         !aContainer->IsActiveChildrenElement()) {
       // We're punting on frame construction because there's no container frame.
       // The Servo-backed style system handles this case like the lazy frame
       // construction case, except when we're already constructing frames, in
       // which case we shouldn't need to do anything else.
       if (isNewlyAddedContentForServo &&
-          aLazyConstructionAllowed == LazyConstructionAllowed::Yes) {
+          aInsertionKind == InsertionKind::Async) {
         LazilyStyleNewChildRange(aFirstNewContent, nullptr);
       }
       return;
     }
 
-    if (aLazyConstructionAllowed == LazyConstructionAllowed::Yes &&
+    if (aInsertionKind == InsertionKind::Async &&
         MaybeConstructLazily(CONTENTAPPEND, aContainer, aFirstNewContent)) {
       if (isNewlyAddedContentForServo) {
         LazilyStyleNewChildRange(aFirstNewContent, nullptr);
       }
       return;
     }
   }
 
@@ -7690,48 +7684,48 @@ nsCSSFrameConstructor::ContentAppended(n
 
   if (isNewShadowTreeContent) {
     // Recreate frames if content is appended into a ShadowRoot
     // because children of ShadowRoot are rendered in place of children
     // of the host.
     //XXXsmaug This is super unefficient!
     nsIContent* bindingParent = aContainer->GetBindingParent();
     LAYOUT_PHASE_TEMP_EXIT();
-    RecreateFramesForContent(bindingParent, insertionKind);
+    RecreateFramesForContent(bindingParent, aInsertionKind);
     LAYOUT_PHASE_TEMP_REENTER();
     return;
   }
 
   LAYOUT_PHASE_TEMP_EXIT();
   InsertionPoint insertion =
     GetRangeInsertionPoint(aContainer, aFirstNewContent, nullptr,
-                           aLazyConstructionAllowed, aForReconstruction);
+                           aInsertionKind, aForReconstruction);
   nsContainerFrame*& parentFrame = insertion.mParentFrame;
   LAYOUT_PHASE_TEMP_REENTER();
   if (!parentFrame) {
     return;
   }
 
   LAYOUT_PHASE_TEMP_EXIT();
-  if (MaybeRecreateForFrameset(parentFrame, aFirstNewContent, nullptr, insertionKind)) {
+  if (MaybeRecreateForFrameset(parentFrame, aFirstNewContent, nullptr, aInsertionKind)) {
     LAYOUT_PHASE_TEMP_REENTER();
     return;
   }
   LAYOUT_PHASE_TEMP_REENTER();
 
   if (parentFrame->IsLeaf()) {
     // Nothing to do here; we shouldn't be constructing kids of leaves
     // Clear lazy bits so we don't try to construct again.
     ClearLazyBits(aFirstNewContent, nullptr);
     return;
   }
 
   if (parentFrame->IsFrameOfType(nsIFrame::eMathML)) {
     LAYOUT_PHASE_TEMP_EXIT();
-    RecreateFramesForContent(parentFrame->GetContent(), insertionKind);
+    RecreateFramesForContent(parentFrame->GetContent(), aInsertionKind);
     LAYOUT_PHASE_TEMP_REENTER();
     return;
   }
 
   // If the frame we are manipulating is a ib-split frame (that is, one
   // that's been created as a result of a block-in-inline situation) then we
   // need to append to the last ib-split sibling, not to the frame itself.
   bool parentIBSplit = IsFramePartOfIBSplit(parentFrame);
@@ -7826,17 +7820,17 @@ nsCSSFrameConstructor::ContentAppended(n
   nsIFrame* prevSibling = ::FindAppendPrevSibling(parentFrame, parentAfterFrame);
 
   // Perform special check for diddling around with the frames in
   // a ib-split inline frame.
   // If we're appending before :after content, then we're not really
   // appending, so let WipeContainingBlock know that.
   LAYOUT_PHASE_TEMP_EXIT();
   if (WipeContainingBlock(state, containingBlock, parentFrame, items,
-                          true, prevSibling, insertionKind)) {
+                          true, prevSibling, aInsertionKind)) {
     LAYOUT_PHASE_TEMP_REENTER();
     return;
   }
   LAYOUT_PHASE_TEMP_REENTER();
 
   // If the parent is a block frame, and we're not in a special case
   // where frames can be moved around, determine if the list is for the
   // start or end of the block.
@@ -7973,23 +7967,23 @@ bool NotifyListBoxBody(nsPresContext*   
   return false;
 }
 #endif // MOZ_XUL
 
 void
 nsCSSFrameConstructor::ContentInserted(nsIContent* aContainer,
                                        nsIContent* aChild,
                                        nsILayoutHistoryState* aFrameState,
-                                       LazyConstructionAllowed aLazyConstructionAllowed)
+                                       InsertionKind aInsertionKind)
 {
   ContentRangeInserted(aContainer,
                        aChild,
                        aChild->GetNextSibling(),
                        aFrameState,
-                       aLazyConstructionAllowed);
+                       aInsertionKind);
 }
 
 // ContentRangeInserted handles creating frames for a range of nodes that
 // aren't at the end of their childlist. ContentRangeInserted isn't a real
 // content notification, but rather it handles regular ContentInserted calls
 // for a single node as well as the lazy construction of frames for a range of
 // nodes when called from CreateNeededFrames. For a range of nodes to be
 // suitable to have its frames constructed all at once they must meet the same
@@ -8005,43 +7999,37 @@ nsCSSFrameConstructor::ContentInserted(n
 // in the caption list, while skipping any nodes in the range being inserted
 // (because when we treat the caption frames the other nodes have had their
 // frames constructed but not yet inserted into the frame tree).
 void
 nsCSSFrameConstructor::ContentRangeInserted(nsIContent* aContainer,
                                             nsIContent* aStartChild,
                                             nsIContent* aEndChild,
                                             nsILayoutHistoryState* aFrameState,
-                                            LazyConstructionAllowed aLazyConstructionAllowed,
+                                            InsertionKind aInsertionKind,
                                             bool aForReconstruction,
                                             TreeMatchContext* aProvidedTreeMatchContext)
 {
   MOZ_ASSERT(!aProvidedTreeMatchContext ||
-             aLazyConstructionAllowed == LazyConstructionAllowed::No);
-  MOZ_ASSERT(aLazyConstructionAllowed == LazyConstructionAllowed::No ||
-             !RestyleManager()->IsInStyleRefresh());
+             aInsertionKind == InsertionKind::Sync);
+  MOZ_ASSERT(aInsertionKind == InsertionKind::Sync || !RestyleManager()->IsInStyleRefresh());
 
   AUTO_LAYOUT_PHASE_ENTRY_POINT(mPresShell->GetPresContext(), FrameC);
   NS_PRECONDITION(mUpdateCount != 0,
                   "Should be in an update while creating frames");
 
   NS_PRECONDITION(aStartChild, "must always pass a child");
 
-  const InsertionKind insertionKind =
-    aLazyConstructionAllowed == LazyConstructionAllowed::Yes
-      ? InsertionKind::Async
-      : InsertionKind::Sync;
-
 #ifdef DEBUG
   if (gNoisyContentUpdates) {
     printf("nsCSSFrameConstructor::ContentRangeInserted container=%p "
            "start-child=%p end-child=%p lazy=%d\n",
            static_cast<void*>(aContainer),
            static_cast<void*>(aStartChild), static_cast<void*>(aEndChild),
-           static_cast<int>(aLazyConstructionAllowed));
+           aInsertionKind == InsertionKind::Async);
     if (gReallyNoisyContentUpdates) {
       if (aContainer) {
         aContainer->List(stdout,0);
       } else {
         aStartChild->List(stdout, 0);
       }
     }
   }
@@ -8054,17 +8042,17 @@ nsCSSFrameConstructor::ContentRangeInser
     NS_ASSERTION(!child->GetPrimaryFrame() ||
                  child->GetPrimaryFrame()->GetContent() != child,
                  "asked to construct a frame for a node that already has a frame");
   }
 #endif
 
   bool isSingleInsert = (aStartChild->GetNextSibling() == aEndChild);
   NS_ASSERTION(isSingleInsert ||
-               aLazyConstructionAllowed == LazyConstructionAllowed::No,
+               aInsertionKind == InsertionKind::Sync,
                "range insert shouldn't be lazy");
   NS_ASSERTION(isSingleInsert || aEndChild,
                "range should not include all nodes after aStartChild");
 
 #ifdef MOZ_XUL
   if (aContainer && IsXULListBox(aContainer)) {
     if (isSingleInsert) {
       if (NotifyListBoxBody(mPresShell->GetPresContext(), aContainer,
@@ -8073,17 +8061,17 @@ nsCSSFrameConstructor::ContentRangeInser
                             aStartChild, nullptr, nullptr, CONTENT_INSERTED)) {
         return;
       }
     } else {
       // We don't handle a range insert to a listbox parent, issue single
       // ContertInserted calls for each node inserted.
       LAYOUT_PHASE_TEMP_EXIT();
       IssueSingleInsertNofications(aContainer, aStartChild, aEndChild,
-                                   aLazyConstructionAllowed, aForReconstruction);
+                                   aInsertionKind, aForReconstruction);
       LAYOUT_PHASE_TEMP_REENTER();
       return;
     }
   }
 #endif // MOZ_XUL
 
   // If we have a null parent, then this must be the document element being
   // inserted, or some other child of the document in the DOM (might be a PI,
@@ -8149,27 +8137,27 @@ nsCSSFrameConstructor::ContentRangeInser
     // a parent. While its uncommon to change the structure of the default content itself, a label,
     // for example, can be reframed by having its value attribute set or removed.
     if (!parentFrame && !aContainer->IsActiveChildrenElement()) {
       // We're punting on frame construction because there's no container frame.
       // The Servo-backed style system handles this case like the lazy frame
       // construction case, except when we're already constructing frames, in
       // which case we shouldn't need to do anything else.
       if (isNewlyAddedContentForServo &&
-          aLazyConstructionAllowed == LazyConstructionAllowed::Yes) {
+          aInsertionKind == InsertionKind::Async) {
         LazilyStyleNewChildRange(aStartChild, aEndChild);
       }
       return;
     }
 
     // Otherwise, we've got parent content. Find its frame.
     NS_ASSERTION(!parentFrame || parentFrame->GetContent() == aContainer ||
                  GetDisplayContentsStyleFor(aContainer), "New XBL code is possibly wrong!");
 
-    if (aLazyConstructionAllowed == LazyConstructionAllowed::Yes &&
+    if (aInsertionKind == InsertionKind::Async &&
         MaybeConstructLazily(CONTENTINSERT, aContainer, aStartChild)) {
       if (isNewlyAddedContentForServo) {
         LazilyStyleNewChildRange(aStartChild, aEndChild);
       }
       return;
     }
   }
 
@@ -8180,33 +8168,33 @@ nsCSSFrameConstructor::ContentRangeInser
 
   if (isNewShadowTreeContent) {
     // Recreate frames if content is inserted into a ShadowRoot
     // because children of ShadowRoot are rendered in place of
     // the children of the host.
     //XXXsmaug This is super unefficient!
     nsIContent* bindingParent = aContainer->GetBindingParent();
     LAYOUT_PHASE_TEMP_EXIT();
-    RecreateFramesForContent(bindingParent, insertionKind);
+    RecreateFramesForContent(bindingParent, aInsertionKind);
     LAYOUT_PHASE_TEMP_REENTER();
     return;
   }
 
   InsertionPoint insertion;
   if (isSingleInsert) {
     // See if we have an XBL insertion point. If so, then that's our
     // real parent frame; if not, then the frame hasn't been built yet
     // and we just bail.
     insertion = GetInsertionPoint(aContainer, aStartChild);
   } else {
     // Get our insertion point. If we need to issue single ContentInserted's
     // GetRangeInsertionPoint will take care of that for us.
     LAYOUT_PHASE_TEMP_EXIT();
     insertion = GetRangeInsertionPoint(aContainer, aStartChild, aEndChild,
-                                       aLazyConstructionAllowed,
+                                       aInsertionKind,
                                        aForReconstruction);
     LAYOUT_PHASE_TEMP_REENTER();
   }
 
   if (!insertion.mParentFrame) {
     return;
   }
 
@@ -8214,26 +8202,26 @@ nsCSSFrameConstructor::ContentRangeInser
   nsIFrame* prevSibling = GetInsertionPrevSibling(&insertion, aStartChild,
                                                   &isAppend, &isRangeInsertSafe);
 
   // check if range insert is safe
   if (!isSingleInsert && !isRangeInsertSafe) {
     // must fall back to a single ContertInserted for each child in the range
     LAYOUT_PHASE_TEMP_EXIT();
     IssueSingleInsertNofications(aContainer, aStartChild, aEndChild,
-                                 aLazyConstructionAllowed, aForReconstruction);
+                                 aInsertionKind, aForReconstruction);
     LAYOUT_PHASE_TEMP_REENTER();
     return;
   }
 
   nsIContent* container = insertion.mParentFrame->GetContent();
 
   LayoutFrameType frameType = insertion.mParentFrame->Type();
   LAYOUT_PHASE_TEMP_EXIT();
-  if (MaybeRecreateForFrameset(insertion.mParentFrame, aStartChild, aEndChild, insertionKind)) {
+  if (MaybeRecreateForFrameset(insertion.mParentFrame, aStartChild, aEndChild, aInsertionKind)) {
     LAYOUT_PHASE_TEMP_REENTER();
     return;
   }
   LAYOUT_PHASE_TEMP_REENTER();
 
   // We should only get here with fieldsets when doing a single insert, because
   // fieldsets have multiple insertion points.
   NS_ASSERTION(isSingleInsert || frameType != LayoutFrameType::FieldSet,
@@ -8243,47 +8231,47 @@ nsCSSFrameConstructor::ContentRangeInser
     // Just reframe the parent, since figuring out whether this
     // should be the new legend and then handling it is too complex.
     // We could do a little better here --- check if the fieldset already
     // has a legend which occurs earlier in its child list than this node,
     // and if so, proceed. But we'd have to extend nsFieldSetFrame
     // to locate this legend in the inserted frames and extract it.
     LAYOUT_PHASE_TEMP_EXIT();
     RecreateFramesForContent(insertion.mParentFrame->GetContent(),
-                             insertionKind);
+                             aInsertionKind);
     LAYOUT_PHASE_TEMP_REENTER();
     return;
   }
 
   // We should only get here with details when doing a single insertion because
   // we treat details frame as if it has multiple insertion points.
   MOZ_ASSERT(isSingleInsert || frameType != LayoutFrameType::Details);
   if (frameType == LayoutFrameType::Details) {
     // When inserting an element into <details>, just reframe the details frame
     // and let it figure out where the element should be laid out. It might seem
     // expensive to recreate the entire details frame, but it's the simplest way
     // to handle the insertion.
     LAYOUT_PHASE_TEMP_EXIT();
     RecreateFramesForContent(insertion.mParentFrame->GetContent(),
-                             insertionKind);
+                             aInsertionKind);
     LAYOUT_PHASE_TEMP_REENTER();
     return;
   }
 
   // Don't construct kids of leaves
   if (insertion.mParentFrame->IsLeaf()) {
     // Clear lazy bits so we don't try to construct again.
     ClearLazyBits(aStartChild, aEndChild);
     return;
   }
 
   if (insertion.mParentFrame->IsFrameOfType(nsIFrame::eMathML)) {
     LAYOUT_PHASE_TEMP_EXIT();
     RecreateFramesForContent(insertion.mParentFrame->GetContent(),
-                             insertionKind);
+                             aInsertionKind);
     LAYOUT_PHASE_TEMP_REENTER();
     return;
   }
 
   Maybe<TreeMatchContext> matchContext;
   if (!aProvidedTreeMatchContext && !aContainer->IsStyledByServo()) {
     matchContext.emplace(mDocument, TreeMatchContext::ForFrameConstruction);
     matchContext->InitAncestors(aContainer ? aContainer->AsElement() : nullptr);
@@ -8353,17 +8341,17 @@ nsCSSFrameConstructor::ContentRangeInser
       // Need check whether a range insert is still safe.
       if (!isSingleInsert && !isRangeInsertSafe) {
         // Need to recover the letter frames first.
         RecoverLetterFrames(state.mFloatedItems.containingBlock);
 
         // must fall back to a single ContertInserted for each child in the range
         LAYOUT_PHASE_TEMP_EXIT();
         IssueSingleInsertNofications(aContainer, aStartChild, aEndChild,
-                                     aLazyConstructionAllowed, aForReconstruction);
+                                     aInsertionKind, aForReconstruction);
         LAYOUT_PHASE_TEMP_REENTER();
         return;
       }
 
       container = insertion.mParentFrame->GetContent();
       frameType = insertion.mParentFrame->Type();
     }
   }
@@ -8421,17 +8409,17 @@ nsCSSFrameConstructor::ContentRangeInser
   }
 
   // Perform special check for diddling around with the frames in
   // a special inline frame.
   // If we're appending before :after content, then we're not really
   // appending, so let WipeContainingBlock know that.
   LAYOUT_PHASE_TEMP_EXIT();
   if (WipeContainingBlock(state, containingBlock, insertion.mParentFrame, items,
-                          isAppend, prevSibling, insertionKind)) {
+                          isAppend, prevSibling, aInsertionKind)) {
     LAYOUT_PHASE_TEMP_REENTER();
     return;
   }
   LAYOUT_PHASE_TEMP_REENTER();
 
   // If the container is a table and a caption will be appended, it needs to be
   // put in the table wrapper frame's additional child list.
   // We make no attempt here to set flags to indicate whether the list
@@ -10069,24 +10057,19 @@ nsCSSFrameConstructor::RecreateFramesFor
         // construction to apply to all elements first.
         RestyleManager()->PostRestyleEvent(aContent->AsElement(),
                                            nsRestyleHint(0),
                                            nsChangeHint_ReconstructFrame);
       } else {
         // Now, recreate the frames associated with this content object. If
         // ContentRemoved triggered reconstruction, then we don't need to do this
         // because the frames will already have been built.
-        auto lazyFrameConstructionAllowed =
-          aInsertionKind == InsertionKind::Async
-            ? LazyConstructionAllowed::Yes
-            : LazyConstructionAllowed::No;
-
         ContentRangeInserted(container, aContent, aContent->GetNextSibling(),
                              mTempFrameTreeState,
-                             lazyFrameConstructionAllowed,
+                             aInsertionKind,
                              true,  // aForReconstruction
                              nullptr);
       }
     }
   }
 }
 
 bool
--- a/layout/base/nsCSSFrameConstructor.h
+++ b/layout/base/nsCSSFrameConstructor.h
@@ -82,22 +82,16 @@ public:
    * from ContentRemoved.
    */
   enum class InsertionKind
   {
     Sync,
     Async,
   };
 
-  enum class LazyConstructionAllowed
-  {
-    No = 0,
-    Yes,
-  };
-
   mozilla::RestyleManager* RestyleManager() const
     { return mPresShell->GetPresContext()->RestyleManager(); }
 
   nsIFrame* ConstructRootFrame();
 
   void ReconstructDocElementHierarchy(InsertionKind);
 
   // Create frames for content nodes that are marked as needing frames. This
@@ -128,17 +122,17 @@ private:
   void CheckBitsForLazyFrameConstruction(nsIContent*) {}
 #endif
 
   // Issues a single ContentInserted for each child of aContainer in the range
   // [aStartChild, aEndChild).
   void IssueSingleInsertNofications(nsIContent* aContainer,
                                     nsIContent* aStartChild,
                                     nsIContent* aEndChild,
-                                    LazyConstructionAllowed,
+                                    InsertionKind,
                                     bool aForReconstruction);
 
   /**
    * Data that represents an insertion point for some child content.
    */
   struct InsertionPoint
   {
     InsertionPoint()
@@ -172,17 +166,17 @@ private:
    * can be inserted/appended to one insertion point together. If so, returns
    * that insertion point. If not, returns with InsertionPoint.mFrame == nullptr
    * and issues single ContentInserted calls for each child.
    * aEndChild = nullptr indicates that we are dealing with an append.
    */
   InsertionPoint GetRangeInsertionPoint(nsIContent* aContainer,
                                         nsIContent* aStartChild,
                                         nsIContent* aEndChild,
-                                        LazyConstructionAllowed,
+                                        InsertionKind,
                                         bool aForReconstruction);
 
   // Returns true if parent was recreated due to frameset child, false otherwise.
   bool MaybeRecreateForFrameset(nsIFrame* aParentFrame,
                                 nsIContent* aStartChild,
                                 nsIContent* aEndChild,
                                 InsertionKind);
 
@@ -203,34 +197,34 @@ private:
    * It handles children being rebound to different insertion points by calling
    * StyleNewChildren on each child's flattened tree parent.  Only used when we
    * are styled by Servo.
    */
   void StyleNewChildRange(nsIContent* aStartChild, nsIContent* aEndChild);
 
 public:
   /**
-   * Lazy frame construction is controlled by the aAllowLazyConstruction bool
-   * parameter of nsCSSFrameConstructor::ContentAppended/Inserted. It is true
-   * for all inserts/appends as passed from the presshell, except for the
-   * insert of the root element, which is always non-lazy. Even if the
-   * aAllowLazyConstruction passed to ContentAppended/Inserted is true we still
-   * may not be able to construct lazily, so we call MaybeConstructLazily.
-   * MaybeConstructLazily does not allow lazy construction if any of the
-   * following are true:
+   * Lazy frame construction is controlled by the InsertionKind parameter of
+   * nsCSSFrameConstructor::ContentAppended/Inserted. It is true for all
+   * inserts/appends as passed from the presshell, except for the insert of the
+   * root element, which is always non-lazy.
+   *
+   * Even if the aInsertionKind passed to ContentAppended/Inserted is
+   * Async we still may not be able to construct lazily, so we call
+   * MaybeConstructLazily.  MaybeConstructLazily does not allow lazy
+   * construction if any of the following are true:
    *  -we are in chrome
    *  -the container is in a native anonymous subtree
    *  -the container is XUL
    *  -is any of the appended/inserted nodes are XUL or editable
    *  -(for inserts) the child is anonymous.  In the append case this function
    *   must not be called with anonymous children.
    * The XUL and chrome checks are because XBL bindings only get applied at
    * frame construction time and some things depend on the bindings getting
-   * attached synchronously. The editable checks are because the editor seems
-   * to expect frames to be constructed synchronously.
+   * attached synchronously.
    *
    * If MaybeConstructLazily returns false we construct as usual, but if it
    * returns true then it adds NODE_NEEDS_FRAME bits to the newly
    * inserted/appended nodes and adds NODE_DESCENDANTS_NEED_FRAMES bits to the
    * container and up along the parent chain until it hits the root or another
    * node with that bit set. Then it posts a restyle event to ensure that a
    * flush happens to construct those frames.
    *
@@ -246,81 +240,81 @@ public:
    * ancestor nodes because that is a slow operation, the work might be wasted
    * if another node gets inserted in its place, and we can clear the bits
    * quicker by processing the content tree from top down the next time we call
    * CreateNeededFrames. (We do clear the bits when BindToTree is called on any
    * nsIContent; so any nodes added to the document will not have any lazy bits
    * set.)
    */
 
-  // If aAllowLazyConstruction is true then frame construction of the new
-  // children can be done lazily.
+  // If aInsertionKind is Async then frame construction of the new children can
+  // be done lazily.
   //
   // When constructing frames lazily, we can keep the tree match context in a
   // much easier way than nsFrameConstructorState, and thus, we're allowed to
   // provide a TreeMatchContext to avoid calling InitAncestors repeatedly deep
   // in the DOM.
   void ContentAppended(nsIContent* aContainer,
                        nsIContent* aFirstNewContent,
-                       LazyConstructionAllowed aLazyConstructionAllowed,
+                       InsertionKind aInsertionKind,
                        TreeMatchContext* aProvidedTreeMatchContext = nullptr)
   {
-    ContentAppended(aContainer, aFirstNewContent, aLazyConstructionAllowed, false,
+    ContentAppended(aContainer, aFirstNewContent, aInsertionKind, false,
                     aProvidedTreeMatchContext);
   }
 
-  // If aAllowLazyConstruction is true then frame construction of the new child
+  // If aInsertionkind is Async then frame construction of the new child
   // can be done lazily.
   void ContentInserted(nsIContent* aContainer,
                        nsIContent* aChild,
                        nsILayoutHistoryState* aFrameState,
-                       LazyConstructionAllowed aLazyConstructionAllowed);
+                       InsertionKind aInsertionKind);
 
   // Like ContentInserted but handles inserting the children of aContainer in
   // the range [aStartChild, aEndChild).  aStartChild must be non-null.
   // aEndChild may be null to indicate the range includes all kids after
   // aStartChild.
   //
-  // If aAllowLazyConstruction is true then frame construction of
-  // the new children can be done lazily. It is only allowed to be true when
-  // inserting a single node.
+  // If aInsertionKind is Async then frame construction of the new children can
+  // be done lazily. It is only allowed to be Async when inserting a single
+  // node.
   //
   // See ContentAppended to see why we allow passing an already initialized
   // TreeMatchContext.
   void ContentRangeInserted(nsIContent* aContainer,
                             nsIContent* aStartChild,
                             nsIContent* aEndChild,
                             nsILayoutHistoryState* aFrameState,
-                            LazyConstructionAllowed aLazyConstructionAllowed,
+                            InsertionKind aInsertionKind,
                             TreeMatchContext* aProvidedTreeMatchContext = nullptr)
   {
     ContentRangeInserted(aContainer, aStartChild, aEndChild, aFrameState,
-                         aLazyConstructionAllowed, false,
+                         aInsertionKind, false,
                          aProvidedTreeMatchContext);
   }
 
 private:
   // Helpers for the public ContentAppended, ContentInserted and
   // ContentRangeInserted functions above.
   //
   // aForReconstruction indicates whether this call is for frame reconstruction
   // via RecreateFramesFor or lazy frame construction via CreateNeededFrames.
   // (This latter case admittedly isn't always for "reconstruction" per se, but
   // the important thing is that aForReconstruction is false for real content
   // insertions, and true for other cases.)
   void ContentAppended(nsIContent* aContainer,
                        nsIContent* aFirstNewContent,
-                       LazyConstructionAllowed aLazyConstructionAllowed,
+                       InsertionKind aInsertionKind,
                        bool aForReconstruction,
                        TreeMatchContext* aProvidedTreeMatchContext);
   void ContentRangeInserted(nsIContent* aContainer,
                             nsIContent* aStartChild,
                             nsIContent* aEndChild,
                             nsILayoutHistoryState* aFrameState,
-                            LazyConstructionAllowed aLazyConstructionAllowed,
+                            InsertionKind aInsertionKind,
                             bool aForReconstruction,
                             TreeMatchContext* aProvidedTreeMatchContext);
 
 public:
   enum RemoveFlags {
     REMOVE_CONTENT,
     REMOVE_FOR_RECONSTRUCTION,
   };