Bug 846995 Part 3: Rename DOMSVGAnimatedTransformList and kill nsISupports r=jwatt

--HG--
rename : content/svg/content/src/DOMSVGAnimatedTransformList.cpp => content/svg/content/src/SVGAnimatedTransformList.cpp
rename : content/svg/content/src/DOMSVGAnimatedTransformList.h => content/svg/content/src/SVGAnimatedTransformList.h
This commit is contained in:
David Zbarsky 2013-04-14 18:56:34 -04:00
Родитель a5dffaf138
Коммит eeb5fc7207
13 изменённых файлов: 84 добавлений и 86 удалений

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

@ -31,7 +31,7 @@ class SVGTransform;
* This class is used to create the DOM tearoff objects that wrap internal
* SVGTransformList objects.
*
* See the architecture comment in DOMSVGAnimatedTransformList.h.
* See the architecture comment in SVGAnimatedTransformList.h.
*/
class DOMSVGTransformList MOZ_FINAL : public nsISupports,
public nsWrapperCache
@ -42,7 +42,7 @@ public:
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(DOMSVGTransformList)
DOMSVGTransformList(DOMSVGAnimatedTransformList *aAList,
DOMSVGTransformList(dom::SVGAnimatedTransformList *aAList,
const SVGTransformList &aInternalList)
: mAList(aAList)
{
@ -160,7 +160,7 @@ private:
// of clearing our pointer to them when they die.
FallibleTArray<dom::SVGTransform*> mItems;
nsRefPtr<DOMSVGAnimatedTransformList> mAList;
nsRefPtr<dom::SVGAnimatedTransformList> mAList;
};
} // namespace mozilla

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

