nsIFrame* nsFieldSetFrame::MaybeSetLegend(nsIFrame* aFrameList, nsIAtom* aListName) { if (!mLegendFrame && aFrameList->GetType() == nsLayoutAtoms::legendFrame) { NS_ASSERTION(!aListName, "Unexpected frame list when adding legend frame"); mLegendFrame = aFrameList; aFrameList = mLegendFrame->GetNextSibling(); mLegendFrame->SetNextSibling(mContentFrame); mFrames.SetFrames(mLegendFrame); AddStateBits(NS_FRAME_IS_DIRTY); if (GetParent()) { GetParent()->ReflowDirtyChild(mLegendFrame->GetPresContext()->GetPresShell(), this); } } return aFrameList; }