nsCOMPtr<nsIAtom> listName;
nsIAtom* listName = nsnull;
ReparentFrameViewTo(nsIPresContext* aPresContext,                    nsIFrame*       aFrame,                    nsIViewManager* aViewManager,                    nsIView*        aNewParentView,                    nsIView*        aOldParentView){  // XXX What to do about placeholder views for "position: fixed" elements?  // They should be reparented too.  // Does aFrame have a view?  if (aFrame->HasView()) {    nsIView* view = aFrame->GetView();    // Verify that the current parent view is what we think it is    //nsIView*  parentView;    //NS_ASSERTION(parentView == aOldParentView, "unexpected parent view");    aViewManager->RemoveChild(view);        // The view will remember the Z-order and other attributes that have been set on it.    nsIView* insertBefore = nsLayoutUtils::FindSiblingViewFor(aNewParentView, aFrame);    aViewManager->InsertChild(aNewParentView, view, insertBefore, insertBefore != nsnull);  } else {    PRInt32 listIndex = 0;    nsCOMPtr<nsIAtom> listName;    // This loop iterates through every child list name, and also    // executes once with listName == nsnull.    do {      aFrame->GetAdditionalChildListName(listIndex, getter_AddRefs(listName));      listIndex++;      // Iterate the child frames, and check each child frame to see if it has      // a view      nsIFrame* childFrame;      aFrame->FirstChild(aPresContext, listName, &childFrame);      for (; childFrame; childFrame = childFrame->GetNextSibling()) {        ReparentFrameViewTo(aPresContext, childFrame, aViewManager,                            aNewParentView, aOldParentView);      }    } while (listName);  }  return NS_OK;}