diff --git a/content/svg/content/src/SVGContentUtils.cpp b/content/svg/content/src/SVGContentUtils.cpp index 7e93ac0e5912..18f89fd2e52b 100644 --- a/content/svg/content/src/SVGContentUtils.cpp +++ b/content/svg/content/src/SVGContentUtils.cpp @@ -18,7 +18,6 @@ #include "SVGAnimationElement.h" #include "SVGAnimatedPreserveAspectRatio.h" #include "nsContentUtils.h" -#include "gfx2DGlue.h" #include "mozilla/gfx/2D.h" using namespace mozilla; @@ -181,7 +180,7 @@ SVGContentUtils::GetNearestViewportElement(nsIContent *aContent) static gfxMatrix GetCTMInternal(nsSVGElement *aElement, bool aScreenCTM, bool aHaveRecursed) { - gfx::Matrix matrix = aElement->PrependLocalTransformsTo(gfx::Matrix(), + gfxMatrix matrix = aElement->PrependLocalTransformsTo(gfxMatrix(), aHaveRecursed ? nsSVGElement::eAllTransforms : nsSVGElement::eUserSpaceToParent); nsSVGElement *element = aElement; nsIContent *ancestor = aElement->GetFlattenedTreeParent(); @@ -189,7 +188,7 @@ GetCTMInternal(nsSVGElement *aElement, bool aScreenCTM, bool aHaveRecursed) while (ancestor && ancestor->IsSVG() && ancestor->Tag() != nsGkAtoms::foreignObject) { element = static_cast(ancestor); - matrix *= element->PrependLocalTransformsTo(gfx::Matrix()); // i.e. *A*ppend + matrix *= element->PrependLocalTransformsTo(gfxMatrix()); // i.e. *A*ppend if (!aScreenCTM && SVGContentUtils::EstablishesViewport(element)) { if (!element->NodeInfo()->Equals(nsGkAtoms::svg, kNameSpaceID_SVG) && !element->NodeInfo()->Equals(nsGkAtoms::symbol, kNameSpaceID_SVG)) { @@ -197,7 +196,7 @@ GetCTMInternal(nsSVGElement *aElement, bool aScreenCTM, bool aHaveRecursed) return gfxMatrix(0.0, 0.0, 0.0, 0.0, 0.0, 0.0); // singular } // XXX spec seems to say x,y translation should be undone for IsInnerSVG - return ThebesMatrix(matrix); + return matrix; } ancestor = ancestor->GetFlattenedTreeParent(); } @@ -216,14 +215,14 @@ GetCTMInternal(nsSVGElement *aElement, bool aScreenCTM, bool aHaveRecursed) // transforms in this case since that's what we've been doing for // a while, and it keeps us consistent with WebKit and Opera (if not // really with the ambiguous spec). - matrix = aElement->PrependLocalTransformsTo(gfx::Matrix()); + matrix = aElement->PrependLocalTransformsTo(gfxMatrix()); } if (!ancestor || !ancestor->IsElement()) { - return ThebesMatrix(matrix); + return matrix; } if (ancestor->IsSVG()) { return - ThebesMatrix(matrix) * GetCTMInternal(static_cast(ancestor), true, true); + matrix * GetCTMInternal(static_cast(ancestor), true, true); } // XXX this does not take into account CSS transform, or that the non-SVG @@ -242,7 +241,7 @@ GetCTMInternal(nsSVGElement *aElement, bool aScreenCTM, bool aHaveRecursed) } } } - return ThebesMatrix(matrix * gfx::Matrix().Translate(x, y)); + return matrix * gfxMatrix().Translate(gfxPoint(x, y)); } gfxMatrix diff --git a/content/svg/content/src/SVGForeignObjectElement.cpp b/content/svg/content/src/SVGForeignObjectElement.cpp index dc946095845b..8d239a4c5076 100644 --- a/content/svg/content/src/SVGForeignObjectElement.cpp +++ b/content/svg/content/src/SVGForeignObjectElement.cpp @@ -70,15 +70,15 @@ SVGForeignObjectElement::Height() //---------------------------------------------------------------------- // nsSVGElement methods -/* virtual */ gfx::Matrix -SVGForeignObjectElement::PrependLocalTransformsTo(const gfx::Matrix &aMatrix, +/* virtual */ gfxMatrix +SVGForeignObjectElement::PrependLocalTransformsTo(const gfxMatrix &aMatrix, TransformTypes aWhich) const { NS_ABORT_IF_FALSE(aWhich != eChildToUserSpace || aMatrix.IsIdentity(), "Skipping eUserSpaceToParent transforms makes no sense"); // 'transform' attribute: - gfx::Matrix fromUserSpace = + gfxMatrix fromUserSpace = SVGGraphicsElement::PrependLocalTransformsTo(aMatrix, aWhich); if (aWhich == eUserSpaceToParent) { return fromUserSpace; @@ -87,7 +87,7 @@ SVGForeignObjectElement::PrependLocalTransformsTo(const gfx::Matrix &aMatrix, float x, y; const_cast(this)-> GetAnimatedLengthValues(&x, &y, nullptr); - gfx::Matrix toUserSpace = gfx::Matrix().Translate(x, y); + gfxMatrix toUserSpace = gfxMatrix().Translate(gfxPoint(x, y)); if (aWhich == eChildToUserSpace) { return toUserSpace; } diff --git a/content/svg/content/src/SVGForeignObjectElement.h b/content/svg/content/src/SVGForeignObjectElement.h index b55af6bf907a..f153a43924db 100644 --- a/content/svg/content/src/SVGForeignObjectElement.h +++ b/content/svg/content/src/SVGForeignObjectElement.h @@ -30,7 +30,7 @@ protected: public: // nsSVGElement specializations: - virtual gfx::Matrix PrependLocalTransformsTo(const gfx::Matrix &aMatrix, + virtual gfxMatrix PrependLocalTransformsTo(const gfxMatrix &aMatrix, TransformTypes aWhich = eAllTransforms) const MOZ_OVERRIDE; virtual bool HasValidDimensions() const MOZ_OVERRIDE; diff --git a/content/svg/content/src/SVGMotionSMILAttr.cpp b/content/svg/content/src/SVGMotionSMILAttr.cpp index c784bf95ec0e..4218d1866816 100644 --- a/content/svg/content/src/SVGMotionSMILAttr.cpp +++ b/content/svg/content/src/SVGMotionSMILAttr.cpp @@ -11,7 +11,6 @@ #include "nsSMILValue.h" #include "nsDebug.h" #include "nsSVGElement.h" -#include "gfx2DGlue.h" namespace mozilla { @@ -41,7 +40,7 @@ SVGMotionSMILAttr::ClearAnimValue() nsresult SVGMotionSMILAttr::SetAnimValue(const nsSMILValue& aValue) { - gfx::Matrix matrix = gfx::ToMatrix(SVGMotionSMILType::CreateMatrix(aValue)); + gfxMatrix matrix = SVGMotionSMILType::CreateMatrix(aValue); mSVGElement->SetAnimateMotionTransform(&matrix); return NS_OK; } diff --git a/content/svg/content/src/SVGPathElement.cpp b/content/svg/content/src/SVGPathElement.cpp index 4e8da445f6ea..94de867abeab 100644 --- a/content/svg/content/src/SVGPathElement.cpp +++ b/content/svg/content/src/SVGPathElement.cpp @@ -348,9 +348,10 @@ SVGPathElement::GetPathLengthScale(PathLengthScaleForType aFor) // For textPath, a transform on the referenced path affects the // textPath layout, so when calculating the actual path length // we need to take that into account. - gfx::Matrix matrix = PrependLocalTransformsTo(gfx::Matrix()); + gfxMatrix matrix = PrependLocalTransformsTo(gfxMatrix()); if (!matrix.IsIdentity()) { - RefPtr builder = path->TransformedCopyToBuilder(matrix); + RefPtr builder = + path->TransformedCopyToBuilder(ToMatrix(matrix)); path = builder->Finish(); } } diff --git a/content/svg/content/src/SVGSVGElement.cpp b/content/svg/content/src/SVGSVGElement.cpp index 285925532950..aa2e00c1be86 100644 --- a/content/svg/content/src/SVGSVGElement.cpp +++ b/content/svg/content/src/SVGSVGElement.cpp @@ -946,15 +946,15 @@ SVGSVGElement::GetLength(uint8_t aCtxType) //---------------------------------------------------------------------- // nsSVGElement methods -/* virtual */ gfx::Matrix -SVGSVGElement::PrependLocalTransformsTo(const gfx::Matrix &aMatrix, +/* virtual */ gfxMatrix +SVGSVGElement::PrependLocalTransformsTo(const gfxMatrix &aMatrix, TransformTypes aWhich) const { NS_ABORT_IF_FALSE(aWhich != eChildToUserSpace || aMatrix.IsIdentity(), "Skipping eUserSpaceToParent transforms makes no sense"); // 'transform' attribute: - gfx::Matrix fromUserSpace = + gfxMatrix fromUserSpace = SVGSVGElementBase::PrependLocalTransformsTo(aMatrix, aWhich); if (aWhich == eUserSpaceToParent) { return fromUserSpace; @@ -965,21 +965,21 @@ SVGSVGElement::PrependLocalTransformsTo(const gfx::Matrix &aMatrix, const_cast(this)->GetAnimatedLengthValues(&x, &y, nullptr); if (aWhich == eAllTransforms) { // the common case - return gfx::ToMatrix(GetViewBoxTransform()) * gfx::Matrix().Translate(x, y) * fromUserSpace; + return GetViewBoxTransform() * gfxMatrix().Translate(gfxPoint(x, y)) * fromUserSpace; } NS_ABORT_IF_FALSE(aWhich == eChildToUserSpace, "Unknown TransformTypes"); - return gfx::ToMatrix(GetViewBoxTransform()) * gfx::Matrix().Translate(x, y); + return GetViewBoxTransform() * gfxMatrix().Translate(gfxPoint(x, y)); } if (IsRoot()) { - gfx::Matrix zoomPanTM; - zoomPanTM.Translate(mCurrentTranslate.GetX(), mCurrentTranslate.GetY()); + gfxMatrix zoomPanTM; + zoomPanTM.Translate(gfxPoint(mCurrentTranslate.GetX(), mCurrentTranslate.GetY())); zoomPanTM.Scale(mCurrentScale, mCurrentScale); - return gfx::ToMatrix(GetViewBoxTransform()) * zoomPanTM * fromUserSpace; + return GetViewBoxTransform() * zoomPanTM * fromUserSpace; } // outer-, but inline in some other content: - return gfx::ToMatrix(GetViewBoxTransform()) * fromUserSpace; + return GetViewBoxTransform() * fromUserSpace; } /* virtual */ bool diff --git a/content/svg/content/src/SVGSVGElement.h b/content/svg/content/src/SVGSVGElement.h index 798323e5fc45..6e02d22971e8 100644 --- a/content/svg/content/src/SVGSVGElement.h +++ b/content/svg/content/src/SVGSVGElement.h @@ -132,7 +132,7 @@ public: virtual bool IsEventAttributeName(nsIAtom* aName) MOZ_OVERRIDE; // nsSVGElement specializations: - virtual gfx::Matrix PrependLocalTransformsTo(const gfx::Matrix &aMatrix, + virtual gfxMatrix PrependLocalTransformsTo(const gfxMatrix &aMatrix, TransformTypes aWhich = eAllTransforms) const MOZ_OVERRIDE; virtual bool HasValidDimensions() const MOZ_OVERRIDE; diff --git a/content/svg/content/src/SVGTransformableElement.cpp b/content/svg/content/src/SVGTransformableElement.cpp index 57e155112cf9..77197ebe7294 100644 --- a/content/svg/content/src/SVGTransformableElement.cpp +++ b/content/svg/content/src/SVGTransformableElement.cpp @@ -85,14 +85,14 @@ SVGTransformableElement::IsEventAttributeName(nsIAtom* aName) //---------------------------------------------------------------------- // nsSVGElement overrides -gfx::Matrix -SVGTransformableElement::PrependLocalTransformsTo(const gfx::Matrix &aMatrix, +gfxMatrix +SVGTransformableElement::PrependLocalTransformsTo(const gfxMatrix &aMatrix, TransformTypes aWhich) const { NS_ABORT_IF_FALSE(aWhich != eChildToUserSpace || aMatrix.IsIdentity(), "Skipping eUserSpaceToParent transforms makes no sense"); - gfx::Matrix result(aMatrix); + gfxMatrix result(aMatrix); if (aWhich == eChildToUserSpace) { // We don't have anything to prepend. @@ -109,30 +109,30 @@ SVGTransformableElement::PrependLocalTransformsTo(const gfx::Matrix &aMatrix, // any transformations from the |transform| attribute. So since we're // PRE-multiplying, we need to apply the animateMotion transform *first*. if (mAnimateMotionTransform) { - result = *mAnimateMotionTransform * result; + result.PreMultiply(*mAnimateMotionTransform); } if (mTransforms) { - result = gfx::ToMatrix(mTransforms->GetAnimValue().GetConsolidationMatrix()) * result; + result.PreMultiply(mTransforms->GetAnimValue().GetConsolidationMatrix()); } return result; } -const gfx::Matrix* +const gfxMatrix* SVGTransformableElement::GetAnimateMotionTransform() const { return mAnimateMotionTransform.get(); } void -SVGTransformableElement::SetAnimateMotionTransform(const gfx::Matrix* aMatrix) +SVGTransformableElement::SetAnimateMotionTransform(const gfxMatrix* aMatrix) { if ((!aMatrix && !mAnimateMotionTransform) || (aMatrix && mAnimateMotionTransform && *aMatrix == *mAnimateMotionTransform)) { return; } - mAnimateMotionTransform = aMatrix ? new gfx::Matrix(*aMatrix) : nullptr; + mAnimateMotionTransform = aMatrix ? new gfxMatrix(*aMatrix) : nullptr; DidAnimateTransformList(); nsIFrame* frame = GetPrimaryFrame(); if (frame) { diff --git a/content/svg/content/src/SVGTransformableElement.h b/content/svg/content/src/SVGTransformableElement.h index ff4f700ca379..1842ce459bd3 100644 --- a/content/svg/content/src/SVGTransformableElement.h +++ b/content/svg/content/src/SVGTransformableElement.h @@ -9,7 +9,7 @@ #include "mozilla/Attributes.h" #include "nsSVGAnimatedTransformList.h" #include "nsSVGElement.h" -#include "mozilla/gfx/Matrix.h" +#include "gfxMatrix.h" namespace mozilla { namespace dom { @@ -48,10 +48,10 @@ public: virtual bool IsEventAttributeName(nsIAtom* aName) MOZ_OVERRIDE; - virtual gfx::Matrix PrependLocalTransformsTo(const gfx::Matrix &aMatrix, + virtual gfxMatrix PrependLocalTransformsTo(const gfxMatrix &aMatrix, TransformTypes aWhich = eAllTransforms) const MOZ_OVERRIDE; - virtual const gfx::Matrix* GetAnimateMotionTransform() const MOZ_OVERRIDE; - virtual void SetAnimateMotionTransform(const gfx::Matrix* aMatrix) MOZ_OVERRIDE; + virtual const gfxMatrix* GetAnimateMotionTransform() const MOZ_OVERRIDE; + virtual void SetAnimateMotionTransform(const gfxMatrix* aMatrix) MOZ_OVERRIDE; virtual nsSVGAnimatedTransformList* GetAnimatedTransformList(uint32_t aFlags = 0) MOZ_OVERRIDE; @@ -67,7 +67,7 @@ protected: nsAutoPtr mTransforms; // XXX maybe move this to property table, to save space on un-animated elems? - nsAutoPtr mAnimateMotionTransform; + nsAutoPtr mAnimateMotionTransform; }; } // namespace dom diff --git a/content/svg/content/src/SVGUseElement.cpp b/content/svg/content/src/SVGUseElement.cpp index 1772ed66585a..feedf68fb778 100644 --- a/content/svg/content/src/SVGUseElement.cpp +++ b/content/svg/content/src/SVGUseElement.cpp @@ -421,15 +421,15 @@ SVGUseElement::UnlinkSource() //---------------------------------------------------------------------- // nsSVGElement methods -/* virtual */ gfx::Matrix -SVGUseElement::PrependLocalTransformsTo(const gfx::Matrix &aMatrix, +/* virtual */ gfxMatrix +SVGUseElement::PrependLocalTransformsTo(const gfxMatrix &aMatrix, TransformTypes aWhich) const { NS_ABORT_IF_FALSE(aWhich != eChildToUserSpace || aMatrix.IsIdentity(), "Skipping eUserSpaceToParent transforms makes no sense"); // 'transform' attribute: - gfx::Matrix fromUserSpace = + gfxMatrix fromUserSpace = SVGUseElementBase::PrependLocalTransformsTo(aMatrix, aWhich); if (aWhich == eUserSpaceToParent) { return fromUserSpace; @@ -437,7 +437,7 @@ SVGUseElement::PrependLocalTransformsTo(const gfx::Matrix &aMatrix, // our 'x' and 'y' attributes: float x, y; const_cast(this)->GetAnimatedLengthValues(&x, &y, nullptr); - gfx::Matrix toUserSpace = gfx::Matrix().Translate(x, y); + gfxMatrix toUserSpace = gfxMatrix().Translate(gfxPoint(x, y)); if (aWhich == eChildToUserSpace) { return toUserSpace; } diff --git a/content/svg/content/src/SVGUseElement.h b/content/svg/content/src/SVGUseElement.h index 0e6fb2e3985f..504c22475fa2 100644 --- a/content/svg/content/src/SVGUseElement.h +++ b/content/svg/content/src/SVGUseElement.h @@ -61,7 +61,7 @@ public: void DestroyAnonymousContent(); // nsSVGElement specializations: - virtual gfx::Matrix PrependLocalTransformsTo(const gfx::Matrix &aMatrix, + virtual gfxMatrix PrependLocalTransformsTo(const gfxMatrix &aMatrix, TransformTypes aWhich = eAllTransforms) const MOZ_OVERRIDE; virtual bool HasValidDimensions() const MOZ_OVERRIDE; diff --git a/content/svg/content/src/nsSVGElement.cpp b/content/svg/content/src/nsSVGElement.cpp index 10bc074e3bc3..2561edd73d87 100644 --- a/content/svg/content/src/nsSVGElement.cpp +++ b/content/svg/content/src/nsSVGElement.cpp @@ -1560,8 +1560,8 @@ nsSVGElement::GetCtx() const return nullptr; } -/* virtual */ gfx::Matrix -nsSVGElement::PrependLocalTransformsTo(const gfx::Matrix &aMatrix, +/* virtual */ gfxMatrix +nsSVGElement::PrependLocalTransformsTo(const gfxMatrix &aMatrix, TransformTypes aWhich) const { return aMatrix; diff --git a/content/svg/content/src/nsSVGElement.h b/content/svg/content/src/nsSVGElement.h index 10a499316b28..a9a29fe2af13 100644 --- a/content/svg/content/src/nsSVGElement.h +++ b/content/svg/content/src/nsSVGElement.h @@ -57,13 +57,9 @@ class SVGAnimatedPreserveAspectRatio; class nsSVGAnimatedTransformList; class SVGStringList; class DOMSVGStringList; - -namespace gfx { -class Matrix; -} - } +struct gfxMatrix; struct nsSVGEnumMapping; typedef nsStyledElementNotElementCSSInlineStyle nsSVGElementBase; @@ -166,14 +162,14 @@ public: * 'x'/'y' attributes, and any transform due to a 'viewBox' attribute, but * does not include any transforms due to the 'transform' attribute. */ - virtual mozilla::gfx::Matrix PrependLocalTransformsTo(const mozilla::gfx::Matrix &aMatrix, + virtual gfxMatrix PrependLocalTransformsTo(const gfxMatrix &aMatrix, TransformTypes aWhich = eAllTransforms) const; // Setter for to set the current transformation // Only visible for nsSVGGraphicElement, so it's a no-op here, and that // subclass has the useful implementation. - virtual void SetAnimateMotionTransform(const mozilla::gfx::Matrix* aMatrix) {/*no-op*/} - virtual const mozilla::gfx::Matrix* GetAnimateMotionTransform() const { return nullptr; } + virtual void SetAnimateMotionTransform(const gfxMatrix* aMatrix) {/*no-op*/} + virtual const gfxMatrix* GetAnimateMotionTransform() const { return nullptr; } bool IsStringAnimatable(uint8_t aAttrEnum) { return GetStringInfo().mStringInfo[aAttrEnum].mIsAnimatable; diff --git a/layout/svg/SVGTextFrame.cpp b/layout/svg/SVGTextFrame.cpp index 74ae80cb471f..18c23c62c469 100644 --- a/layout/svg/SVGTextFrame.cpp +++ b/layout/svg/SVGTextFrame.cpp @@ -3845,11 +3845,11 @@ SVGTextFrame::GetCanvasTM(uint32_t aFor, nsIFrame* aTransformRoot) nsSVGContainerFrame *parent = static_cast(mParent); dom::SVGTextContentElement *content = static_cast(mContent); - gfx::Matrix tm = content->PrependLocalTransformsTo( - this == aTransformRoot ? gfx::Matrix() : - gfx::ToMatrix(parent->GetCanvasTM(aFor, aTransformRoot))); + gfxMatrix tm = content->PrependLocalTransformsTo( + this == aTransformRoot ? gfxMatrix() : + parent->GetCanvasTM(aFor, aTransformRoot)); - mCanvasTM = new gfxMatrix(ThebesMatrix(tm)); + mCanvasTM = new gfxMatrix(tm); } return *mCanvasTM; } @@ -4731,9 +4731,10 @@ SVGTextFrame::GetTextPath(nsIFrame* aTextPathFrame) return nullptr; } - gfx::Matrix matrix = element->PrependLocalTransformsTo(gfx::Matrix()); + gfxMatrix matrix = element->PrependLocalTransformsTo(gfxMatrix()); if (!matrix.IsIdentity()) { - RefPtr builder = path->TransformedCopyToBuilder(matrix); + RefPtr builder = + path->TransformedCopyToBuilder(ToMatrix(matrix)); path = builder->Finish(); } diff --git a/layout/svg/nsSVGAFrame.cpp b/layout/svg/nsSVGAFrame.cpp index 236aaa20221c..bec05ddc3606 100644 --- a/layout/svg/nsSVGAFrame.cpp +++ b/layout/svg/nsSVGAFrame.cpp @@ -146,11 +146,11 @@ nsSVGAFrame::GetCanvasTM(uint32_t aFor, nsIFrame* aTransformRoot) nsSVGContainerFrame *parent = static_cast(mParent); dom::SVGAElement *content = static_cast(mContent); - gfx::Matrix tm = content->PrependLocalTransformsTo( - this == aTransformRoot ? gfx::Matrix() : - gfx::ToMatrix(parent->GetCanvasTM(aFor, aTransformRoot))); + gfxMatrix tm = content->PrependLocalTransformsTo( + this == aTransformRoot ? gfxMatrix() : + parent->GetCanvasTM(aFor, aTransformRoot)); - mCanvasTM = new gfxMatrix(ThebesMatrix(tm)); + mCanvasTM = new gfxMatrix(tm); } return *mCanvasTM; diff --git a/layout/svg/nsSVGClipPathFrame.cpp b/layout/svg/nsSVGClipPathFrame.cpp index cedae1787365..f8c9815260a3 100644 --- a/layout/svg/nsSVGClipPathFrame.cpp +++ b/layout/svg/nsSVGClipPathFrame.cpp @@ -14,7 +14,6 @@ #include "nsSVGEffects.h" #include "nsSVGUtils.h" -using namespace mozilla; using namespace mozilla::dom; //---------------------------------------------------------------------- @@ -318,11 +317,11 @@ nsSVGClipPathFrame::GetCanvasTM(uint32_t aFor, nsIFrame* aTransformRoot) { SVGClipPathElement *content = static_cast(mContent); - gfx::Matrix tm = + gfxMatrix tm = content->PrependLocalTransformsTo(mClipParentMatrix ? - gfx::ToMatrix(*mClipParentMatrix) : gfx::Matrix()); + *mClipParentMatrix : gfxMatrix()); - return nsSVGUtils::AdjustMatrixForUnits(ThebesMatrix(tm), + return nsSVGUtils::AdjustMatrixForUnits(tm, &content->mEnumAttributes[SVGClipPathElement::CLIPPATHUNITS], mClipParent); } diff --git a/layout/svg/nsSVGContainerFrame.cpp b/layout/svg/nsSVGContainerFrame.cpp index 50a58295e39e..676d88b7f2bf 100644 --- a/layout/svg/nsSVGContainerFrame.cpp +++ b/layout/svg/nsSVGContainerFrame.cpp @@ -240,8 +240,8 @@ nsSVGDisplayContainerFrame::IsSVGTransformed(gfxMatrix *aOwnTransform, if ((transformList && transformList->HasTransform()) || content->GetAnimateMotionTransform()) { if (aOwnTransform) { - *aOwnTransform = ThebesMatrix(content->PrependLocalTransformsTo(gfx::Matrix(), - nsSVGElement::eUserSpaceToParent)); + *aOwnTransform = content->PrependLocalTransformsTo(gfxMatrix(), + nsSVGElement::eUserSpaceToParent); } foundTransform = true; } @@ -401,14 +401,15 @@ nsSVGDisplayContainerFrame::GetBBoxContribution( while (kid) { nsISVGChildFrame* svgKid = do_QueryFrame(kid); if (svgKid) { - gfx::Matrix transform = gfx::ToMatrix(aToBBoxUserspace); + gfxMatrix transform = aToBBoxUserspace; nsIContent *content = kid->GetContent(); if (content->IsSVG()) { - transform = static_cast(content)->PrependLocalTransformsTo(transform); + transform = static_cast(content)-> + PrependLocalTransformsTo(aToBBoxUserspace); } // We need to include zero width/height vertical/horizontal lines, so we have // to use UnionEdges. - bboxUnion.UnionEdges(svgKid->GetBBoxContribution(ThebesMatrix(transform), aFlags)); + bboxUnion.UnionEdges(svgKid->GetBBoxContribution(transform, aFlags)); } kid = kid->GetNextSibling(); } diff --git a/layout/svg/nsSVGFilterFrame.cpp b/layout/svg/nsSVGFilterFrame.cpp index 295c7563cc94..0756e7290c86 100644 --- a/layout/svg/nsSVGFilterFrame.cpp +++ b/layout/svg/nsSVGFilterFrame.cpp @@ -19,9 +19,7 @@ #include "nsSVGIntegrationUtils.h" #include "nsSVGUtils.h" #include "nsContentUtils.h" -#include "mozilla/gfx/Matrix.h" -using namespace mozilla; using namespace mozilla::dom; nsIFrame* @@ -71,7 +69,7 @@ MapFrameRectToFilterSpace(const nsRect* aRect, static gfxMatrix GetUserToFrameSpaceInCSSPxTransform(nsIFrame *aFrame) { - gfx::Matrix userToFrameSpaceInCSSPx; + gfxMatrix userToFrameSpaceInCSSPx; if ((aFrame->GetStateBits() & NS_FRAME_SVG_LAYOUT)) { int32_t appUnitsPerCSSPx = aFrame->PresContext()->AppUnitsPerCSSPixel(); @@ -88,17 +86,16 @@ GetUserToFrameSpaceInCSSPxTransform(nsIFrame *aFrame) if (aFrame->GetType() == nsGkAtoms::svgInnerSVGFrame) { userToFrameSpaceInCSSPx = static_cast(aFrame->GetContent())-> - PrependLocalTransformsTo(gfx::Matrix()); + PrependLocalTransformsTo(gfxMatrix()); } else { gfxPoint targetsUserSpaceOffset = nsLayoutUtils::RectToGfxRect(aFrame->GetRect(), appUnitsPerCSSPx). TopLeft(); - userToFrameSpaceInCSSPx.Translate(-targetsUserSpaceOffset.x, - -targetsUserSpaceOffset.y); + userToFrameSpaceInCSSPx.Translate(-targetsUserSpaceOffset); } } // else, for all other frames, leave as the identity matrix - return ThebesMatrix(userToFrameSpaceInCSSPx); + return userToFrameSpaceInCSSPx; } class MOZ_STACK_CLASS nsSVGFilterFrame::AutoFilterReferencer diff --git a/layout/svg/nsSVGForeignObjectFrame.cpp b/layout/svg/nsSVGForeignObjectFrame.cpp index c2250438e908..ed06265b9070 100644 --- a/layout/svg/nsSVGForeignObjectFrame.cpp +++ b/layout/svg/nsSVGForeignObjectFrame.cpp @@ -184,8 +184,8 @@ nsSVGForeignObjectFrame::IsSVGTransformed(gfxMatrix *aOwnTransform, if ((transformList && transformList->HasTransform()) || content->GetAnimateMotionTransform()) { if (aOwnTransform) { - *aOwnTransform = ThebesMatrix(content->PrependLocalTransformsTo(gfx::Matrix(), - nsSVGElement::eUserSpaceToParent)); + *aOwnTransform = content->PrependLocalTransformsTo(gfxMatrix(), + nsSVGElement::eUserSpaceToParent); } foundTransform = true; } @@ -502,11 +502,11 @@ nsSVGForeignObjectFrame::GetCanvasTM(uint32_t aFor, nsIFrame* aTransformRoot) SVGForeignObjectElement *content = static_cast(mContent); - gfx::Matrix tm = content->PrependLocalTransformsTo( - this == aTransformRoot ? gfx::Matrix() : - gfx::ToMatrix(parent->GetCanvasTM(aFor, aTransformRoot))); + gfxMatrix tm = content->PrependLocalTransformsTo( + this == aTransformRoot ? gfxMatrix() : + parent->GetCanvasTM(aFor, aTransformRoot)); - mCanvasTM = new gfxMatrix(ThebesMatrix(tm)); + mCanvasTM = new gfxMatrix(tm); } return *mCanvasTM; } diff --git a/layout/svg/nsSVGGFrame.cpp b/layout/svg/nsSVGGFrame.cpp index c13f3e3618e5..29e779eae7da 100644 --- a/layout/svg/nsSVGGFrame.cpp +++ b/layout/svg/nsSVGGFrame.cpp @@ -14,7 +14,6 @@ #include "nsSVGIntegrationUtils.h" #include "nsSVGUtils.h" -using namespace mozilla; using namespace mozilla::dom; //---------------------------------------------------------------------- @@ -79,11 +78,11 @@ nsSVGGFrame::GetCanvasTM(uint32_t aFor, nsIFrame* aTransformRoot) nsSVGContainerFrame *parent = static_cast(mParent); SVGGraphicsElement *content = static_cast(mContent); - gfx::Matrix tm = content->PrependLocalTransformsTo( - this == aTransformRoot ? gfx::Matrix() : - gfx::ToMatrix(parent->GetCanvasTM(aFor, aTransformRoot))); + gfxMatrix tm = content->PrependLocalTransformsTo( + this == aTransformRoot ? gfxMatrix() : + parent->GetCanvasTM(aFor, aTransformRoot)); - mCanvasTM = new gfxMatrix(ThebesMatrix(tm)); + mCanvasTM = new gfxMatrix(tm); } return *mCanvasTM; } diff --git a/layout/svg/nsSVGInnerSVGFrame.cpp b/layout/svg/nsSVGInnerSVGFrame.cpp index 365ab0e0b4d4..8df90e7f6f1b 100644 --- a/layout/svg/nsSVGInnerSVGFrame.cpp +++ b/layout/svg/nsSVGInnerSVGFrame.cpp @@ -283,11 +283,11 @@ nsSVGInnerSVGFrame::GetCanvasTM(uint32_t aFor, nsIFrame* aTransformRoot) nsSVGContainerFrame *parent = static_cast(mParent); SVGSVGElement *content = static_cast(mContent); - gfx::Matrix tm = content->PrependLocalTransformsTo( - this == aTransformRoot ? gfx::Matrix() : - gfx::ToMatrix(parent->GetCanvasTM(aFor, aTransformRoot))); + gfxMatrix tm = content->PrependLocalTransformsTo( + this == aTransformRoot ? gfxMatrix() : + parent->GetCanvasTM(aFor, aTransformRoot)); - mCanvasTM = new gfxMatrix(ThebesMatrix(tm)); + mCanvasTM = new gfxMatrix(tm); } return *mCanvasTM; } diff --git a/layout/svg/nsSVGOuterSVGFrame.cpp b/layout/svg/nsSVGOuterSVGFrame.cpp index 2d313a321330..3b99176d4341 100644 --- a/layout/svg/nsSVGOuterSVGFrame.cpp +++ b/layout/svg/nsSVGOuterSVGFrame.cpp @@ -839,9 +839,9 @@ nsSVGOuterSVGFrame::GetCanvasTM(uint32_t aFor, nsIFrame* aTransformRoot) 1.0f / PresContext()->AppUnitsToFloatCSSPixels( PresContext()->AppUnitsPerDevPixel()); - gfx::Matrix tm = content->PrependLocalTransformsTo( - gfx::Matrix().Scale(devPxPerCSSPx, devPxPerCSSPx)); - mCanvasTM = new gfxMatrix(ThebesMatrix(tm)); + gfxMatrix tm = content->PrependLocalTransformsTo( + gfxMatrix().Scale(devPxPerCSSPx, devPxPerCSSPx)); + mCanvasTM = new gfxMatrix(tm); } return *mCanvasTM; } @@ -943,9 +943,10 @@ nsSVGOuterSVGAnonChildFrame::HasChildrenOnlyTransform(gfxMatrix *aTransform) con if (hasTransform && aTransform) { // Outer- doesn't use x/y, so we can pass eChildToUserSpace here. - *aTransform = ThebesMatrix( - content->PrependLocalTransformsTo(gfx::Matrix(), - nsSVGElement::eChildToUserSpace)); + gfxMatrix identity; + *aTransform = + content->PrependLocalTransformsTo(identity, + nsSVGElement::eChildToUserSpace); } return hasTransform; diff --git a/layout/svg/nsSVGPathGeometryFrame.cpp b/layout/svg/nsSVGPathGeometryFrame.cpp index dcb1972f9dde..aff4957d4866 100644 --- a/layout/svg/nsSVGPathGeometryFrame.cpp +++ b/layout/svg/nsSVGPathGeometryFrame.cpp @@ -163,8 +163,8 @@ nsSVGPathGeometryFrame::IsSVGTransformed(gfxMatrix *aOwnTransform, if ((transformList && transformList->HasTransform()) || content->GetAnimateMotionTransform()) { if (aOwnTransform) { - *aOwnTransform = ThebesMatrix(content->PrependLocalTransformsTo(gfx::Matrix(), - nsSVGElement::eUserSpaceToParent)); + *aOwnTransform = content->PrependLocalTransformsTo(gfxMatrix(), + nsSVGElement::eUserSpaceToParent); } foundTransform = true; } @@ -512,9 +512,9 @@ nsSVGPathGeometryFrame::GetCanvasTM(uint32_t aFor, nsIFrame* aTransformRoot) nsSVGContainerFrame *parent = static_cast(mParent); dom::SVGGraphicsElement *content = static_cast(mContent); - return ThebesMatrix(content->PrependLocalTransformsTo( - this == aTransformRoot ? gfx::Matrix() : - gfx::ToMatrix(parent->GetCanvasTM(aFor, aTransformRoot)))); + return content->PrependLocalTransformsTo( + this == aTransformRoot ? gfxMatrix() : + parent->GetCanvasTM(aFor, aTransformRoot)); } //---------------------------------------------------------------------- diff --git a/layout/svg/nsSVGSwitchFrame.cpp b/layout/svg/nsSVGSwitchFrame.cpp index d9307d571c1c..cbc538c1a268 100644 --- a/layout/svg/nsSVGSwitchFrame.cpp +++ b/layout/svg/nsSVGSwitchFrame.cpp @@ -13,8 +13,6 @@ class nsRenderingContext; -using namespace mozilla; - typedef nsSVGGFrame nsSVGSwitchFrameBase; class nsSVGSwitchFrame : public nsSVGSwitchFrameBase @@ -232,12 +230,12 @@ nsSVGSwitchFrame::GetBBoxContribution(const gfxMatrix &aToBBoxUserspace, nsISVGChildFrame* svgKid = do_QueryFrame(kid); if (svgKid) { nsIContent *content = kid->GetContent(); - gfx::Matrix transform = gfx::ToMatrix(aToBBoxUserspace); + gfxMatrix transform = aToBBoxUserspace; if (content->IsSVG()) { transform = static_cast(content)-> - PrependLocalTransformsTo(transform); + PrependLocalTransformsTo(aToBBoxUserspace); } - return svgKid->GetBBoxContribution(ThebesMatrix(transform), aFlags); + return svgKid->GetBBoxContribution(transform, aFlags); } } return SVGBBox(); diff --git a/layout/svg/nsSVGUtils.cpp b/layout/svg/nsSVGUtils.cpp index 83cafa1b1eec..46fcbfb3587b 100644 --- a/layout/svg/nsSVGUtils.cpp +++ b/layout/svg/nsSVGUtils.cpp @@ -646,14 +646,14 @@ nsSVGUtils::GetUserToCanvasTM(nsIFrame *aFrame, uint32_t aFor) nsISVGChildFrame* svgFrame = do_QueryFrame(aFrame); NS_ASSERTION(svgFrame, "bad frame"); - gfx::Matrix tm; + gfxMatrix tm; if (svgFrame) { nsSVGElement *content = static_cast(aFrame->GetContent()); tm = content->PrependLocalTransformsTo( - gfx::ToMatrix(GetCanvasTM(aFrame->GetParent(), aFor)), + GetCanvasTM(aFrame->GetParent(), aFor), nsSVGElement::eUserSpaceToParent); } - return ThebesMatrix(tm); + return tm; } void @@ -1187,7 +1187,7 @@ nsSVGUtils::GetBBox(nsIFrame *aFrame, uint32_t aFlags) !static_cast(content)->HasValidDimensions()) { return bbox; } - gfx::Matrix matrix; + gfxMatrix matrix; if (aFrame->GetType() == nsGkAtoms::svgForeignObjectFrame) { // The spec says getBBox "Returns the tight bounding box in *current user // space*". So we should really be doing this for all elements, but that @@ -1197,7 +1197,7 @@ nsSVGUtils::GetBBox(nsIFrame *aFrame, uint32_t aFlags) matrix = element->PrependLocalTransformsTo(matrix, nsSVGElement::eChildToUserSpace); } - return svg->GetBBoxContribution(ThebesMatrix(matrix), aFlags).ToThebesRect(); + return svg->GetBBoxContribution(matrix, aFlags).ToThebesRect(); } return nsSVGIntegrationUtils::GetSVGBBoxForNonSVGFrame(aFrame); } @@ -1799,13 +1799,14 @@ nsSVGUtils::GetSVGGlyphExtents(Element* aElement, return false; } - gfx::Matrix transform = gfx::ToMatrix(aSVGToAppSpace); + gfxMatrix transform(aSVGToAppSpace); nsIContent* content = frame->GetContent(); if (content->IsSVG()) { - transform = static_cast(content)->PrependLocalTransformsTo(transform); + transform = static_cast(content)-> + PrependLocalTransformsTo(aSVGToAppSpace); } - *aResult = svgFrame->GetBBoxContribution(ThebesMatrix(transform), + *aResult = svgFrame->GetBBoxContribution(transform, nsSVGUtils::eBBoxIncludeFill | nsSVGUtils::eBBoxIncludeFillGeometry | nsSVGUtils::eBBoxIncludeStroke | nsSVGUtils::eBBoxIncludeStrokeGeometry | nsSVGUtils::eBBoxIncludeMarkers).ToThebesRect();