if (child.get() == aChild)
if (child == aChild)
FindPreviousAnonymousSibling(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. We'll  // start our search for a previous frame there.  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 = PRInt32(length) - 1; index >= 0; --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 before aChild. Keep going until we  // run off the beginning of the nodeList, or we find a frame.  while (--index >= 0) {    nsCOMPtr<nsIDOMNode> node;    nodeList->Item(PRUint32(index), getter_AddRefs(node));    nsCOMPtr<nsIContent> child = do_QueryInterface(node);    // Get its frame. If it doesn't have one, continue on to the    // anonymous element that preceded it.    nsIFrame* prevSibling;    aPresShell->GetPrimaryFrameFor(child, &prevSibling);    if (prevSibling) {      // The frame may be a special frame (a split inline frame that      // contains a block).  Get the last part of that split.      if (IsFrameSpecial(prevSibling)) {        nsCOMPtr<nsIFrameManager> fm;        aPresShell->GetFrameManager(getter_AddRefs(fm));        prevSibling = GetLastSpecialSibling(fm, prevSibling);      }      // The frame may have a continuation. If so, we want the      // last-in-flow as our previous sibling.      prevSibling = prevSibling->GetLastInFlow();      // If the frame is out-of-flow, GPFF() will have returned the      // out-of-flow frame; we want the placeholder.      const nsStyleDisplay* display = prevSibling->GetStyleDisplay();      if (display->IsFloating() || display->IsAbsolutelyPositioned()) {        nsIFrame* placeholderFrame;        aPresShell->GetPlaceholderFrameFor(prevSibling, &placeholderFrame);        NS_ASSERTION(placeholderFrame, "no placeholder for out-of-flow frame");        prevSibling = placeholderFrame;      }      // Found a previous sibling, we're done!      return prevSibling;    }  }  return nsnull;}