aAbsoluteItems.AddChild(newFrame);
if (isAbsolutelyPositioned) { aAbsoluteItems.AddChild(newFrame); } else { aFixedItems.AddChild(newFrame); }
HTMLStyleSheetImpl::ConstructFrameByTag(nsIPresContext*  aPresContext,                                        nsIContent*      aContent,                                        nsIFrame*        aParentFrame,                                        nsIAtom*         aTag,                                        nsIStyleContext* aStyleContext,                                        nsAbsoluteItems& aAbsoluteItems,                                        nsFrameItems&    aFrameItems){  PRBool    processChildren = PR_FALSE;  // whether we should process child content  PRBool    isAbsolutelyPositioned = PR_FALSE;  PRBool    frameHasBeenInitialized = PR_FALSE;  nsIFrame* newFrame = nsnull;  // the frame we construct  nsresult  rv = NS_OK;  if (nsLayoutAtoms::textTagName == aTag) {    rv = NS_NewTextFrame(newFrame);  }  else {    nsIHTMLContent *htmlContent;    // Ignore the tag if it's not HTML content    if (NS_SUCCEEDED(aContent->QueryInterface(kIHTMLContentIID, (void **)&htmlContent))) {      NS_RELEASE(htmlContent);            // See if the element is absolutely positioned      const nsStylePosition* position = (const nsStylePosition*)        aStyleContext->GetStyleData(eStyleStruct_Position);      if (NS_STYLE_POSITION_ABSOLUTE == position->mPosition) {        isAbsolutelyPositioned = PR_TRUE;      }      // Create a frame based on the tag      if (nsHTMLAtoms::img == aTag) {        rv = NS_NewImageFrame(newFrame);      }      else if (nsHTMLAtoms::hr == aTag) {        rv = NS_NewHRFrame(newFrame);      }      else if (nsHTMLAtoms::br == aTag) {        rv = NS_NewBRFrame(newFrame);      }      else if (nsHTMLAtoms::wbr == aTag) {        rv = NS_NewWBRFrame(newFrame);      }      else if (nsHTMLAtoms::input == aTag) {        rv = CreateInputFrame(aContent, newFrame);      }      else if (nsHTMLAtoms::textarea == aTag) {        rv = NS_NewTextControlFrame(newFrame);      }      else if (nsHTMLAtoms::select == aTag) {        rv = ConstructSelectFrame(aPresContext, aContent, aParentFrame,                                  aTag, aStyleContext, aAbsoluteItems, newFrame,                                   processChildren, isAbsolutelyPositioned, frameHasBeenInitialized);      }      else if (nsHTMLAtoms::applet == aTag) {        rv = NS_NewObjectFrame(newFrame);      }      else if (nsHTMLAtoms::embed == aTag) {        rv = NS_NewObjectFrame(newFrame);      }      else if (nsHTMLAtoms::fieldset == aTag) {        rv = NS_NewFieldSetFrame(newFrame);        processChildren = PR_TRUE;      }      else if (nsHTMLAtoms::legend == aTag) {        rv = NS_NewLegendFrame(newFrame);        processChildren = PR_TRUE;        isAbsolutelyPositioned = PR_FALSE;  // don't absolutely position      }      else if (nsHTMLAtoms::object == aTag) {        rv = NS_NewObjectFrame(newFrame);        nsIFrame *blockFrame;        NS_NewBlockFrame(blockFrame, 0);        blockFrame->Init(*aPresContext, aContent, newFrame, aStyleContext);        newFrame = blockFrame;        processChildren = PR_TRUE;      }      else if (nsHTMLAtoms::form == aTag) {        rv = NS_NewFormFrame(newFrame);      }      else if (nsHTMLAtoms::frameset == aTag) {        rv = NS_NewHTMLFramesetFrame(newFrame);        isAbsolutelyPositioned = PR_FALSE;  // don't absolutely position      }      else if (nsHTMLAtoms::iframe == aTag) {        rv = NS_NewHTMLFrameOuterFrame(newFrame);      }      else if (nsHTMLAtoms::spacer == aTag) {        rv = NS_NewSpacerFrame(newFrame);        isAbsolutelyPositioned = PR_FALSE;  // don't absolutely position      }      else if (nsHTMLAtoms::button == aTag) {        rv = NS_NewHTMLButtonControlFrame(newFrame);        processChildren = PR_TRUE;      }      else if (nsHTMLAtoms::label == aTag) {        rv = NS_NewLabelFrame(newFrame);        processChildren = PR_TRUE;      }    }  }  // If we succeeded in creating a frame then initialize it, process its  // children (if requested), and set the initial child list  if (NS_SUCCEEDED(rv) && (nsnull != newFrame)) {    if (!frameHasBeenInitialized) {      nsIFrame* geometricParent = isAbsolutelyPositioned ? aAbsoluteItems.containingBlock :                                                           aParentFrame;      newFrame->Init(*aPresContext, aContent, geometricParent, aStyleContext);      // See if we need to create a view, e.g. the frame is absolutely positioned      nsHTMLContainerFrame::CreateViewForFrame(*aPresContext, newFrame,                                               aStyleContext, PR_FALSE);      // Process the child content if requested      nsFrameItems childItems;      if (processChildren) {        rv = ProcessChildren(aPresContext, aContent, newFrame, aAbsoluteItems,                             childItems);      }      // Set the frame's initial child list      newFrame->SetInitialChildList(*aPresContext, nsnull, childItems.childList);    }    // If the frame is absolutely positioned then create a placeholder frame    if (isAbsolutelyPositioned) {      nsIFrame* placeholderFrame;      CreatePlaceholderFrameFor(aPresContext, aContent, newFrame, aStyleContext,                                aParentFrame, placeholderFrame);      // Add the absolutely positioned frame to its containing block's list      // of child frames      aAbsoluteItems.AddChild(newFrame);      // Add the placeholder frame to the flow      aFrameItems.AddChild(placeholderFrame);    } else {      // Add the newly constructed frame to the flow      aFrameItems.AddChild(newFrame);    }  }  return rv;}