diff --git a/layout/svg/base/src/nsSVGForeignObjectFrame.cpp b/layout/svg/base/src/nsSVGForeignObjectFrame.cpp index ef60e241ea9..c305d763c9a 100644 --- a/layout/svg/base/src/nsSVGForeignObjectFrame.cpp +++ b/layout/svg/base/src/nsSVGForeignObjectFrame.cpp @@ -224,8 +224,11 @@ nsSVGForeignObjectFrame::PaintSVG(nsSVGRenderState *aContext, nsCOMPtr tm = GetTMIncludingOffset(); + cairo_matrix_t matrix = nsSVGUtils::ConvertSVGMatrixToCairo(tm); + nsIRenderingContext *ctx = aContext->GetRenderingContext(); - if (!ctx) { + + if (!ctx || nsSVGUtils::IsSingular(&matrix)) { NS_WARNING("Can't render foreignObject element!"); return NS_ERROR_FAILURE; } @@ -233,7 +236,7 @@ nsSVGForeignObjectFrame::PaintSVG(nsSVGRenderState *aContext, gfxContext *gfx = aContext->GetGfxContext(); gfx->Save(); - gfx->Multiply(gfxMatrix(nsSVGUtils::ConvertSVGMatrixToCairo(tm))); + gfx->Multiply(gfxMatrix(matrix)); nsresult rv = nsLayoutUtils::PaintFrame(ctx, kid, nsRegion(kid->GetRect()), NS_RGBA(0,0,0,0));