prevSibling->GetTag(getter_AddRefs(tag));
tag = prevSibling->Tag();
FrameManager::GetPrimaryFrameFor(nsIContent* aContent, nsIFrame** aResult){  NS_ASSERTION(aResult, "null out-param not supported");  *aResult = nsnull;  // initialize out param (before possibly returning due to null args/members)  NS_ENSURE_TRUE(mPresShell, NS_ERROR_NOT_AVAILABLE);  NS_ENSURE_ARG_POINTER(aContent);  if (mIsDestroyingFrames) {#ifdef DEBUG    printf("GetPrimaryFrameFor() called while FrameManager is being destroyed!\n");#endif    return NS_ERROR_FAILURE;  }  if (mPrimaryFrameMap.ops) {    PrimaryFrameMapEntry *entry = NS_STATIC_CAST(PrimaryFrameMapEntry*,        PL_DHashTableOperate(&mPrimaryFrameMap, aContent, PL_DHASH_LOOKUP));    if (PL_DHASH_ENTRY_IS_BUSY(entry)) {      *aResult = entry->frame;    } else {      // XXX: todo:  Add a lookup into the undisplay map to skip searches       //             if we already know the content has no frame.      //             nsCSSFrameConstructor calls SetUndisplayedContent() for every      //             content node that has display: none.      //             Today, the undisplay map doesn't quite support what we need.      //             We need to see if we can add a method to make a search for aContent       //             very fast in the embedded hash table.      //             This would almost completely remove the lookup penalty for things      //             like <SCRIPT> and comments in very large documents.      nsCOMPtr<nsIStyleSet>    styleSet;      nsCOMPtr<nsIPresContext> presContext;      // Give the frame construction code the opportunity to return the      // frame that maps the content object      mPresShell->GetStyleSet(getter_AddRefs(styleSet));      NS_ASSERTION(styleSet, "bad style set");      mPresShell->GetPresContext(getter_AddRefs(presContext));      NS_ASSERTION(presContext, "bad presContext");      if (!styleSet || !presContext) {        return NS_ERROR_NULL_POINTER;      }      // if the prev sibling of aContent has a cached primary frame,      // pass that data in to the style set to speed things up      // if any methods in here fail, don't report that failure      // we're just trying to enhance performance here, not test for correctness      nsFindFrameHint hint;      nsIContent* parent = aContent->GetParent();      if (parent)      {        PRInt32 index = parent->IndexOf(aContent);        if (index > 0)  // no use looking if it's the first child        {          nsIContent *prevSibling;          nsCOMPtr<nsIAtom> tag;          do {            prevSibling = parent->GetChildAt(--index);            prevSibling->GetTag(getter_AddRefs(tag));          } while (index &&                   (tag == nsLayoutAtoms::textTagName ||                    tag == nsLayoutAtoms::commentTagName ||                    tag == nsLayoutAtoms::processingInstructionTagName));          if (prevSibling) {            entry = NS_STATIC_CAST(PrimaryFrameMapEntry*,                PL_DHashTableOperate(&mPrimaryFrameMap, prevSibling,                                     PL_DHASH_LOOKUP));            if (PL_DHASH_ENTRY_IS_BUSY(entry))              hint.mPrimaryFrameForPrevSibling = entry->frame;          }        }      }      // walk the frame tree to find the frame that maps aContent.        // Use the hint if we have it.      styleSet->FindPrimaryFrameFor(presContext, this, aContent, aResult,                                     hint.mPrimaryFrameForPrevSibling ? &hint : nsnull);          }  }  return NS_OK;}