bug 821593 - don't use nsIDOMRGBColor xpcom methods in nsROCSSPrimitiveValue r=bz

This commit is contained in:
Trevor Saunders 2012-12-14 04:32:07 -05:00
parent 29dd196962
commit 04d46ec083

View File

@ -180,8 +180,8 @@ nsROCSSPrimitiveValue::GetCssText(nsAString& aCssText)
case CSS_RGBCOLOR : case CSS_RGBCOLOR :
{ {
NS_ASSERTION(mValue.mColor, "mValue.mColor should never be null"); NS_ASSERTION(mValue.mColor, "mValue.mColor should never be null");
ErrorResult error;
NS_NAMED_LITERAL_STRING(comma, ", "); NS_NAMED_LITERAL_STRING(comma, ", ");
nsCOMPtr<nsIDOMCSSPrimitiveValue> colorCSSValue;
nsAutoString colorValue; nsAutoString colorValue;
if (mValue.mColor->HasAlpha()) if (mValue.mColor->HasAlpha())
tmpStr.AssignLiteral("rgba("); tmpStr.AssignLiteral("rgba(");
@ -189,39 +189,27 @@ nsROCSSPrimitiveValue::GetCssText(nsAString& aCssText)
tmpStr.AssignLiteral("rgb("); tmpStr.AssignLiteral("rgb(");
// get the red component // get the red component
result = mValue.mColor->GetRed(getter_AddRefs(colorCSSValue)); mValue.mColor->Red()->GetCssText(colorValue, error);
if (NS_FAILED(result)) if (error.Failed())
break;
result = colorCSSValue->GetCssText(colorValue);
if (NS_FAILED(result))
break; break;
tmpStr.Append(colorValue + comma); tmpStr.Append(colorValue + comma);
// get the green component // get the green component
result = mValue.mColor->GetGreen(getter_AddRefs(colorCSSValue)); mValue.mColor->Green()->GetCssText(colorValue, error);
if (NS_FAILED(result)) if (error.Failed())
break;
result = colorCSSValue->GetCssText(colorValue);
if (NS_FAILED(result))
break; break;
tmpStr.Append(colorValue + comma); tmpStr.Append(colorValue + comma);
// get the blue component // get the blue component
result = mValue.mColor->GetBlue(getter_AddRefs(colorCSSValue)); mValue.mColor->Blue()->GetCssText(colorValue, error);
if (NS_FAILED(result)) if (error.Failed())
break;
result = colorCSSValue->GetCssText(colorValue);
if (NS_FAILED(result))
break; break;
tmpStr.Append(colorValue); tmpStr.Append(colorValue);
if (mValue.mColor->HasAlpha()) { if (mValue.mColor->HasAlpha()) {
// get the alpha component // get the alpha component
result = mValue.mColor->GetAlpha(getter_AddRefs(colorCSSValue)); mValue.mColor->Alpha()->GetCssText(colorValue, error);
if (NS_FAILED(result)) if (error.Failed())
break;
result = colorCSSValue->GetCssText(colorValue);
if (NS_FAILED(result))
break; break;
tmpStr.Append(comma + colorValue); tmpStr.Append(comma + colorValue);
} }