nsHTMLMappedAttributes::SetAttribute(nsIAtom* aAttrName, const nsAReadableString& aValue)
nsHTMLMappedAttributes::SetAttribute(nsIAtom* aAttrName, const nsHTMLValue& aValue)
nsHTMLMappedAttributes::SetAttribute(nsIAtom* aAttrName, const nsAReadableString& aValue){  if (! aAttrName) {    return NS_ERROR_NULL_POINTER;  }  if (mFirst.mAttribute) {  // do we already have any?    HTMLAttribute* attr = HTMLAttribute::FindHTMLAttribute(aAttrName, &mFirst);    if (attr) {      attr->mValue.SetStringValue(aValue);    }    else {      // add new attribute      // keep these arbitrarily sorted so they'll equal regardless of set order      if (aAttrName < mFirst.mAttribute) {  // before first, move first down one        attr = new HTMLAttribute(mFirst);        if (attr) {          attr->mNext = mFirst.mNext;          mFirst.mNext = attr;          mFirst.Set(aAttrName, aValue);        }        else {          return NS_ERROR_OUT_OF_MEMORY;        }      }      else {        attr = new HTMLAttribute(aAttrName, aValue);        if (attr) {          HTMLAttribute* prev = &mFirst;          while (prev->mNext && (prev->mNext->mAttribute < aAttrName)) {            prev = prev->mNext;          }          attr->mNext = prev->mNext;          prev->mNext = attr;        }        else {          return NS_ERROR_OUT_OF_MEMORY;        }      }      mAttrCount++;    }  }  else {    mFirst.Set(aAttrName, aValue);    mAttrCount++;  }  return NS_OK;}