((type.CompareWithConversion("text", PR_TRUE) == 0) || type.IsEmpty())) {
(type.IsEmpty() || (Compare(type, NS_LITERAL_STRING("text"), nsCaseInsensitiveStringComparator()) == 0))) {
wallet_StepForwardOrBack    (nsIDOMNode*& elementNode, nsString& text, PRBool& atInputOrSelect, PRBool& atEnd, PRBool goForward) {  nsresult result;  atInputOrSelect = PR_FALSE;  atEnd = PR_FALSE; /* try getting next/previous sibling */  nsCOMPtr<nsIDOMNode> sibling;  if (goForward) {    result = elementNode->GetNextSibling(getter_AddRefs(sibling));  } else {    result = elementNode->GetPreviousSibling(getter_AddRefs(sibling));  }  if ((NS_FAILED(result)) || !sibling) {    /* no next/previous siblings, try getting parent */    nsCOMPtr<nsIDOMNode> parent;    result = elementNode->GetParentNode(getter_AddRefs(parent));    if ((NS_FAILED(result)) || !parent) {      /* no parent, we've reached the top of the tree */      atEnd = PR_TRUE;    } else {      /* parent obtained */      elementNode = parent;    }    return;  }  /* sibling obtained */  elementNode = sibling;  while (PR_TRUE) {    /* if we've reached a SELECT or non-hidden INPUT tag, we're done */    /*     *    There is a subtle difference here between going forward and going backwards.     *     *    When going forward we are trying to find out how many consecutive <input> elements are not separated     *    by displayed text.  That is important for determing, for example, if we have a three-input phone-number     *    field.  In that case, we want to consider only input tags have type="text" or no type ("text" by default).     *     *    When going backwards we want to find the text between the current <input> element and any preceding     *    visible <input> element.  That would include such things as type="button", type="submit" etc.  The     *    only thing it would exclude is type="hidden".     */    nsCOMPtr<nsIDOMHTMLInputElement> inputElement(do_QueryInterface(elementNode, &result));    if ((NS_SUCCEEDED(result)) && (inputElement)) {      nsAutoString type;      result = inputElement->GetType(type);      if (goForward) {        if (NS_SUCCEEDED(result) &&              ((type.CompareWithConversion("text", PR_TRUE) == 0) ||               type.IsEmpty())) {          /* at <input> element and it's type is either "text" or is missing ("text" by default) */          atInputOrSelect = PR_TRUE;          return;        }      } else {        if (NS_SUCCEEDED(result) && (type.CompareWithConversion("hidden", PR_TRUE) != 0)) {          /* at <input> element and it's type is not "hidden" */          atInputOrSelect = PR_TRUE;          return;        }      }    } else {      nsCOMPtr<nsIDOMHTMLSelectElement> selectElement(do_QueryInterface(elementNode));      if (selectElement) {        atInputOrSelect = PR_TRUE;        return;      }    }    /* if we've reached a #text node, append it to accumulated text */    nsAutoString siblingName;    result = elementNode->GetNodeName(siblingName);    nsCAutoString siblingCName; siblingCName.AssignWithConversion(siblingName);//    if (siblingName.EqualsIgnoreCase(NS_LITERAL_STRING("#text")) {    if (siblingCName.EqualsIgnoreCase("#text")) {      nsAutoString siblingValue;      result = elementNode->GetNodeValue(siblingValue);      text.Append(siblingValue);          }    /* if we've reached a SCRIPT node, don't fetch its siblings *///    if (siblingName.EqualsIgnoreCase(NS_LITERAL_STRING("SCRIPT")) {    if (siblingCName.EqualsIgnoreCase("SCRIPT")) {      return;    }    /* try getting first/last child */    nsCOMPtr<nsIDOMNode> child;    if (goForward) {      result = elementNode->GetFirstChild(getter_AddRefs(child));    } else {      result = elementNode->GetLastChild(getter_AddRefs(child));    }    if ((NS_FAILED(result)) || !child) {      /* no children, we're done with this node */      return;    }    /* child obtained */    elementNode = child;  }  return;}