const nsHTMLValue*  value; nsresult  result = mAttributes ? mAttributes->GetAttribute(aAttribute, &value) : NS_CONTENT_ATTR_NOT_THERE;  char cbuf[20]; nscolor color; if (NS_CONTENT_ATTR_HAS_VALUE == result) { nsIHTMLContent* htmlContent; result = mContent->QueryInterface(kIHTMLContentIID, (void **)&htmlContent); if (NS_OK != result) { return result; }  if (NS_CONTENT_ATTR_HAS_VALUE == htmlContent->AttributeToString(aAttribute, *value, aResult)) { NS_RELEASE(htmlContent); return result; } NS_RELEASE(htmlContent);   switch (value->GetUnit()) { case eHTMLUnit_Null: case eHTMLUnit_Empty: aResult.Truncate(); break;  case eHTMLUnit_String: case eHTMLUnit_ColorName: value->GetStringValue(aResult); break;  case eHTMLUnit_Integer: aResult.Truncate(); aResult.AppendInt(value->GetIntValue(), 10); break;  case eHTMLUnit_Pixel: aResult.Truncate(); aResult.AppendInt(value->GetPixelValue(), 10); break;  case eHTMLUnit_Percent: aResult.Truncate(); aResult.AppendInt(PRInt32(value->GetPercentValue() * 100.0f), 10); aResult.AppendWithConversion('%'); break;  case eHTMLUnit_Color: color = nscolor(value->GetColorValue()); PR_snprintf(cbuf, sizeof(cbuf), "#%02x%02x%02x", NS_GET_R(color), NS_GET_G(color), NS_GET_B(color)); aResult.AssignWithConversion(cbuf); break;  default: case eHTMLUnit_Enumerated: NS_NOTREACHED("no default enumerated value to string conversion"); result = NS_CONTENT_ATTR_NOT_THERE; break; } }  return result; }
  nsresult    GetAttribute(const nsAReadableString& aName, nsAWritableString& aReturn)   {    return nsGenericElement::GetAttribute(aName, aReturn);  }