diff --git a/content/svg/content/src/SVGRect.cpp b/content/svg/content/src/SVGRect.cpp index 934b8e524831..3dd62db2db3c 100644 --- a/content/svg/content/src/SVGRect.cpp +++ b/content/svg/content/src/SVGRect.cpp @@ -38,21 +38,19 @@ NS_INTERFACE_MAP_END //////////////////////////////////////////////////////////////////////// // Exported creation functions: -nsresult -NS_NewSVGRect(mozilla::dom::SVGRect** result, float x, float y, - float width, float height) +already_AddRefed +NS_NewSVGRect(float x, float y, float width, float height) { - *result = new mozilla::dom::SVGRect(x, y, width, height); - if (!*result) return NS_ERROR_OUT_OF_MEMORY; - NS_ADDREF(*result); - return NS_OK; + nsRefPtr rect = + new mozilla::dom::SVGRect(x, y, width, height); + + return rect.forget(); } -nsresult -NS_NewSVGRect(mozilla::dom::SVGRect** result, const gfxRect& rect) +already_AddRefed +NS_NewSVGRect(const gfxRect& rect) { - return NS_NewSVGRect(result, - rect.X(), rect.Y(), + return NS_NewSVGRect(rect.X(), rect.Y(), rect.Width(), rect.Height()); } diff --git a/content/svg/content/src/SVGRect.h b/content/svg/content/src/SVGRect.h index 9ffd93dd80c6..186bf3d88237 100644 --- a/content/svg/content/src/SVGRect.h +++ b/content/svg/content/src/SVGRect.h @@ -76,12 +76,10 @@ protected: } // namespace dom } // namespace mozilla -nsresult -NS_NewSVGRect(mozilla::dom::SVGRect** result, - float x=0.0f, float y=0.0f, - float width=0.0f, float height=0.0f); +already_AddRefed +NS_NewSVGRect(float x=0.0f, float y=0.0f, float width=0.0f, float height=0.0f); -nsresult -NS_NewSVGRect(mozilla::dom::SVGRect** result, const gfxRect& rect); +already_AddRefed +NS_NewSVGRect(const gfxRect& rect); #endif //mozilla_dom_SVGRect_h diff --git a/content/svg/content/src/SVGSVGElement.cpp b/content/svg/content/src/SVGSVGElement.cpp index 55ce926e6583..f01b97315733 100644 --- a/content/svg/content/src/SVGSVGElement.cpp +++ b/content/svg/content/src/SVGSVGElement.cpp @@ -411,9 +411,7 @@ SVGSVGElement::CreateSVGMatrix() already_AddRefed SVGSVGElement::CreateSVGRect() { - nsRefPtr rect; - NS_NewSVGRect(getter_AddRefs(rect)); - return rect.forget(); + return NS_NewSVGRect(); } already_AddRefed diff --git a/content/svg/content/src/SVGTransformableElement.cpp b/content/svg/content/src/SVGTransformableElement.cpp index 5c04fa081938..03ee7dedbab1 100644 --- a/content/svg/content/src/SVGTransformableElement.cpp +++ b/content/svg/content/src/SVGTransformableElement.cpp @@ -173,9 +173,7 @@ SVGTransformableElement::GetBBox(ErrorResult& rv) return nullptr; } - nsRefPtr rect; - rv = NS_NewSVGRect(getter_AddRefs(rect), nsSVGUtils::GetBBox(frame)); - return rect.forget(); + return NS_NewSVGRect(nsSVGUtils::GetBBox(frame)); } already_AddRefed diff --git a/layout/svg/nsSVGGlyphFrame.cpp b/layout/svg/nsSVGGlyphFrame.cpp index 3bdf9d50a883..06011f9d4682 100644 --- a/layout/svg/nsSVGGlyphFrame.cpp +++ b/layout/svg/nsSVGGlyphFrame.cpp @@ -1285,9 +1285,7 @@ nsSVGGlyphFrame::GetExtentOfChar(uint32_t charnum, dom::SVGIRect **_retval) metrics.mAscent + metrics.mDescent)); tmpCtx->IdentityMatrix(); - nsRefPtr rect; - nsresult rv = NS_NewSVGRect(getter_AddRefs(rect), tmpCtx->GetUserPathExtent()); - NS_ENSURE_SUCCESS(rv, rv); + nsRefPtr rect = NS_NewSVGRect(tmpCtx->GetUserPathExtent()); rect.forget(_retval); return NS_OK;