From b615fcb60d82f47ba5328a74a0d8a2a56f8d173f Mon Sep 17 00:00:00 2001 From: "jwatt%jwatt.org" Date: Thu, 20 Dec 2007 09:13:38 +0000 Subject: [PATCH] Re-checkin fix for bug 407959 (this time without the reftest that I suspect caused other tests to fail (a modified test will follow)). Embedded SVG object disappears when zooming or in Print Preview. r=tor@acm.org, sr=roc@ocallahan.org git-svn-id: svn://10.0.0.236/trunk@241833 18797224-902f-48f8-a5cc-f745e15eee43 --- .../layout/svg/base/src/nsSVGOuterSVGFrame.cpp | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/mozilla/layout/svg/base/src/nsSVGOuterSVGFrame.cpp b/mozilla/layout/svg/base/src/nsSVGOuterSVGFrame.cpp index 03c11bc1d28..38fb931f93f 100644 --- a/mozilla/layout/svg/base/src/nsSVGOuterSVGFrame.cpp +++ b/mozilla/layout/svg/base/src/nsSVGOuterSVGFrame.cpp @@ -54,6 +54,7 @@ #include "nsPIDOMWindow.h" #include "nsIObjectLoadingContent.h" #include "nsIInterfaceRequestorUtils.h" +#include "nsSVGMatrix.h" #if defined(DEBUG) && defined(SVG_DEBUG_PRINTING) #include "nsIDeviceContext.h" @@ -713,15 +714,21 @@ already_AddRefed nsSVGOuterSVGFrame::GetCanvasTM() { if (!mCanvasTM) { - nsCOMPtr vb2vp; nsSVGSVGElement *svgElement = static_cast(mContent); - svgElement->GetViewboxToViewportTransform(getter_AddRefs(vb2vp)); - // Scale the transform from CSS pixel space to device pixel space float devPxPerCSSPx = 1 / PresContext()->AppUnitsToFloatCSSPixels( PresContext()->AppUnitsPerDevPixel()); - vb2vp->Scale(devPxPerCSSPx, getter_AddRefs(mCanvasTM)); + nsCOMPtr devPxToCSSPxMatrix; + NS_NewSVGMatrix(getter_AddRefs(devPxToCSSPxMatrix), + devPxPerCSSPx, 0.0f, + 0.0f, devPxPerCSSPx); + + nsCOMPtr viewBoxMatrix; + svgElement->GetViewboxToViewportTransform(getter_AddRefs(viewBoxMatrix)); + + // PRE-multiply px conversion! + devPxToCSSPxMatrix->Multiply(viewBoxMatrix, getter_AddRefs(mCanvasTM)); // our content is the document element so we must premultiply the values // of its currentScale and currentTranslate properties