@ -3,38 +3,34 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "DOMSVGAnimatedTransformList.h"
#include "mozilla/dom/SVGAnimatedTransformList.h"
#include "DOMSVGTransformList.h"
#include "SVGAnimatedTransformList.h"
#include "nsSVGAnimatedTransformList.h"
#include "nsSVGAttrTearoffTable.h"
#include "mozilla/dom/SVGAnimatedTransformListBinding.h"
#include "nsContentUtils.h"
namespace mozilla {
namespace dom {
static
nsSVGAttrTearoffTable<SVGAnimatedTransformList,DOMSVGAnimatedTransformList>
nsSVGAttrTearoffTable<nsSVGAnimatedTransformList, SVGAnimatedTransformList>
sSVGAnimatedTransformListTearoffTable;
NS_SVG_VAL_IMPL_CYCLE_COLLECTION_WRAPPERCACHED(DOMSVGAnimatedTransformList, mElement)
NS_SVG_VAL_IMPL_CYCLE_COLLECTION_WRAPPERCACHED(SVGAnimatedTransformList, mElement)
NS_IMPL_CYCLE_COLLECTING_ADDREF(DOMSVGAnimatedTransformList)
NS_IMPL_CYCLE_COLLECTING_RELEASE(DOMSVGAnimatedTransformList)
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(DOMSVGAnimatedTransformList)
NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
NS_INTERFACE_MAP_ENTRY(nsISupports)
NS_INTERFACE_MAP_END
NS_IMPL_CYCLE_COLLECTION_ROOT_NATIVE(SVGAnimatedTransformList, AddRef)
NS_IMPL_CYCLE_COLLECTION_UNROOT_NATIVE(SVGAnimatedTransformList, Release)
JSObject*
DOMSVGAnimatedTransformList::WrapObject(JSContext* aCx, JSObject* aScope)
SVGAnimatedTransformList::WrapObject(JSContext* aCx, JSObject* aScope)
{
return mozilla::dom::SVGAnimatedTransformListBinding::Wrap(aCx, aScope, this);
return SVGAnimatedTransformListBinding::Wrap(aCx, aScope, this);
}
//----------------------------------------------------------------------
already_AddRefed<DOMSVGTransformList>
DOMSVGAnimatedTransformList::BaseVal()
SVGAnimatedTransformList::BaseVal()
{
if (!mBaseVal) {
mBaseVal = new DOMSVGTransformList(this, InternalAList().GetBaseValue());
@ -44,7 +40,7 @@ DOMSVGAnimatedTransformList::BaseVal()
}
already_AddRefed<DOMSVGTransformList>
DOMSVGAnimatedTransformList::AnimVal()
SVGAnimatedTransformList::AnimVal()
{
if (!mAnimVal) {
mAnimVal = new DOMSVGTransformList(this, InternalAList().GetAnimValue());
@ -53,27 +49,27 @@ DOMSVGAnimatedTransformList::AnimVal()
return animVal.forget();
}
/* static */ already_AddRefed<DOMSVGAnimatedTransformList>
DOMSVGAnimatedTransformList::GetDOMWrapper(SVGAnimatedTransformList *aList,
nsSVGElement *aElement)
/* static */ already_AddRefed<SVGAnimatedTransformList>
SVGAnimatedTransformList::GetDOMWrapper(nsSVGAnimatedTransformList *aList,
nsSVGElement *aElement)
{
nsRefPtr<DOMSVGAnimatedTransformList> wrapper =
nsRefPtr<SVGAnimatedTransformList> wrapper =
sSVGAnimatedTransformListTearoffTable.GetTearoff(aList);
if (!wrapper) {
wrapper = new DOMSVGAnimatedTransformList(aElement);
wrapper = new SVGAnimatedTransformList(aElement);
sSVGAnimatedTransformListTearoffTable.AddTearoff(aList, wrapper);
}
return wrapper.forget();
}
/* static */ DOMSVGAnimatedTransformList*
DOMSVGAnimatedTransformList::GetDOMWrapperIfExists(
SVGAnimatedTransformList *aList)
/* static */ SVGAnimatedTransformList*
SVGAnimatedTransformList::GetDOMWrapperIfExists(
nsSVGAnimatedTransformList *aList)
{
return sSVGAnimatedTransformListTearoffTable.GetTearoff(aList);
}
DOMSVGAnimatedTransformList::~DOMSVGAnimatedTransformList()
SVGAnimatedTransformList::~SVGAnimatedTransformList()
{
// Script no longer has any references to us, to our base/animVal objects, or
// to any of their list items.
@ -81,7 +77,7 @@ DOMSVGAnimatedTransformList::~DOMSVGAnimatedTransformList()
}
void
DOMSVGAnimatedTransformList::InternalBaseValListWillChangeLengthTo(
SVGAnimatedTransformList::InternalBaseValListWillChangeLengthTo(
uint32_t aNewLength)
{
// When the number of items in our internal counterpart's baseVal changes,
@ -91,7 +87,7 @@ DOMSVGAnimatedTransformList::InternalBaseValListWillChangeLengthTo(
// able to access "items" at indexes that are out of bounds (read/write to
// bad memory)!!
nsRefPtr<DOMSVGAnimatedTransformList> kungFuDeathGrip;
nsRefPtr<SVGAnimatedTransformList> kungFuDeathGrip;
if (mBaseVal) {
if (aNewLength < mBaseVal->LengthNoFlush()) {
// InternalListLengthWillChange might clear last reference to |this|.
@ -112,7 +108,7 @@ DOMSVGAnimatedTransformList::InternalBaseValListWillChangeLengthTo(
}
void
DOMSVGAnimatedTransformList::InternalAnimValListWillChangeLengthTo(
SVGAnimatedTransformList::InternalAnimValListWillChangeLengthTo(
uint32_t aNewLength)
{
if (mAnimVal) {
@ -121,21 +117,22 @@ DOMSVGAnimatedTransformList::InternalAnimValListWillChangeLengthTo(
}
bool
DOMSVGAnimatedTransformList::IsAnimating() const
SVGAnimatedTransformList::IsAnimating() const
{
return InternalAList().IsAnimating();
}
SVGAnimatedTransformList&
DOMSVGAnimatedTransformList::InternalAList()
nsSVGAnimatedTransformList&
SVGAnimatedTransformList::InternalAList()
{
return *mElement->GetAnimatedTransformList();
}
const SVGAnimatedTransformList&
DOMSVGAnimatedTransformList::InternalAList() const
const nsSVGAnimatedTransformList&
SVGAnimatedTransformList::InternalAList() const
{
return *mElement->GetAnimatedTransformList();
}
} // namespace dom
} // namespace mozilla

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

@ -4,8 +4,8 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef MOZILLA_DOMSVGANIMATEDTRANSFORMLIST_H__
#define MOZILLA_DOMSVGANIMATEDTRANSFORMLIST_H__
#ifndef mozilla_dom_SVGAnimatedTransformList_h
#define mozilla_dom_SVGAnimatedTransformList_h
#include "nsAutoPtr.h"
#include "nsCOMPtr.h"
@ -17,13 +17,15 @@
namespace mozilla {
class DOMSVGTransformList;
class SVGAnimatedTransformList;
class nsSVGAnimatedTransformList;
namespace dom {
/**
* Class DOMSVGAnimatedTransformList
* Class SVGAnimatedTransformList
*
* This class is used to create the DOM tearoff objects that wrap internal
* SVGAnimatedTransformList objects.
* nsSVGAnimatedTransformList objects.
*
* See the architecture comment in DOMSVGAnimatedLengthList.h (that's
* LENGTH list). The comment for that class largly applies to this one too
@ -35,36 +37,35 @@ class SVGAnimatedTransformList;
* nulling out our pointers to them when they die (making our pointers to them
* true weak refs).
*/
class DOMSVGAnimatedTransformList MOZ_FINAL : public nsISupports,
public nsWrapperCache
class SVGAnimatedTransformList MOZ_FINAL : public nsWrapperCache
{
friend class DOMSVGTransformList;
friend class mozilla::DOMSVGTransformList;
public:
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(DOMSVGAnimatedTransformList)
NS_INLINE_DECL_CYCLE_COLLECTING_NATIVE_REFCOUNTING(SVGAnimatedTransformList)
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_NATIVE_CLASS(SVGAnimatedTransformList)
/**
* Factory method to create and return a DOMSVGAnimatedTransformList wrapper
* for a given internal SVGAnimatedTransformList object. The factory takes
* Factory method to create and return a SVGAnimatedTransformList wrapper
* for a given internal nsSVGAnimatedTransformList object. The factory takes
* care of caching the object that it returns so that the same object can be
* returned for the given SVGAnimatedTransformList each time it is requested.
* returned for the given nsSVGAnimatedTransformList each time it is requested.
* The cached object is only removed from the cache when it is destroyed due
* to there being no more references to it or to any of its descendant
* objects. If that happens, any subsequent call requesting the DOM wrapper
* for the SVGAnimatedTransformList will naturally result in a new
* DOMSVGAnimatedTransformList being returned.
* for the nsSVGAnimatedTransformList will naturally result in a new
* SVGAnimatedTransformList being returned.
*/
static already_AddRefed<DOMSVGAnimatedTransformList>
GetDOMWrapper(SVGAnimatedTransformList *aList, nsSVGElement *aElement);
static already_AddRefed<SVGAnimatedTransformList>
GetDOMWrapper(nsSVGAnimatedTransformList *aList, nsSVGElement *aElement);
/**
* This method returns the DOMSVGAnimatedTransformList wrapper for an internal
* SVGAnimatedTransformList object if it currently has a wrapper. If it does
* This method returns the SVGAnimatedTransformList wrapper for an internal
* nsSVGAnimatedTransformList object if it currently has a wrapper. If it does
* not, then nullptr is returned.
*/
static DOMSVGAnimatedTransformList*
GetDOMWrapperIfExists(SVGAnimatedTransformList *aList);
static SVGAnimatedTransformList*
GetDOMWrapperIfExists(nsSVGAnimatedTransformList *aList);
/**
* Called by internal code to notify us when we need to sync the length of
@ -100,7 +101,7 @@ private:
* Only our static GetDOMWrapper() factory method may create objects of our
* type.
*/
explicit DOMSVGAnimatedTransformList(nsSVGElement *aElement)
explicit SVGAnimatedTransformList(nsSVGElement *aElement)
: mBaseVal(nullptr)
, mAnimVal(nullptr)
, mElement(aElement)
@ -108,11 +109,11 @@ private:
SetIsDOMBinding();
}
~DOMSVGAnimatedTransformList();
~SVGAnimatedTransformList();
/// Get a reference to this DOM wrapper object's internal counterpart.
SVGAnimatedTransformList& InternalAList();
const SVGAnimatedTransformList& InternalAList() const;
nsSVGAnimatedTransformList& InternalAList();
const nsSVGAnimatedTransformList& InternalAList() const;
// Weak refs to our DOMSVGTransformList baseVal/animVal objects. These objects
// are friends and take care of clearing these pointers when they die, making
@ -125,6 +126,7 @@ private:
nsRefPtr<nsSVGElement> mElement;
};
} // namespace dom
} // namespace mozilla
#endif // MOZILLA_DOMSVGANIMATEDTRANSFORMLIST_H__
#endif // mozilla_dom_SVGAnimatedTransformList_h

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

@ -6,7 +6,7 @@
#include "SVGFragmentIdentifier.h"
#include "mozilla/dom/SVGSVGElement.h"
#include "mozilla/dom/SVGViewElement.h"
#include "SVGAnimatedTransformList.h"
#include "nsSVGAnimatedTransformList.h"
using namespace mozilla;
@ -156,7 +156,7 @@ SVGFragmentIdentifier::ProcessSVGViewSpec(const nsAString &aViewSpec,
}
preserveAspectRatioFound = true;
} else if (IsMatchingParameter(token, NS_LITERAL_STRING("transform"))) {
SVGAnimatedTransformList transforms;
nsSVGAnimatedTransformList transforms;
if (transformFound ||
NS_FAILED(transforms.SetBaseValueString(params))) {
return false;

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

@ -12,7 +12,7 @@
#include "nsSVGElement.h"
#include "nsSVGViewBox.h"
#include "SVGAnimatedPreserveAspectRatio.h"
#include "SVGAnimatedTransformList.h"
#include "nsSVGAnimatedTransformList.h"
class nsSVGPatternFrame;
@ -20,9 +20,8 @@ nsresult NS_NewSVGPatternElement(nsIContent **aResult,
already_AddRefed<nsINodeInfo> aNodeInfo);
namespace mozilla {
class DOMSVGAnimatedTransformList;
namespace dom {
class SVGAnimatedTransformList;
typedef nsSVGElement SVGPatternElementBase;
@ -47,7 +46,7 @@ public:
// nsSVGSVGElement methods:
virtual bool HasValidDimensions() const;
virtual mozilla::SVGAnimatedTransformList*
virtual mozilla::nsSVGAnimatedTransformList*
GetAnimatedTransformList(uint32_t aFlags = 0);
virtual nsIAtom* GetTransformListAttrName() const {
return nsGkAtoms::patternTransform;
@ -58,7 +57,7 @@ public:
already_AddRefed<DOMSVGAnimatedPreserveAspectRatio> PreserveAspectRatio();
already_AddRefed<nsIDOMSVGAnimatedEnumeration> PatternUnits();
already_AddRefed<nsIDOMSVGAnimatedEnumeration> PatternContentUnits();
already_AddRefed<DOMSVGAnimatedTransformList> PatternTransform();
already_AddRefed<SVGAnimatedTransformList> PatternTransform();
already_AddRefed<SVGAnimatedLength> X();
already_AddRefed<SVGAnimatedLength> Y();
already_AddRefed<SVGAnimatedLength> Width();
@ -81,7 +80,7 @@ protected:
nsSVGEnum mEnumAttributes[2];
static EnumInfo sEnumInfo[2];
nsAutoPtr<mozilla::SVGAnimatedTransformList> mPatternTransform;
nsAutoPtr<mozilla::nsSVGAnimatedTransformList> mPatternTransform;
enum { HREF };
nsSVGString mStringAttributes[1];

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

@ -740,7 +740,7 @@ DOMInterfaces = {
},
'SVGAnimatedTransformList': {
# 'nativeOwnership': 'refcounted',
'nativeOwnership': 'refcounted',
},
'SVGAnimationElement': {

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

@ -10,7 +10,7 @@
#include "nsSVGEffects.h"
#include "nsSVGElement.h"
#include "nsSVGUtils.h"
#include "SVGAnimatedTransformList.h"
#include "nsSVGAnimatedTransformList.h"
using namespace mozilla;
@ -179,7 +179,7 @@ nsSVGDisplayContainerFrame::IsSVGTransformed(gfxMatrix *aOwnTransform,
if (mContent->IsSVG()) {
nsSVGElement *content = static_cast<nsSVGElement*>(mContent);
SVGAnimatedTransformList* transformList =
nsSVGAnimatedTransformList* transformList =
content->GetAnimatedTransformList();
if ((transformList && transformList->HasTransform()) ||
content->GetAnimateMotionTransform()) {

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

@ -192,7 +192,7 @@ nsSVGForeignObjectFrame::IsSVGTransformed(gfxMatrix *aOwnTransform,
}
nsSVGElement *content = static_cast<nsSVGElement*>(mContent);
SVGAnimatedTransformList* transformList =
nsSVGAnimatedTransformList* transformList =
content->GetAnimatedTransformList();
if (transformList && transformList->HasTransform()) {
if (aOwnTransform) {

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

@ -14,7 +14,7 @@
#include "nsContentUtils.h"
#include "nsIDOMSVGAnimatedNumber.h"
#include "nsSVGEffects.h"
#include "SVGAnimatedTransformList.h"
#include "nsSVGAnimatedTransformList.h"
// XXX Tight coupling with content classes ahead!
@ -157,10 +157,10 @@ nsSVGGradientFrame::GetSpreadMethod()
return GetEnumValue(dom::SVGGradientElement::SPREADMETHOD);
}
const SVGAnimatedTransformList*
const nsSVGAnimatedTransformList*
nsSVGGradientFrame::GetGradientTransformList(nsIContent* aDefault)
{
SVGAnimatedTransformList *thisTransformList =
nsSVGAnimatedTransformList *thisTransformList =
static_cast<dom::SVGGradientElement*>(mContent)->GetAnimatedTransformList();
if (thisTransformList && thisTransformList->IsExplicitlySet())
@ -201,7 +201,7 @@ nsSVGGradientFrame::GetGradientTransform(nsIFrame *aSource,
gfxMatrix(bbox.Width(), 0, 0, bbox.Height(), bbox.X(), bbox.Y());
}
const SVGAnimatedTransformList* animTransformList =
const nsSVGAnimatedTransformList* animTransformList =
GetGradientTransformList(mContent);
if (!animTransformList)
return bboxMatrix;

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

@ -22,7 +22,7 @@ class nsStyleContext;
struct gfxRect;
namespace mozilla {
class SVGAnimatedTransformList;
class nsSVGAnimatedTransformList;
namespace dom {
class SVGLinearGradientElement;
@ -79,7 +79,7 @@ private:
void GetStopInformation(int32_t aIndex,
float *aOffset, nscolor *aColor, float *aStopOpacity);
const mozilla::SVGAnimatedTransformList* GetGradientTransformList(
const mozilla::nsSVGAnimatedTransformList* GetGradientTransformList(
nsIContent* aDefault);
// Will be singular for gradientUnits="objectBoundingBox" with an empty bbox.
gfxMatrix GetGradientTransform(nsIFrame *aSource,

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

@ -152,7 +152,7 @@ nsSVGPathGeometryFrame::IsSVGTransformed(gfxMatrix *aOwnTransform,
}
nsSVGElement *content = static_cast<nsSVGElement*>(mContent);
SVGAnimatedTransformList* transformList =
nsSVGAnimatedTransformList* transformList =
content->GetAnimatedTransformList();
if ((transformList && transformList->HasTransform()) ||
content->GetAnimateMotionTransform()) {

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

@ -20,7 +20,7 @@
#include "nsSVGGeometryFrame.h"
#include "mozilla/dom/SVGPatternElement.h"
#include "nsSVGUtils.h"
#include "SVGAnimatedTransformList.h"
#include "nsSVGAnimatedTransformList.h"
#include "SVGContentUtils.h"
using namespace mozilla;
@ -443,10 +443,10 @@ nsSVGPatternFrame::GetEnumValue(uint32_t aIndex, nsIContent *aDefault)
mEnumAttributes[aIndex].GetAnimValue();
}
SVGAnimatedTransformList*
nsSVGAnimatedTransformList*
nsSVGPatternFrame::GetPatternTransformList(nsIContent* aDefault)
{
SVGAnimatedTransformList *thisTransformList =
nsSVGAnimatedTransformList *thisTransformList =
static_cast<SVGPatternElement *>(mContent)->GetAnimatedTransformList();
if (thisTransformList && thisTransformList->IsExplicitlySet())
@ -462,7 +462,7 @@ nsSVGPatternFrame::GetPatternTransformList(nsIContent* aDefault)
gfxMatrix
nsSVGPatternFrame::GetPatternTransform()
{
SVGAnimatedTransformList* animTransformList =
nsSVGAnimatedTransformList* animTransformList =
GetPatternTransformList(mContent);
if (!animTransformList)
return gfxMatrix();

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

@ -18,7 +18,7 @@ class nsSVGViewBox;
namespace mozilla {
class SVGAnimatedPreserveAspectRatio;
class SVGAnimatedTransformList;
class nsSVGAnimatedTransformList;
} // namespace mozilla
typedef nsSVGPaintServerFrame nsSVGPatternFrameBase;
@ -90,7 +90,7 @@ protected:
{
return GetEnumValue(aIndex, mContent);
}
mozilla::SVGAnimatedTransformList* GetPatternTransformList(
mozilla::nsSVGAnimatedTransformList* GetPatternTransformList(
nsIContent* aDefault);
gfxMatrix GetPatternTransform();
const nsSVGViewBox &GetViewBox(nsIContent *aDefault);