NS_IMETHODIMP DefaultTooltipTextProvider::GetNodeText(nsIDOMNode *aNode, PRUnichar **aText, PRBool *_retval)
DefaultTooltipTextProvider::GetNodeText(nsIDOMNode *aNode, PRUnichar **aText, PRBool *_retval)
NS_IMETHODIMP DefaultTooltipTextProvider::GetNodeText(nsIDOMNode *aNode, PRUnichar **aText, PRBool *_retval){  NS_ENSURE_ARG_POINTER(aNode);  NS_ENSURE_ARG_POINTER(aText);      nsString outText;  PRBool found = PR_FALSE;  nsCOMPtr<nsIDOMNode> current ( aNode );  while ( !found && current ) {    nsCOMPtr<nsIDOMElement> currElement ( do_QueryInterface(current) );    if ( currElement ) {      nsCOMPtr<nsIContent> content(do_QueryInterface(currElement));      if (content) {        nsCOMPtr<nsIAtom> tagAtom;        content->GetTag(getter_AddRefs(tagAtom));        if (tagAtom != mTag_dialog &&            tagAtom != mTag_dialogheader &&            tagAtom != mTag_window) {          // first try the normal title attribute...          currElement->GetAttribute(NS_LITERAL_STRING("title"), outText);          if ( outText.Length() )            found = PR_TRUE;          else {            // ...ok, that didn't work, try it in the XLink namespace            currElement->GetAttributeNS(NS_LITERAL_STRING("http://www.w3.org/1999/xlink"), NS_LITERAL_STRING("title"), outText);            if ( outText.Length() )              found = PR_TRUE;          }        }      }    }        // not found here, walk up to the parent and keep trying    if ( !found ) {      nsCOMPtr<nsIDOMNode> temp ( current );      temp->GetParentNode(getter_AddRefs(current));    }  } // while not found  *_retval = found;  *aText = (found) ? ToNewUnicode(outText) : nsnull;  return NS_OK;}