if (child.get() == aChild)
if (child == aChild)
FindNextAnonymousSibling(nsIPresShell* aPresShell,                         nsIDocument*  aDocument,                         nsIContent*   aContainer,                         nsIContent*   aChild){  NS_PRECONDITION(aDocument, "null document from content element in FindNextAnonymousSibling");  nsCOMPtr<nsIDOMDocumentXBL> xblDoc(do_QueryInterface(aDocument));  NS_ASSERTION(xblDoc, "null xblDoc for content element in FindNextAnonymousSibling");  if (! xblDoc)    return nsnull;  // Grovel through the anonymous elements looking for aChild  nsCOMPtr<nsIDOMNodeList> nodeList;  nsCOMPtr<nsIDOMElement> elt(do_QueryInterface(aContainer));  xblDoc->GetAnonymousNodes(elt, getter_AddRefs(nodeList));  if (! nodeList)    return nsnull;  PRUint32 length;  nodeList->GetLength(&length);  PRInt32 index;  for (index = 0; index < PRInt32(length); ++index) {    nsCOMPtr<nsIDOMNode> node;    nodeList->Item(PRUint32(index), getter_AddRefs(node));    nsCOMPtr<nsIContent> child = do_QueryInterface(node);    if (child.get() == aChild)      break;  }  // We want the node immediately after aChild. Keep going until we  // run off the end of the nodeList, or we find a next sibling.  while (++index < PRInt32(length)) {    nsCOMPtr<nsIDOMNode> node;    nodeList->Item(PRUint32(index), getter_AddRefs(node));    nsCOMPtr<nsIContent> child = do_QueryInterface(node);    // Get its frame    nsIFrame* nextSibling;    aPresShell->GetPrimaryFrameFor(child, &nextSibling);    if (nextSibling) {#ifdef DEBUG      // The primary frame should never be a continuation      nsIFrame* prevInFlow;      nextSibling->GetPrevInFlow(&prevInFlow);      NS_ASSERTION(!prevInFlow, "primary frame is a continuation!?");#endif      // If the frame is out-of-flow, GPFF() will have returned the      // out-of-flow frame; we want the placeholder.      const nsStyleDisplay* display = nextSibling->GetStyleDisplay();      if (display->IsFloating() || display->IsAbsolutelyPositioned()) {        nsIFrame* placeholderFrame;        aPresShell->GetPlaceholderFrameFor(nextSibling, &placeholderFrame);        NS_ASSERTION(placeholderFrame, "no placeholder for out-of-flow frame");        nextSibling = placeholderFrame;      }      // Found a next sibling, we're done!      return nextSibling;    }  }  return nsnull;}