nsFrameConstructorState::AddChild(nsIFrame* aNewFrame, nsFrameItems& aFrameItems, const nsStyleDisplay* aStyleDisplay, nsIContent* aContent, nsStyleContext* aStyleContext, nsIFrame* aParentFrame, PRBool aCanBePositioned, PRBool aCanBeFloated)
nsFrameItems::AddChild(nsIFrame* aChild)
nsFrameConstructorState::AddChild(nsIFrame* aNewFrame,                                  nsFrameItems& aFrameItems,                                  const nsStyleDisplay* aStyleDisplay,                                  nsIContent* aContent,                                  nsStyleContext* aStyleContext,                                  nsIFrame* aParentFrame,                                  PRBool aCanBePositioned,                                  PRBool aCanBeFloated){  // The comments in GetGeometricParent regarding root table frames  // all apply here, unfortunately.  PRBool needPlaceholder = PR_FALSE;  nsFrameItems* frameItems = &aFrameItems;  if (aCanBeFloated && aStyleDisplay->IsFloating() &&      mFloatedItems.containingBlock) {    NS_ASSERTION(aNewFrame->GetParent() == mFloatedItems.containingBlock,                 "Float whose parent is not the float containing block?");    needPlaceholder = PR_TRUE;    frameItems = &mFloatedItems;  } else if (aCanBePositioned) {    if (aStyleDisplay->mPosition == NS_STYLE_POSITION_ABSOLUTE &&        mAbsoluteItems.containingBlock) {      NS_ASSERTION(aNewFrame->GetParent() == mAbsoluteItems.containingBlock,                   "Abs pos whose parent is not the abs pos containing block?");      needPlaceholder = PR_TRUE;      frameItems = &mAbsoluteItems;    }    if (aStyleDisplay->mPosition == NS_STYLE_POSITION_FIXED &&        mFixedItems.containingBlock) {      NS_ASSERTION(aNewFrame->GetParent() == mFixedItems.containingBlock,                   "Fixed pos whose parent is not the fixed pos containing block?");      needPlaceholder = PR_TRUE;      frameItems = &mFixedItems;    }  }  if (needPlaceholder) {    NS_ASSERTION(frameItems != &aFrameItems,                 "Putting frame in-flow _and_ want a placeholder?");    nsIFrame* placeholderFrame;    nsresult rv =      nsCSSFrameConstructor::CreatePlaceholderFrameFor(mPresShell,                                                       mPresContext,                                                       mFrameManager,                                                       aContent,                                                       aNewFrame,                                                       aStyleContext,                                                       aParentFrame,                                                       &placeholderFrame);    if (NS_FAILED(rv)) {      // Note that aNewFrame could be the top frame for a scrollframe setup,      // hence already set as the primary frame.  So we have to clean up here.      // But it shouldn't have any out-of-flow kids.      // XXXbz Maybe add a utility function to assert that?      CleanupFrameReferences(mPresContext, mFrameManager,                             aNewFrame);      aNewFrame->Destroy(mPresContext);      return rv;    }    // Add the placeholder frame to the flow    aFrameItems.AddChild(placeholderFrame);  }#ifdef DEBUG  else {    NS_ASSERTION(aNewFrame->GetParent() == aParentFrame,                 "In-flow frame has wrong parent");  }#endif  frameItems->AddChild(aNewFrame);  // Now add the special siblings too.  nsIFrame* specialSibling = aNewFrame;  while (specialSibling && IsFrameSpecial(specialSibling)) {    GetSpecialSibling(mFrameManager, specialSibling, &specialSibling);    if (specialSibling) {      NS_ASSERTION(frameItems == &aFrameItems,                   "IB split ending up in an out-of-flow childlist?");      frameItems->AddChild(specialSibling);    }  }    return NS_OK;}