From ab65aaa658dcdce40f1d4323e752237f584d7939 Mon Sep 17 00:00:00 2001 From: "tor%cs.brown.edu" Date: Wed, 1 Dec 2004 16:23:12 +0000 Subject: [PATCH] Bug 272425 - fix nsSVGInnerSVGFrame transformation ordering. r=jwatt. git-svn-id: svn://10.0.0.236/trunk@166061 18797224-902f-48f8-a5cc-f745e15eee43 --- .../svg/base/src/nsSVGInnerSVGFrame.cpp | 25 ++++++++----------- 1 file changed, 11 insertions(+), 14 deletions(-) diff --git a/mozilla/layout/svg/base/src/nsSVGInnerSVGFrame.cpp b/mozilla/layout/svg/base/src/nsSVGInnerSVGFrame.cpp index db5b3074495..6845999518a 100644 --- a/mozilla/layout/svg/base/src/nsSVGInnerSVGFrame.cpp +++ b/mozilla/layout/svg/base/src/nsSVGInnerSVGFrame.cpp @@ -573,11 +573,10 @@ nsSVGInnerSVGFrame::GetOuterSVGFrame() already_AddRefed nsSVGInnerSVGFrame::GetCanvasTM() { - // parentTM * move(x,y) * viewboxToViewportTM - + // parentTM * Translate(x,y) * viewboxToViewportTM if (!mCanvasTM) { - // get our parent's tm and append local transforms (if any): + // get the transform from our parent's coordinate system to ours: NS_ASSERTION(mParent, "null parent"); nsISVGContainerFrame *containerFrame; mParent->QueryInterface(NS_GET_IID(nsISVGContainerFrame), (void**)&containerFrame); @@ -588,21 +587,19 @@ nsSVGInnerSVGFrame::GetCanvasTM() nsCOMPtr parentTM = containerFrame->GetCanvasTM(); NS_ASSERTION(parentTM, "null TM"); - // viewbox to viewport: + // append the transform due to the 'x' and 'y' attributes: + float x, y; + mX->GetValue(&x); + mY->GetValue(&y); + nsCOMPtr xyTM; + parentTM->Translate(x, y, getter_AddRefs(xyTM)); + + // append the viewbox to viewport transform: nsCOMPtr viewBoxToViewportTM; nsCOMPtr svgElement = do_QueryInterface(mContent); NS_ASSERTION(svgElement, "wrong content element"); svgElement->GetViewboxToViewportTransform(getter_AddRefs(viewBoxToViewportTM)); - - parentTM->Multiply(viewBoxToViewportTM, getter_AddRefs(mCanvasTM)); - - // x and y: - float x, y; - mX->GetValue(&x); - mY->GetValue(&y); - nsCOMPtr fini; - mCanvasTM->Translate(x, y, getter_AddRefs(fini)); - mCanvasTM = fini; + xyTM->Multiply(viewBoxToViewportTM, getter_AddRefs(mCanvasTM)); } nsIDOMSVGMatrix* retval = mCanvasTM.get();