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
This commit is contained in:
David Zbarsky 2013-04-02 15:17:41 -04:00
Родитель 0d49bfddd3
Коммит 8a8c63d72c
12 изменённых файлов: 69 добавлений и 69 удалений

Просмотреть файл

@ -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<DOMSVGTransform *>(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;
}

Просмотреть файл

@ -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<SVGTransform> 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<nsSVGTransform> mTransform;
};
nsAttrValue

Просмотреть файл

@ -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 \

Просмотреть файл

@ -10,7 +10,7 @@
#include "nsSMILValue.h"
#include "prdtoa.h"
#include "SVGContentUtils.h"
#include "SVGTransform.h"
#include "nsSVGTransform.h"
#include "SVGTransformListSMILType.h"
namespace mozilla {

Просмотреть файл

@ -41,7 +41,7 @@ SVGTransformList::CopyFrom(const SVGTransformList& rhs)
}
nsresult
SVGTransformList::CopyFrom(const nsTArray<SVGTransform>& aTransformArray)
SVGTransformList::CopyFrom(const nsTArray<nsSVGTransform>& aTransformArray)
{
if (!mItems.SetCapacity(aTransformArray.Length())) {
// Yes, we do want fallible alloc here

Просмотреть файл

@ -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<SVGTransform>& aTransformArray);
nsresult CopyFrom(const nsTArray<nsSVGTransform>& 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<SVGTransform>
* instead of FallibleTArray<SVGTransform, 1>.
* See SVGLengthList for the rationale for using FallibleTArray<nsSVGTransform>
* instead of FallibleTArray<nsSVGTransform, 1>.
*/
FallibleTArray<SVGTransform> mItems;
FallibleTArray<nsSVGTransform> mItems;
};
} // namespace mozilla

Просмотреть файл

@ -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]));

Просмотреть файл

@ -21,17 +21,17 @@ class nsIAtom;
namespace mozilla {
class SVGTransform;
class nsSVGTransform;
class SVGTransformListParser : public nsSVGDataParser
{
public:
const nsTArray<SVGTransform>& GetTransformList() const {
const nsTArray<nsSVGTransform>& GetTransformList() const {
return mTransforms;
}
private:
nsTArray<SVGTransform> mTransforms;
nsTArray<nsSVGTransform> mTransforms;
// helpers
virtual nsresult Match();

Просмотреть файл

@ -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 <math.h>
@ -351,7 +351,7 @@ SVGTransformListSMILType::AppendTransforms(const SVGTransformList& aList,
// static
bool
SVGTransformListSMILType::GetTransforms(const nsSMILValue& aValue,
FallibleTArray<SVGTransform>& aTransforms)
FallibleTArray<nsSVGTransform>& aTransforms)
{
NS_PRECONDITION(aValue.mType == &sSingleton, "Unexpected SMIL value type");

Просмотреть файл

@ -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 <animateTransform> element animates an SVGTransformList
// (ii) BUT <animateTransform> 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<SVGTransform>& aTransforms);
FallibleTArray<nsSVGTransform>& aTransforms);
private:

Просмотреть файл

@ -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:

Просмотреть файл

@ -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
{