Bug 585867 part 4. Make SetValueToStyleImage return void. r=bzbarsky

This commit is contained in:
Craig Topper 2011-03-04 12:28:57 -05:00
parent 04c3f87d46
commit aab3b367c9
2 changed files with 15 additions and 25 deletions

View File

@ -1372,7 +1372,7 @@ AppendCSSGradientLength(const nsStyleCoord& aValue,
aString.Append(tokenString);
}
nsresult
void
nsComputedDOMStyle::GetCSSGradientString(const nsStyleGradient* aGradient,
nsAString& aString)
{
@ -1456,11 +1456,10 @@ nsComputedDOMStyle::GetCSSGradientString(const nsStyleGradient* aGradient,
delete tmpVal;
aString.AppendLiteral(")");
return NS_OK;
}
// -moz-image-rect(<uri>, <top>, <right>, <bottom>, <left>)
nsresult
void
nsComputedDOMStyle::GetImageRectString(nsIURI* aURI,
const nsStyleSides& aCropRect,
nsString& aString)
@ -1486,10 +1485,9 @@ nsComputedDOMStyle::GetImageRectString(nsIURI* aURI,
aString = NS_LITERAL_STRING("-moz-image-rect(") +
argumentString +
NS_LITERAL_STRING(")");
return NS_OK;
}
nsresult
void
nsComputedDOMStyle::SetValueToStyleImage(const nsStyleImage& aStyleImage,
nsROCSSPrimitiveValue* aValue)
{
@ -1503,8 +1501,7 @@ nsComputedDOMStyle::SetValueToStyleImage(const nsStyleImage& aStyleImage,
const nsStyleSides* cropRect = aStyleImage.GetCropRect();
if (cropRect) {
nsAutoString imageRectString;
nsresult rv = GetImageRectString(uri, *cropRect, imageRectString);
NS_ENSURE_SUCCESS(rv, rv);
GetImageRectString(uri, *cropRect, imageRectString);
aValue->SetString(imageRectString);
} else {
aValue->SetURI(uri);
@ -1514,9 +1511,8 @@ nsComputedDOMStyle::SetValueToStyleImage(const nsStyleImage& aStyleImage,
case eStyleImageType_Gradient:
{
nsAutoString gradientString;
nsresult rv = GetCSSGradientString(aStyleImage.GetGradientData(),
gradientString);
NS_ENSURE_SUCCESS(rv, rv);
GetCSSGradientString(aStyleImage.GetGradientData(),
gradientString);
aValue->SetString(gradientString);
break;
}
@ -1536,10 +1532,8 @@ nsComputedDOMStyle::SetValueToStyleImage(const nsStyleImage& aStyleImage,
break;
default:
NS_NOTREACHED("unexpected image type");
return NS_ERROR_UNEXPECTED;
break;
}
return NS_OK;
}
nsresult
@ -1554,11 +1548,7 @@ nsComputedDOMStyle::DoGetBackgroundImage(nsIDOMCSSValue** aValue)
valueList->AppendCSSValue(val);
const nsStyleImage& image = bg->mLayers[i].mImage;
nsresult rv = SetValueToStyleImage(image, val);
if (NS_FAILED(rv)) {
delete valueList;
return rv;
}
SetValueToStyleImage(image, val);
}
NS_ADDREF(*aValue = valueList);

View File

@ -162,11 +162,11 @@ private:
const PRInt32 aTable[],
nsIDOMCSSValue** aResult);
nsresult GetCSSGradientString(const nsStyleGradient* aGradient,
nsAString& aString);
nsresult GetImageRectString(nsIURI* aURI,
const nsStyleSides& aCropRect,
nsString& aString);
void GetCSSGradientString(const nsStyleGradient* aGradient,
nsAString& aString);
void GetImageRectString(nsIURI* aURI,
const nsStyleSides& aCropRect,
nsString& aString);
/* Properties queryable as CSSValues.
* To avoid a name conflict with nsIDOM*CSS2Properties, these are all
@ -404,8 +404,8 @@ private:
nsROCSSPrimitiveValue* GetROCSSPrimitiveValue();
nsDOMCSSValueList* GetROCSSValueList(PRBool aCommaDelimited);
void SetToRGBAColor(nsROCSSPrimitiveValue* aValue, nscolor aColor);
nsresult SetValueToStyleImage(const nsStyleImage& aStyleImage,
nsROCSSPrimitiveValue* aValue);
void SetValueToStyleImage(const nsStyleImage& aStyleImage,
nsROCSSPrimitiveValue* aValue);
/**
* A method to get a percentage base for a percentage value. Returns PR_TRUE