if (border) { nscolor color; PRBool transparent; PRBool foreground; border->GetBorderColor(aSide, color, transparent, foreground); if (transparent) { val->SetIdent(nsLayoutAtoms::transparent); } else { if (foreground) { const nsStyleColor* colorStruct = nsnull; GetStyleData(eStyleStruct_Color, (const nsStyleStruct*&)colorStruct, aFrame); color = colorStruct->mColor; }  nsDOMCSSRGBColor *rgb = GetDOMCSSRGBColor(color); if (!rgb) { delete val;  return NS_ERROR_OUT_OF_MEMORY; }  val->SetColor(rgb); }
if(border) { nscolor color; border->GetBorderColor(aSide, color); nsAutoString hex; ColorToHex(color, hex); val->SetString(hex); } else { val->SetString("");
nsComputedDOMStyle::GetBorderColorFor(PRUint8 aSide, nsIFrame *aFrame,                                      nsIDOMCSSValue** aValue){  nsROCSSPrimitiveValue* val = GetROCSSPrimitiveValue();  NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);  const nsStyleBorder* border = nsnull;  GetStyleData(eStyleStruct_Border, (const nsStyleStruct*&)border, aFrame);  if (border) {    nscolor color;     PRBool transparent;    PRBool foreground;    border->GetBorderColor(aSide, color, transparent, foreground);    if (transparent) {      val->SetIdent(nsLayoutAtoms::transparent);    } else {      if (foreground) {        const nsStyleColor* colorStruct = nsnull;        GetStyleData(eStyleStruct_Color, (const nsStyleStruct*&)colorStruct,                     aFrame);        color = colorStruct->mColor;      }      nsDOMCSSRGBColor *rgb = GetDOMCSSRGBColor(color);      if (!rgb) {        delete val;        return NS_ERROR_OUT_OF_MEMORY;      }      val->SetColor(rgb);    }  }  return CallQueryInterface(val, aValue);}