From 8a8c63d72c8c472959b7dd3cb4d3c7c1226d6016 Mon Sep 17 00:00:00 2001 From: David Zbarsky Date: Tue, 2 Apr 2013 15:17:41 -0400 Subject: [PATCH] Bug 855597: Rename SVGTransform to nsSVGTransform r=jwatt --HG-- rename : content/svg/content/src/SVGTransform.cpp => content/svg/content/src/nsSVGTransform.cpp rename : content/svg/content/src/SVGTransform.h => content/svg/content/src/nsSVGTransform.h --- content/svg/content/src/DOMSVGTransform.cpp | 20 ++++++++-------- content/svg/content/src/DOMSVGTransform.h | 24 +++++++++---------- content/svg/content/src/Makefile.in | 2 +- .../content/src/SVGAnimatedTransformList.cpp | 2 +- content/svg/content/src/SVGTransformList.cpp | 2 +- content/svg/content/src/SVGTransformList.h | 20 ++++++++-------- .../content/src/SVGTransformListParser.cpp | 14 +++++------ .../svg/content/src/SVGTransformListParser.h | 6 ++--- .../content/src/SVGTransformListSMILType.cpp | 4 ++-- .../content/src/SVGTransformListSMILType.h | 6 ++--- .../{SVGTransform.cpp => nsSVGTransform.cpp} | 22 ++++++++--------- .../src/{SVGTransform.h => nsSVGTransform.h} | 16 ++++++------- 12 files changed, 69 insertions(+), 69 deletions(-) rename content/svg/content/src/{SVGTransform.cpp => nsSVGTransform.cpp} (92%) rename content/svg/content/src/{SVGTransform.h => nsSVGTransform.h} (93%) diff --git a/content/svg/content/src/DOMSVGTransform.cpp b/content/svg/content/src/DOMSVGTransform.cpp index fda47db20f20..585fd50748d5 100644 --- a/content/svg/content/src/DOMSVGTransform.cpp +++ b/content/svg/content/src/DOMSVGTransform.cpp @@ -74,9 +74,9 @@ DOMSVGTransform::DOMSVGTransform() : mList(nullptr) , mListIndex(0) , mIsAnimValItem(false) - , mTransform(new SVGTransform()) // Default ctor for objects not in a list - // initialises to matrix type with identity - // matrix + , mTransform(new nsSVGTransform()) // Default ctor for objects not in a list + // initialises to matrix type with identity + // matrix { SetIsDOMBinding(); } @@ -85,16 +85,16 @@ DOMSVGTransform::DOMSVGTransform(const gfxMatrix &aMatrix) : mList(nullptr) , mListIndex(0) , mIsAnimValItem(false) - , mTransform(new SVGTransform(aMatrix)) + , mTransform(new nsSVGTransform(aMatrix)) { SetIsDOMBinding(); } -DOMSVGTransform::DOMSVGTransform(const SVGTransform &aTransform) +DOMSVGTransform::DOMSVGTransform(const nsSVGTransform &aTransform) : mList(nullptr) , mListIndex(0) , mIsAnimValItem(false) - , mTransform(new SVGTransform(aTransform)) + , mTransform(new nsSVGTransform(aTransform)) { SetIsDOMBinding(); } @@ -272,12 +272,12 @@ DOMSVGTransform::RemovingFromList() NS_ABORT_IF_FALSE(!mTransform, "Item in list also has another non-list value associated with it"); - mTransform = new SVGTransform(InternalItem()); + mTransform = new nsSVGTransform(InternalItem()); mList = nullptr; mIsAnimValItem = false; } -SVGTransform& +nsSVGTransform& DOMSVGTransform::InternalItem() { SVGAnimatedTransformList *alist = Element()->GetAnimatedTransformList(); @@ -286,7 +286,7 @@ DOMSVGTransform::InternalItem() alist->mBaseVal[mListIndex]; } -const SVGTransform& +const nsSVGTransform& DOMSVGTransform::InternalItem() const { return const_cast(this)->InternalItem(); @@ -315,7 +315,7 @@ DOMSVGTransform::SetMatrix(const gfxMatrix& aMatrix) "Attempting to modify read-only transform"); if (Transform().Type() == SVG_TRANSFORM_MATRIX && - SVGTransform::MatricesEqual(Matrixgfx(), aMatrix)) { + nsSVGTransform::MatricesEqual(Matrixgfx(), aMatrix)) { return; } diff --git a/content/svg/content/src/DOMSVGTransform.h b/content/svg/content/src/DOMSVGTransform.h index 46666e301b44..b63d373be45b 100644 --- a/content/svg/content/src/DOMSVGTransform.h +++ b/content/svg/content/src/DOMSVGTransform.h @@ -12,7 +12,7 @@ #include "nsCycleCollectionParticipant.h" #include "nsDebug.h" #include "nsID.h" -#include "SVGTransform.h" +#include "nsSVGTransform.h" #include "nsWrapperCache.h" #include "mozilla/Attributes.h" @@ -57,7 +57,7 @@ public: /** * Ctor for creating an unowned copy. Used with Clone(). */ - explicit DOMSVGTransform(const SVGTransform &aMatrix); + explicit DOMSVGTransform(const nsSVGTransform &aMatrix); ~DOMSVGTransform(); @@ -113,7 +113,7 @@ public: */ void RemovingFromList(); - SVGTransform ToSVGTransform() const { + nsSVGTransform ToSVGTransform() const { return Transform(); } @@ -147,20 +147,20 @@ private: } /** - * Get a reference to the internal SVGTransform list item that this DOM + * Get a reference to the internal nsSVGTransform list item that this DOM * wrapper object currently wraps. */ - SVGTransform& InternalItem(); - const SVGTransform& InternalItem() const; + nsSVGTransform& InternalItem(); + const nsSVGTransform& InternalItem() const; #ifdef DEBUG bool IndexIsValid(); #endif - const SVGTransform& Transform() const { + const nsSVGTransform& Transform() const { return HasOwner() ? InternalItem() : *mTransform; } - SVGTransform& Transform() { + nsSVGTransform& Transform() { return HasOwner() ? InternalItem() : *mTransform; } inline nsAttrValue NotifyElementWillChange(); @@ -174,13 +174,13 @@ private: uint32_t mListIndex:MOZ_SVG_LIST_INDEX_BIT_COUNT; uint32_t mIsAnimValItem:1; - // Usually this class acts as a wrapper for an SVGTransform object which is + // Usually this class acts as a wrapper for an nsSVGTransform object which is // part of a list and is accessed by going via the owning Element. // // However, in some circumstances, objects of this class may not be associated - // with any particular list and thus, no internal SVGTransform object. In - // that case we allocate an SVGTransform object on the heap to store the data. - nsAutoPtr mTransform; + // with any particular list and thus, no internal nsSVGTransform object. In + // that case we allocate an nsSVGTransform object on the heap to store the data. + nsAutoPtr mTransform; }; nsAttrValue diff --git a/content/svg/content/src/Makefile.in b/content/svg/content/src/Makefile.in index 540ff40cc0f6..4f75fec58aa3 100644 --- a/content/svg/content/src/Makefile.in +++ b/content/svg/content/src/Makefile.in @@ -50,6 +50,7 @@ CPPSRCS = \ nsSVGPathGeometryElement.cpp \ nsSVGPolyElement.cpp \ nsSVGString.cpp \ + nsSVGTransform.cpp \ nsSVGViewBox.cpp \ SVGAElement.cpp \ SVGAltGlyphElement.cpp \ @@ -146,7 +147,6 @@ CPPSRCS = \ SVGTextPathElement.cpp \ SVGTextPositioningElement.cpp \ SVGTitleElement.cpp \ - SVGTransform.cpp \ SVGTransformableElement.cpp \ SVGTransformList.cpp \ SVGTransformListParser.cpp \ diff --git a/content/svg/content/src/SVGAnimatedTransformList.cpp b/content/svg/content/src/SVGAnimatedTransformList.cpp index ce978d76b832..169eb3099173 100644 --- a/content/svg/content/src/SVGAnimatedTransformList.cpp +++ b/content/svg/content/src/SVGAnimatedTransformList.cpp @@ -10,7 +10,7 @@ #include "nsSMILValue.h" #include "prdtoa.h" #include "SVGContentUtils.h" -#include "SVGTransform.h" +#include "nsSVGTransform.h" #include "SVGTransformListSMILType.h" namespace mozilla { diff --git a/content/svg/content/src/SVGTransformList.cpp b/content/svg/content/src/SVGTransformList.cpp index 5bf64a6d0e43..15e928c39a1e 100644 --- a/content/svg/content/src/SVGTransformList.cpp +++ b/content/svg/content/src/SVGTransformList.cpp @@ -41,7 +41,7 @@ SVGTransformList::CopyFrom(const SVGTransformList& rhs) } nsresult -SVGTransformList::CopyFrom(const nsTArray& aTransformArray) +SVGTransformList::CopyFrom(const nsTArray& aTransformArray) { if (!mItems.SetCapacity(aTransformArray.Length())) { // Yes, we do want fallible alloc here diff --git a/content/svg/content/src/SVGTransformList.h b/content/svg/content/src/SVGTransformList.h index 3eac23c3f078..d56945c93499 100644 --- a/content/svg/content/src/SVGTransformList.h +++ b/content/svg/content/src/SVGTransformList.h @@ -10,7 +10,7 @@ #include "gfxMatrix.h" #include "nsDebug.h" #include "nsTArray.h" -#include "SVGTransform.h" +#include "nsSVGTransform.h" namespace mozilla { @@ -47,7 +47,7 @@ public: return mItems.Length(); } - const SVGTransform& operator[](uint32_t aIndex) const { + const nsSVGTransform& operator[](uint32_t aIndex) const { return mItems[aIndex]; } @@ -79,9 +79,9 @@ protected: * which case the list will be left unmodified. */ nsresult CopyFrom(const SVGTransformList& rhs); - nsresult CopyFrom(const nsTArray& aTransformArray); + nsresult CopyFrom(const nsTArray& aTransformArray); - SVGTransform& operator[](uint32_t aIndex) { + nsSVGTransform& operator[](uint32_t aIndex) { return mItems[aIndex]; } @@ -105,14 +105,14 @@ private: mItems.Clear(); } - bool InsertItem(uint32_t aIndex, const SVGTransform& aTransform) { + bool InsertItem(uint32_t aIndex, const nsSVGTransform& aTransform) { if (aIndex >= mItems.Length()) { aIndex = mItems.Length(); } return !!mItems.InsertElementAt(aIndex, aTransform); } - void ReplaceItem(uint32_t aIndex, const SVGTransform& aTransform) { + void ReplaceItem(uint32_t aIndex, const nsSVGTransform& aTransform) { NS_ABORT_IF_FALSE(aIndex < mItems.Length(), "DOM wrapper caller should have raised INDEX_SIZE_ERR"); mItems[aIndex] = aTransform; @@ -124,16 +124,16 @@ private: mItems.RemoveElementAt(aIndex); } - bool AppendItem(const SVGTransform& aTransform) { + bool AppendItem(const nsSVGTransform& aTransform) { return !!mItems.AppendElement(aTransform); } protected: /* - * See SVGLengthList for the rationale for using FallibleTArray - * instead of FallibleTArray. + * See SVGLengthList for the rationale for using FallibleTArray + * instead of FallibleTArray. */ - FallibleTArray mItems; + FallibleTArray mItems; }; } // namespace mozilla diff --git a/content/svg/content/src/SVGTransformListParser.cpp b/content/svg/content/src/SVGTransformListParser.cpp index aeceefe69525..145e2519dc2f 100644 --- a/content/svg/content/src/SVGTransformListParser.cpp +++ b/content/svg/content/src/SVGTransformListParser.cpp @@ -7,7 +7,7 @@ #include "mozilla/Util.h" #include "SVGTransformListParser.h" -#include "SVGTransform.h" +#include "nsSVGTransform.h" #include "nsError.h" #include "nsGkAtoms.h" #include "nsIAtom.h" @@ -209,7 +209,7 @@ SVGTransformListParser::MatchTranslate() // fall-through case 2: { - SVGTransform* transform = mTransforms.AppendElement(); + nsSVGTransform* transform = mTransforms.AppendElement(); NS_ENSURE_TRUE(transform, NS_ERROR_OUT_OF_MEMORY); transform->SetTranslate(t[0], t[1]); break; @@ -238,7 +238,7 @@ SVGTransformListParser::MatchScale() // fall-through case 2: { - SVGTransform* transform = mTransforms.AppendElement(); + nsSVGTransform* transform = mTransforms.AppendElement(); NS_ENSURE_TRUE(transform, NS_ERROR_OUT_OF_MEMORY); transform->SetScale(s[0], s[1]); break; @@ -267,7 +267,7 @@ SVGTransformListParser::MatchRotate() // fall-through case 3: { - SVGTransform* transform = mTransforms.AppendElement(); + nsSVGTransform* transform = mTransforms.AppendElement(); NS_ENSURE_TRUE(transform, NS_ERROR_OUT_OF_MEMORY); transform->SetRotate(r[0], r[1], r[2]); break; @@ -294,7 +294,7 @@ SVGTransformListParser::MatchSkewX() return NS_ERROR_FAILURE; } - SVGTransform* transform = mTransforms.AppendElement(); + nsSVGTransform* transform = mTransforms.AppendElement(); NS_ENSURE_TRUE(transform, NS_ERROR_OUT_OF_MEMORY); transform->SetSkewX(skew); @@ -316,7 +316,7 @@ SVGTransformListParser::MatchSkewY() return NS_ERROR_FAILURE; } - SVGTransform* transform = mTransforms.AppendElement(); + nsSVGTransform* transform = mTransforms.AppendElement(); NS_ENSURE_TRUE(transform, NS_ERROR_OUT_OF_MEMORY); transform->SetSkewY(skew); @@ -338,7 +338,7 @@ SVGTransformListParser::MatchMatrix() return NS_ERROR_FAILURE; } - SVGTransform* transform = mTransforms.AppendElement(); + nsSVGTransform* transform = mTransforms.AppendElement(); NS_ENSURE_TRUE(transform, NS_ERROR_OUT_OF_MEMORY); transform->SetMatrix(gfxMatrix(m[0], m[1], m[2], m[3], m[4], m[5])); diff --git a/content/svg/content/src/SVGTransformListParser.h b/content/svg/content/src/SVGTransformListParser.h index e04f852e367a..0e7c6a2bac11 100644 --- a/content/svg/content/src/SVGTransformListParser.h +++ b/content/svg/content/src/SVGTransformListParser.h @@ -21,17 +21,17 @@ class nsIAtom; namespace mozilla { -class SVGTransform; +class nsSVGTransform; class SVGTransformListParser : public nsSVGDataParser { public: - const nsTArray& GetTransformList() const { + const nsTArray& GetTransformList() const { return mTransforms; } private: - nsTArray mTransforms; + nsTArray mTransforms; // helpers virtual nsresult Match(); diff --git a/content/svg/content/src/SVGTransformListSMILType.cpp b/content/svg/content/src/SVGTransformListSMILType.cpp index 2c6d455ad784..1f191098a04d 100644 --- a/content/svg/content/src/SVGTransformListSMILType.cpp +++ b/content/svg/content/src/SVGTransformListSMILType.cpp @@ -4,8 +4,8 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #include "SVGTransformListSMILType.h" -#include "SVGTransform.h" #include "SVGTransformList.h" +#include "nsSVGTransform.h" #include "nsSMILValue.h" #include "nsCRT.h" #include @@ -351,7 +351,7 @@ SVGTransformListSMILType::AppendTransforms(const SVGTransformList& aList, // static bool SVGTransformListSMILType::GetTransforms(const nsSMILValue& aValue, - FallibleTArray& aTransforms) + FallibleTArray& aTransforms) { NS_PRECONDITION(aValue.mType == &sSingleton, "Unexpected SMIL value type"); diff --git a/content/svg/content/src/SVGTransformListSMILType.h b/content/svg/content/src/SVGTransformListSMILType.h index 5e684c5ae647..7c6f31a33d96 100644 --- a/content/svg/content/src/SVGTransformListSMILType.h +++ b/content/svg/content/src/SVGTransformListSMILType.h @@ -13,7 +13,7 @@ class nsSMILValue; namespace mozilla { -class SVGTransform; +class nsSVGTransform; class SVGTransformList; class SVGTransformSMILData; @@ -25,7 +25,7 @@ class SVGTransformSMILData; // This class is confused somewhat by the fact that: // (i) An element animates an SVGTransformList // (ii) BUT only allows the user to specify animation values -// for an SVGTransform +// for an nsSVGTransform // // This may be rectified in a future edition of SVG but for now it means that // the underlying value of an animation may be something of the form: @@ -111,7 +111,7 @@ public: static bool AppendTransforms(const SVGTransformList& aList, nsSMILValue& aValue); static bool GetTransforms(const nsSMILValue& aValue, - FallibleTArray& aTransforms); + FallibleTArray& aTransforms); private: diff --git a/content/svg/content/src/SVGTransform.cpp b/content/svg/content/src/nsSVGTransform.cpp similarity index 92% rename from content/svg/content/src/SVGTransform.cpp rename to content/svg/content/src/nsSVGTransform.cpp index d1f7dc70507f..8dbdd15a9dd5 100644 --- a/content/svg/content/src/SVGTransform.cpp +++ b/content/svg/content/src/nsSVGTransform.cpp @@ -5,7 +5,7 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #include "nsError.h" -#include "SVGTransform.h" +#include "nsSVGTransform.h" #include "nsContentUtils.h" #include "nsTextFormatter.h" @@ -16,7 +16,7 @@ namespace { namespace mozilla { void -SVGTransform::GetValueAsString(nsAString& aValue) const +nsSVGTransform::GetValueAsString(nsAString& aValue) const { PRUnichar buf[256]; @@ -74,7 +74,7 @@ SVGTransform::GetValueAsString(nsAString& aValue) const } void -SVGTransform::SetMatrix(const gfxMatrix& aMatrix) +nsSVGTransform::SetMatrix(const gfxMatrix& aMatrix) { mType = SVG_TRANSFORM_MATRIX; mMatrix = aMatrix; @@ -86,7 +86,7 @@ SVGTransform::SetMatrix(const gfxMatrix& aMatrix) } void -SVGTransform::SetTranslate(float aTx, float aTy) +nsSVGTransform::SetTranslate(float aTx, float aTy) { mType = SVG_TRANSFORM_TRANSLATE; mMatrix.Reset(); @@ -98,7 +98,7 @@ SVGTransform::SetTranslate(float aTx, float aTy) } void -SVGTransform::SetScale(float aSx, float aSy) +nsSVGTransform::SetScale(float aSx, float aSy) { mType = SVG_TRANSFORM_SCALE; mMatrix.Reset(); @@ -110,7 +110,7 @@ SVGTransform::SetScale(float aSx, float aSy) } void -SVGTransform::SetRotate(float aAngle, float aCx, float aCy) +nsSVGTransform::SetRotate(float aAngle, float aCx, float aCy) { mType = SVG_TRANSFORM_ROTATE; mMatrix.Reset(); @@ -123,7 +123,7 @@ SVGTransform::SetRotate(float aAngle, float aCx, float aCy) } nsresult -SVGTransform::SetSkewX(float aAngle) +nsSVGTransform::SetSkewX(float aAngle) { double ta = tan(aAngle*radPerDegree); NS_ENSURE_FINITE(ta, NS_ERROR_RANGE_ERR); @@ -138,7 +138,7 @@ SVGTransform::SetSkewX(float aAngle) } nsresult -SVGTransform::SetSkewY(float aAngle) +nsSVGTransform::SetSkewY(float aAngle) { double ta = tan(aAngle*radPerDegree); NS_ENSURE_FINITE(ta, NS_ERROR_RANGE_ERR); @@ -152,7 +152,7 @@ SVGTransform::SetSkewY(float aAngle) return NS_OK; } -SVGTransformSMILData::SVGTransformSMILData(const SVGTransform& aTransform) +SVGTransformSMILData::SVGTransformSMILData(const nsSVGTransform& aTransform) : mTransformType(aTransform.Type()) { NS_ABORT_IF_FALSE( @@ -203,10 +203,10 @@ SVGTransformSMILData::SVGTransformSMILData(const SVGTransform& aTransform) } } -SVGTransform +nsSVGTransform SVGTransformSMILData::ToSVGTransform() const { - SVGTransform result; + nsSVGTransform result; switch (mTransformType) { case SVG_TRANSFORM_MATRIX: diff --git a/content/svg/content/src/SVGTransform.h b/content/svg/content/src/nsSVGTransform.h similarity index 93% rename from content/svg/content/src/SVGTransform.h rename to content/svg/content/src/nsSVGTransform.h index f6294a500009..f6708a2a6784 100644 --- a/content/svg/content/src/SVGTransform.h +++ b/content/svg/content/src/nsSVGTransform.h @@ -24,11 +24,11 @@ static const unsigned short SVG_TRANSFORM_SKEWY = 6; /* * The DOM wrapper class for this class is DOMSVGTransformMatrix. */ -class SVGTransform +class nsSVGTransform { public: // Default ctor initialises to matrix type with identity matrix - SVGTransform() + nsSVGTransform() : mMatrix() // Initialises to identity , mAngle(0.f) , mOriginX(0.f) @@ -36,7 +36,7 @@ public: , mType(SVG_TRANSFORM_MATRIX) { } - SVGTransform(const gfxMatrix& aMatrix) + nsSVGTransform(const gfxMatrix& aMatrix) : mMatrix(aMatrix) , mAngle(0.f) , mOriginX(0.f) @@ -44,7 +44,7 @@ public: , mType(SVG_TRANSFORM_MATRIX) { } - bool operator==(const SVGTransform& rhs) const { + bool operator==(const nsSVGTransform& rhs) const { return mType == rhs.mType && MatricesEqual(mMatrix, rhs.mMatrix) && mAngle == rhs.mAngle && @@ -90,7 +90,7 @@ protected: }; /* - * A slightly more light-weight version of SVGTransform for SMIL animation. + * A slightly more light-weight version of nsSVGTransform for SMIL animation. * * Storing the parameters in an array (rather than a matrix) also allows simpler * (transform type-agnostic) interpolation and addition. @@ -148,9 +148,9 @@ public: } } - // Conversion to/from a fully-fledged SVGTransform - SVGTransformSMILData(const SVGTransform& aTransform); - SVGTransform ToSVGTransform() const; + // Conversion to/from a fully-fledged nsSVGTransform + SVGTransformSMILData(const nsSVGTransform& aTransform); + nsSVGTransform ToSVGTransform() const; bool operator==(const SVGTransformSMILData& aOther) const {