lastFrame = frame;
nsFieldSetFrame::SetInitialChildList(nsIPresContext& aPresContext,                                     nsIAtom*        aListName,                                     nsIFrame*       aChildList){  // cache our display type  const nsStyleDisplay* styleDisplay;  GetStyleData(eStyleStruct_Display, (const nsStyleStruct*&) styleDisplay);  mInline = (NS_STYLE_DISPLAY_BLOCK != styleDisplay->mDisplay);  PRUint8 flags = (mInline) ? NS_BLOCK_SHRINK_WRAP : 0;  NS_NewAreaFrame(mContentFrame, flags);  mFrames.SetFrames(mContentFrame);  // Resolve style and initialize the frame  nsIStyleContext* styleContext;  aPresContext.ResolvePseudoStyleContextFor(mContent,                                             nsHTMLAtoms::fieldsetContentPseudo,                                            mStyleContext, PR_FALSE,                                            &styleContext);  mFrames.FirstChild()->Init(aPresContext, mContent, this, styleContext, nsnull);  NS_RELEASE(styleContext);                                             nsIFrame* newChildList = aChildList;  // XXX this just tosses any extra frames passed in onto the floor;  // this is a memory leak!!!  mFrames.FirstChild()->SetNextSibling(nsnull);  // Set the geometric and content parent for each of the child frames.   // The legend is handled differently and removed from aChildList  nsIFrame* lastFrame = nsnull;  for (nsIFrame* frame = aChildList; nsnull != frame;) {    nsIFrame* legendFrame = nsnull;    nsresult result = frame->QueryInterface(kLegendFrameCID, (void**)&legendFrame);    if ((NS_OK == result) && legendFrame) {      nsIFrame* nextFrame;      frame->GetNextSibling(&nextFrame);      if (lastFrame) {        lastFrame->SetNextSibling(nextFrame);      } else {        newChildList = nextFrame;      }      frame->SetParent(this);      mFrames.FirstChild()->SetNextSibling(frame);      mLegendFrame = frame;      mLegendFrame->SetNextSibling(nsnull);      frame = nextFrame;     } else {      frame->SetParent(mFrames.FirstChild());      frame->GetNextSibling(&frame);    }    lastFrame = frame;  }  // Queue up the frames for the content frame  return mFrames.FirstChild()->SetInitialChildList(aPresContext, nsnull, newChildList);}