nsILookAndFeel* look = nsnull; if (NS_SUCCEEDED(aPresContext->GetLookAndFeel(&look)) && look) { nsILookAndFeel::nsColorID colorID = (nsILookAndFeel::nsColorID) intValue; if (NS_SUCCEEDED(look->GetColor(colorID, aResult))) { result = PR_TRUE; } NS_RELEASE(look);
nsILookAndFeel* look = aPresContext->LookAndFeel(); nsILookAndFeel::nsColorID colorID = (nsILookAndFeel::nsColorID) intValue; if (NS_SUCCEEDED(look->GetColor(colorID, aResult))) { result = PR_TRUE;
static PRBool SetColor(const nsCSSValue& aValue, const nscolor aParentColor,                        nsIPresContext* aPresContext, nscolor& aResult, PRBool& aInherited){  PRBool  result = PR_FALSE;  nsCSSUnit unit = aValue.GetUnit();  if (eCSSUnit_Color == unit) {    aResult = aValue.GetColorValue();    result = PR_TRUE;  }  else if (eCSSUnit_String == unit) {    nsAutoString  value;    aValue.GetStringValue(value);    nscolor rgba;    if (NS_ColorNameToRGB(value, &rgba)) {      aResult = rgba;      result = PR_TRUE;    }  }  else if (eCSSUnit_Integer == unit) {    PRInt32 intValue = aValue.GetIntValue();    if (0 <= intValue) {      nsILookAndFeel* look = nsnull;      if (NS_SUCCEEDED(aPresContext->GetLookAndFeel(&look)) && look) {        nsILookAndFeel::nsColorID colorID = (nsILookAndFeel::nsColorID) intValue;        if (NS_SUCCEEDED(look->GetColor(colorID, aResult))) {          result = PR_TRUE;        }        NS_RELEASE(look);      }    }    else {      switch (intValue) {        case NS_COLOR_MOZ_HYPERLINKTEXT:          if (NS_SUCCEEDED(aPresContext->GetDefaultLinkColor(&aResult))) {            result = PR_TRUE;          }          break;        case NS_COLOR_MOZ_VISITEDHYPERLINKTEXT:          if (NS_SUCCEEDED(aPresContext->GetDefaultVisitedLinkColor(&aResult))) {            result = PR_TRUE;          }          break;        case NS_COLOR_MOZ_ACTIVEHYPERLINKTEXT:          if (NS_SUCCEEDED(aPresContext->GetDefaultActiveLinkColor(&aResult))) {            result = PR_TRUE;          }          break;        default:          NS_NOTREACHED("Should never have an unknown negative colorID.");          break;      }    }  }  else if (eCSSUnit_Inherit == unit) {    aResult = aParentColor;    result = PR_TRUE;    aInherited = PR_TRUE;  }  return result;}