Bug 831673, r=bz

This commit is contained in:
David Zbarsky 2013-01-19 15:56:31 -05:00
parent 51481eee40
commit 9f0a9f49ed
3 changed files with 15 additions and 7 deletions

View File

@ -38,6 +38,9 @@ NS_IMPL_CYCLE_COLLECTION_UNLINK_END
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(DOMSVGTransform)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mList)
SVGMatrix* matrix =
sSVGMatrixTearoffTable.GetTearoff(tmp);
CycleCollectionNoteChild(cb, matrix, "matrix");
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_SCRIPT_OBJECTS
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
@ -111,7 +114,11 @@ DOMSVGTransform::DOMSVGTransform(const SVGTransform &aTransform)
DOMSVGTransform::~DOMSVGTransform()
{
sSVGMatrixTearoffTable.RemoveTearoff(this);
SVGMatrix* matrix = sSVGMatrixTearoffTable.GetTearoff(this);
if (matrix) {
sSVGMatrixTearoffTable.RemoveTearoff(this);
NS_RELEASE(matrix);
}
// Our mList's weak ref to us must be nulled out when we die. If GC has
// unlinked us using the cycle collector code, then that has already
// happened, and mList is null.
@ -126,16 +133,16 @@ DOMSVGTransform::Type() const
return Transform().Type();
}
already_AddRefed<SVGMatrix>
SVGMatrix*
DOMSVGTransform::Matrix()
{
nsRefPtr<SVGMatrix> wrapper =
SVGMatrix* wrapper =
sSVGMatrixTearoffTable.GetTearoff(this);
if (!wrapper) {
wrapper = new SVGMatrix(*this);
NS_ADDREF(wrapper = new SVGMatrix(*this));
sSVGMatrixTearoffTable.AddTearoff(this, wrapper);
}
return wrapper.forget();
return wrapper;
}
float

View File

@ -133,7 +133,7 @@ public:
DOMSVGTransformList* GetParentObject() const { return mList; }
virtual JSObject* WrapObject(JSContext* aCx, JSObject* aScope, bool* aTriedToWrap);
uint16_t Type() const;
already_AddRefed<dom::SVGMatrix> Matrix();
dom::SVGMatrix* Matrix();
float Angle() const;
void SetMatrix(dom::SVGMatrix& matrix, ErrorResult& rv);
void SetTranslate(float tx, float ty, ErrorResult& rv);

View File

@ -800,7 +800,8 @@ DOMInterfaces = {
'SVGTransform': {
'nativeType': 'mozilla::DOMSVGTransform',
'headerFile': 'DOMSVGTransform.h'
'headerFile': 'DOMSVGTransform.h',
'resultNotAddRefed': [ 'matrix' ]
},
'SVGTransformableElement': {