Bug 602759 part 10 - Update SVG elements to use new SVG transform types; r=longsonr, r=jwatt
authorBrian Birtles <birtles@gmail.com>
Sun, 25 Sep 2011 22:04:31 +0100
changeset 78865 b8fcaa2794f3280d3d9bef13cee477470cf19acf
parent 78864 e23063321ceefa8a2065a479807c7d6b54435b53
child 78866 ec7fb3b6bbaf032e45f0052a9ed6918cf46d23c0
push id78
push userclegnitto@mozilla.com
push dateFri, 16 Dec 2011 17:32:24 +0000
treeherdermozilla-release@79d24e644fdd [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerslongsonr, jwatt
bugs602759
milestone9.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 602759 part 10 - Update SVG elements to use new SVG transform types; r=longsonr, r=jwatt
content/svg/content/src/nsSVGElement.cpp
content/svg/content/src/nsSVGElement.h
content/svg/content/src/nsSVGForeignObjectElement.cpp
content/svg/content/src/nsSVGGradientElement.cpp
content/svg/content/src/nsSVGGradientElement.h
content/svg/content/src/nsSVGGraphicElement.cpp
content/svg/content/src/nsSVGGraphicElement.h
content/svg/content/src/nsSVGMarkerElement.cpp
content/svg/content/src/nsSVGMarkerElement.h
content/svg/content/src/nsSVGPatternElement.cpp
content/svg/content/src/nsSVGPatternElement.h
content/svg/content/src/nsSVGSVGElement.cpp
--- a/content/svg/content/src/nsSVGElement.cpp
+++ b/content/svg/content/src/nsSVGElement.cpp
@@ -74,34 +74,25 @@
 #include "nsSVGEnum.h"
 #include "nsSVGViewBox.h"
 #include "nsSVGString.h"
 #include "nsSVGClass.h"
 #include "SVGAnimatedNumberList.h"
 #include "SVGAnimatedLengthList.h"
 #include "SVGAnimatedPointList.h"
 #include "SVGAnimatedPathSegList.h"
+#include "SVGAnimatedTransformList.h"
 #include "nsIDOMSVGUnitTypes.h"
-#include "nsIDOMSVGPointList.h"
-#include "nsIDOMSVGAnimatedPoints.h"
-#include "nsIDOMSVGTransformList.h"
-#include "nsIDOMSVGAnimTransformList.h"
-#include "nsIDOMSVGAnimatedRect.h"
-#include "nsIDOMSVGGradientElement.h"
-#include "nsIDOMSVGPatternElement.h"
 #include "nsSVGRect.h"
 #include "nsIFrame.h"
 #include "prdtoa.h"
 #include <stdarg.h>
 #ifdef MOZ_SMIL
 #include "nsSMILMappedAttribute.h"
-#include "nsSVGTransformSMILAttr.h"
-#include "nsSVGAnimatedTransformList.h"
 #include "SVGMotionSMILAttr.h"
-#include "nsIDOMSVGTransformable.h"
 #endif // MOZ_SMIL
 
 using namespace mozilla;
 
 // This is needed to ensure correct handling of calls to the
 // vararg-list methods in this file:
 //   nsSVGElement::GetAnimated{Length,Number,Integer}Values
 // See bug 547964 for details:
@@ -347,17 +338,16 @@ nsSVGElement::ParseAttribute(PRInt32 aNa
       nsCOMPtr<nsISVGValue> proxy;
       nsresult rv =
         NS_CreateSVGStringProxyValue(svg_value, getter_AddRefs(proxy));
       // Failure means we'll store this attr as a string, not an SVGValue, but
       // that's the best we can do short of throwing outright.
       NS_ENSURE_SUCCESS(rv, PR_FALSE);
 
       svg_value->RemoveObserver(this);
-      ResetOldStyleBaseType(svg_value);
       proxy->SetValueString(aValue);
       proxy->AddObserver(this);
       aResult.SetTo(proxy);
     }
     else {
       aResult.SetTo(svg_value);
     }
     mSuppressNotification = PR_FALSE;
@@ -569,16 +559,26 @@ nsSVGElement::ParseAttribute(PRInt32 aNa
           GetPreserveAspectRatio();
         if (preserveAspectRatio) {
           rv = preserveAspectRatio->SetBaseValueString(aValue, this, PR_FALSE);
           if (NS_FAILED(rv)) {
             preserveAspectRatio->Init();
           }
           foundMatch = PR_TRUE;
         }
+      // Check for SVGAnimatedTransformList attribute
+      } else if (GetTransformListAttrName() == aAttribute) {
+        SVGAnimatedTransformList *transformList = GetAnimatedTransformList();
+        if (transformList) {
+          rv = transformList->SetBaseValueString(aValue);
+          if (NS_FAILED(rv)) {
+            transformList->ClearBaseValue();
+          }
+          foundMatch = PR_TRUE;
+        }
       // Check for class attribute
       } else if (aAttribute == nsGkAtoms::_class) {
         nsSVGClass *svgClass = GetClass();
         if (svgClass) {
           svgClass->SetBaseValue(aValue, this, PR_FALSE);
           aResult.ParseAtomArray(aValue);
           return PR_TRUE;
         }
@@ -778,16 +778,27 @@ nsSVGElement::UnsetAttr(PRInt32 aNamespa
         GetPreserveAspectRatio();
 
       if (preserveAspectRatio) {
         preserveAspectRatio->Init();
         DidChangePreserveAspectRatio(PR_FALSE);
         return rv;
       }
     }
+
+    // Check if this is a transform list attribute going away
+    if (GetTransformListAttrName() == aName) {
+      SVGAnimatedTransformList *transformList = GetAnimatedTransformList();
+      if (transformList) {
+        transformList->ClearBaseValue();
+        DidChangeTransformList(PR_FALSE);
+        return rv;
+      }
+    }
+
     // Check if this is a class attribute going away
     if (aName == nsGkAtoms::_class) {
       nsSVGClass *svgClass = GetClass();
 
       if (svgClass) {
         svgClass->Init();
         return rv;
       }
@@ -801,39 +812,19 @@ nsSVGElement::UnsetAttr(PRInt32 aNamespa
     if (aNamespaceID == stringInfo.mStringInfo[i].mNamespaceID &&
         aName == *stringInfo.mStringInfo[i].mName) {
       stringInfo.Reset(i);
       DidChangeString(i);
       return rv;
     }
   }
 
-  // Now check for one of the old style basetypes going away
-  nsCOMPtr<nsISVGValue> svg_value = GetMappedAttribute(aNamespaceID, aName);
-
-  if (svg_value) {
-    mSuppressNotification = PR_TRUE;
-    ResetOldStyleBaseType(svg_value);
-    mSuppressNotification = PR_FALSE;
-  }
-
   return rv;
 }
 
-void
-nsSVGElement::ResetOldStyleBaseType(nsISVGValue *svg_value)
-{
-  nsCOMPtr<nsIDOMSVGAnimatedTransformList> tl = do_QueryInterface(svg_value);
-  if (tl) {
-    nsCOMPtr<nsIDOMSVGTransformList> transform;
-    tl->GetBaseVal(getter_AddRefs(transform));
-    transform->Clear();
-  }
-}
-
 nsChangeHint
 nsSVGElement::GetAttributeChangeHint(const nsIAtom* aAttribute,
                                      PRInt32 aModType) const
 {
   nsChangeHint retval =
     nsSVGElementBase::GetAttributeChangeHint(aAttribute, aModType);
 
   if (aAttribute == nsGkAtoms::requiredFeatures ||
@@ -2216,23 +2207,44 @@ nsSVGElement::DidAnimatePreserveAspectRa
   if (frame) {
     frame->AttributeChanged(kNameSpaceID_None,
                             nsGkAtoms::preserveAspectRatio,
                             nsIDOMMutationEvent::MODIFICATION);
   }
 }
 
 void
-nsSVGElement::DidAnimateTransform()
+nsSVGElement::DidChangeTransformList(PRBool aDoSetAttr)
 {
+  if (!aDoSetAttr)
+    return;
+
+  SVGAnimatedTransformList* transformList = GetAnimatedTransformList();
+  NS_ABORT_IF_FALSE(transformList,
+                    "DidChangeTransformList on element with no transform list");
+
+  nsAutoString serializedValue;
+  transformList->GetBaseValue().GetValueAsString(serializedValue);
+
+  nsAttrValue attrValue(serializedValue);
+  SetParsedAttr(kNameSpaceID_None, GetTransformListAttrName(), nsnull,
+                attrValue, PR_TRUE);
+}
+
+void
+nsSVGElement::DidAnimateTransformList()
+{
+  NS_ABORT_IF_FALSE(GetTransformListAttrName(),
+                    "Animating non-existent transform data?");
+
   nsIFrame* frame = GetPrimaryFrame();
-  
+
   if (frame) {
     frame->AttributeChanged(kNameSpaceID_None,
-                            nsGkAtoms::transform,
+                            GetTransformListAttrName(),
                             nsIDOMMutationEvent::MODIFICATION);
   }
 }
 
 nsSVGElement::StringAttributesInfo
 nsSVGElement::GetStringInfo()
 {
   return StringAttributesInfo(nsnull, nsnull, 0);
@@ -2336,46 +2348,19 @@ nsSVGElement::RecompileScriptEventListen
 }
 
 #ifdef MOZ_SMIL
 nsISMILAttr*
 nsSVGElement::GetAnimatedAttr(PRInt32 aNamespaceID, nsIAtom* aName)
 {
   if (aNamespaceID == kNameSpaceID_None) {
     // Transforms:
-    nsCOMPtr<nsIDOMSVGAnimatedTransformList> transformList;
-    if (aName == nsGkAtoms::transform) {
-      nsCOMPtr<nsIDOMSVGTransformable> transformable(do_QueryObject(this));
-      if (!transformable)
-        return nsnull;
-      nsresult rv = transformable->GetTransform(getter_AddRefs(transformList));
-      NS_ENSURE_SUCCESS(rv, nsnull);
-    }
-    if (aName == nsGkAtoms::gradientTransform) {
-      nsCOMPtr<nsIDOMSVGGradientElement> gradientElement(do_QueryObject(this));
-      if (!gradientElement)
-        return nsnull;
-
-      nsresult rv = gradientElement->GetGradientTransform(getter_AddRefs(transformList));
-      NS_ENSURE_SUCCESS(rv, nsnull);
-    }
-    if (aName == nsGkAtoms::patternTransform) {
-      nsCOMPtr<nsIDOMSVGPatternElement> patternElement(do_QueryObject(this));
-      if (!patternElement)
-        return nsnull;
-
-      nsresult rv = patternElement->GetPatternTransform(getter_AddRefs(transformList));
-      NS_ENSURE_SUCCESS(rv, nsnull);
-    }
-    if (transformList) {
-      nsSVGAnimatedTransformList* list
-        = static_cast<nsSVGAnimatedTransformList*>(transformList.get());
-      NS_ENSURE_TRUE(list, nsnull);
-
-      return new nsSVGTransformSMILAttr(list, this);
+    if (GetTransformListAttrName() == aName) {
+      SVGAnimatedTransformList* transformList = GetAnimatedTransformList();
+      return transformList ?  transformList->ToSMILAttr(this) : nsnull;
     }
 
     // Motion (fake 'attribute' for animateMotion)
     if (aName == nsGkAtoms::mozAnimateMotionDummyAttr) {
       return new SVGMotionSMILAttr(this);
     }
 
     // Lengths:
--- a/content/svg/content/src/nsSVGElement.h
+++ b/content/svg/content/src/nsSVGElement.h
@@ -75,16 +75,17 @@ struct gfxMatrix;
 namespace mozilla {
 class SVGAnimatedNumberList;
 class SVGNumberList;
 class SVGAnimatedLengthList;
 class SVGUserUnitList;
 class SVGAnimatedPointList;
 class SVGAnimatedPathSegList;
 class SVGAnimatedPreserveAspectRatio;
+class SVGAnimatedTransformList;
 }
 
 typedef nsStyledElementNotElementCSSInlineStyle nsSVGElementBase;
 
 class nsSVGElement : public nsSVGElementBase,    // nsIContent
                      public nsISVGValueObserver  // :nsISupportsWeakReference
 {
 protected:
@@ -95,16 +96,17 @@ protected:
 public:
   typedef mozilla::SVGNumberList SVGNumberList;
   typedef mozilla::SVGAnimatedNumberList SVGAnimatedNumberList;
   typedef mozilla::SVGUserUnitList SVGUserUnitList;
   typedef mozilla::SVGAnimatedLengthList SVGAnimatedLengthList;
   typedef mozilla::SVGAnimatedPointList SVGAnimatedPointList;
   typedef mozilla::SVGAnimatedPathSegList SVGAnimatedPathSegList;
   typedef mozilla::SVGAnimatedPreserveAspectRatio SVGAnimatedPreserveAspectRatio;
+  typedef mozilla::SVGAnimatedTransformList SVGAnimatedTransformList;
 
   // nsISupports
   NS_DECL_ISUPPORTS_INHERITED
 
   // nsIContent interface methods
 
   virtual nsresult BindToTree(nsIDocument* aDocument, nsIContent* aParent,
                               nsIContent* aBindingParent,
@@ -183,33 +185,34 @@ public:
   virtual void DidChangeBoolean(PRUint8 aAttrEnum, PRBool aDoSetAttr);
   virtual void DidChangeEnum(PRUint8 aAttrEnum, PRBool aDoSetAttr);
   virtual void DidChangeViewBox(PRBool aDoSetAttr);
   virtual void DidChangePreserveAspectRatio(PRBool aDoSetAttr);
   virtual void DidChangeNumberList(PRUint8 aAttrEnum, PRBool aDoSetAttr);
   virtual void DidChangeLengthList(PRUint8 aAttrEnum, PRBool aDoSetAttr);
   virtual void DidChangePointList(PRBool aDoSetAttr);
   virtual void DidChangePathSegList(PRBool aDoSetAttr);
+  virtual void DidChangeTransformList(PRBool aDoSetAttr);
   virtual void DidChangeString(PRUint8 aAttrEnum) {}
 
   virtual void DidAnimateLength(PRUint8 aAttrEnum);
   virtual void DidAnimateNumber(PRUint8 aAttrEnum);
   virtual void DidAnimateNumberPair(PRUint8 aAttrEnum);
   virtual void DidAnimateInteger(PRUint8 aAttrEnum);
   virtual void DidAnimateIntegerPair(PRUint8 aAttrEnum);
   virtual void DidAnimateAngle(PRUint8 aAttrEnum);
   virtual void DidAnimateBoolean(PRUint8 aAttrEnum);
   virtual void DidAnimateEnum(PRUint8 aAttrEnum);
   virtual void DidAnimateViewBox();
   virtual void DidAnimatePreserveAspectRatio();
   virtual void DidAnimateNumberList(PRUint8 aAttrEnum);
   virtual void DidAnimateLengthList(PRUint8 aAttrEnum);
   virtual void DidAnimatePointList();
   virtual void DidAnimatePathSegList();
-  virtual void DidAnimateTransform();
+  virtual void DidAnimateTransformList();
   virtual void DidAnimateString(PRUint8 aAttrEnum);
   virtual void DidAnimateClass();
 
   void GetAnimatedLengthValues(float *aFirst, ...);
   void GetAnimatedNumberValues(float *aFirst, ...);
   void GetAnimatedIntegerValues(PRInt32 *aFirst, ...);
   SVGAnimatedNumberList* GetAnimatedNumberList(PRUint8 aAttrEnum);
   SVGAnimatedNumberList* GetAnimatedNumberList(nsIAtom *aAttrName);
@@ -220,16 +223,21 @@ public:
   }
   virtual SVGAnimatedPathSegList* GetAnimPathSegList() {
     // DOM interface 'SVGAnimatedPathData' (*inherited* by nsSVGPathElement)
     // has a member called 'animatedPathSegList' member, so we have a shorter
     // name so we don't get hidden by the GetAnimatedPathSegList declared by
     // NS_DECL_NSIDOMSVGANIMATEDPATHDATA.
     return nsnull;
   }
+  // Despite the fact that animated transform lists are used for a variety of
+  // attributes, no SVG element uses more than one.
+  virtual SVGAnimatedTransformList* GetAnimatedTransformList() {
+    return nsnull;
+  }
 
 #ifdef MOZ_SMIL
   virtual nsISMILAttr* GetAnimatedAttr(PRInt32 aNamespaceID, nsIAtom* aName);
   void AnimationNeedsResample();
   void FlushAnimations();
 #else
   void AnimationNeedsResample() { /* do nothing */ }
   void FlushAnimations() { /* do nothing */ }
@@ -241,16 +249,19 @@ public:
   void SetStringBaseValue(PRUint8 aAttrEnum, const nsAString& aValue);
 
   virtual nsIAtom* GetPointListAttrName() const {
     return nsnull;
   }
   virtual nsIAtom* GetPathDataAttrName() const {
     return nsnull;
   }
+  virtual nsIAtom* GetTransformListAttrName() const {
+    return nsnull;
+  }
 
 protected:
   virtual nsresult AfterSetAttr(PRInt32 aNamespaceID, nsIAtom* aName,
                                 const nsAString* aValue, PRBool aNotify);
   virtual PRBool ParseAttribute(PRInt32 aNamespaceID, nsIAtom* aAttribute,
                                 const nsAString& aValue, nsAttrValue& aResult);
   static nsresult ReportAttributeParseFailure(nsIDocument* aDocument,
                                               nsIAtom* aAttribute,
@@ -519,18 +530,16 @@ protected:
   virtual NumberListAttributesInfo GetNumberListInfo();
   virtual LengthListAttributesInfo GetLengthListInfo();
   virtual StringAttributesInfo GetStringInfo();
   virtual nsSVGClass *GetClass();
 
   static nsSVGEnumMapping sSVGUnitTypesMap[];
 
 private:
-  void ResetOldStyleBaseType(nsISVGValue *svg_value);
-
   struct ObservableModificationData {
     // Only to be used if |name| is non-null.  Otherwise, modType will
     // be 0 to indicate NS_OK should be returned and 1 to indicate
     // NS_ERROR_UNEXPECTED should be returned.
     ObservableModificationData(const nsAttrName* aName, PRUint32 aModType):
       name(aName), modType(aModType)
     {}
     const nsAttrName* name;
--- a/content/svg/content/src/nsSVGForeignObjectElement.cpp
+++ b/content/svg/content/src/nsSVGForeignObjectElement.cpp
@@ -33,17 +33,16 @@
  * and other provisions required by the GPL or the LGPL. If you do not delete
  * the provisions above, a recipient may use your version of this file under
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 
 #include "nsCOMPtr.h"
 #include "nsSVGForeignObjectElement.h"
-#include "nsSVGMatrix.h"
 
 nsSVGElement::LengthInfo nsSVGForeignObjectElement::sLengthInfo[4] =
 {
   { &nsGkAtoms::x, 0, nsIDOMSVGLength::SVG_LENGTHTYPE_NUMBER, nsSVGUtils::X },
   { &nsGkAtoms::y, 0, nsIDOMSVGLength::SVG_LENGTHTYPE_NUMBER, nsSVGUtils::Y },
   { &nsGkAtoms::width, 0, nsIDOMSVGLength::SVG_LENGTHTYPE_NUMBER, nsSVGUtils::X },
   { &nsGkAtoms::height, 0, nsIDOMSVGLength::SVG_LENGTHTYPE_NUMBER, nsSVGUtils::Y },
 };
--- a/content/svg/content/src/nsSVGGradientElement.cpp
+++ b/content/svg/content/src/nsSVGGradientElement.cpp
@@ -31,28 +31,29 @@
  * use your version of this file under the terms of the MPL, indicate your
  * decision by deleting the provisions above and replace them with the notice
  * and other provisions required by the GPL or the LGPL. If you do not delete
  * the provisions above, a recipient may use your version of this file under
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 
-#include "nsSVGTransformList.h"
-#include "nsSVGAnimatedTransformList.h"
+#include "DOMSVGAnimatedTransformList.h"
 #include "nsIDOMSVGAnimatedEnum.h"
 #include "nsIDOMSVGURIReference.h"
 #include "nsIDOMSVGGradientElement.h"
 #include "nsIDOMMutationEvent.h"
 #include "nsCOMPtr.h"
 #include "nsSVGStylableElement.h"
 #include "nsGkAtoms.h"
 #include "nsSVGGradientElement.h"
 #include "nsIFrame.h"
 
+using namespace mozilla;
+
 //--------------------- Gradients------------------------
 
 nsSVGEnumMapping nsSVGGradientElement::sSpreadMethodMap[] = {
   {&nsGkAtoms::pad, nsIDOMSVGGradientElement::SVG_SPREADMETHOD_PAD},
   {&nsGkAtoms::reflect, nsIDOMSVGGradientElement::SVG_SPREADMETHOD_REFLECT},
   {&nsGkAtoms::repeat, nsIDOMSVGGradientElement::SVG_SPREADMETHOD_REPEAT},
   {nsnull, 0}
 };
@@ -89,65 +90,32 @@ NS_INTERFACE_MAP_END_INHERITING(nsSVGGra
 // Implementation
 
 nsSVGGradientElement::nsSVGGradientElement(already_AddRefed<nsINodeInfo> aNodeInfo)
   : nsSVGGradientElementBase(aNodeInfo)
 {
 }
 
 nsresult
-nsSVGGradientElement::CreateTransformList()
-{
-  nsresult rv;
-
-  // DOM property: transform, #IMPLIED attrib: transform
-  nsCOMPtr<nsIDOMSVGTransformList> transformList;
-  rv = nsSVGTransformList::Create(getter_AddRefs(transformList));
-  NS_ENSURE_SUCCESS(rv, rv);
-  rv = NS_NewSVGAnimatedTransformList(getter_AddRefs(mGradientTransform),
-                                      transformList);
-  NS_ENSURE_SUCCESS(rv, rv);
-  rv = AddMappedSVGValue(nsGkAtoms::gradientTransform, mGradientTransform);
-  if (NS_FAILED(rv)) {
-    mGradientTransform = nsnull;
-    return rv;
-  }
-
-  return NS_OK;
-}
-
-nsresult
 nsSVGGradientElement::BeforeSetAttr(PRInt32 aNamespaceID, nsIAtom* aName,
                                     const nsAString* aValue, PRBool aNotify)
 {
   if (aNamespaceID == kNameSpaceID_None &&
       aName == nsGkAtoms::gradientTransform &&
       !mGradientTransform &&
-      NS_FAILED(CreateTransformList()))
+      !(mGradientTransform = new SVGAnimatedTransformList()))
     return NS_ERROR_OUT_OF_MEMORY;
 
   return nsSVGGradientElementBase::BeforeSetAttr(aNamespaceID, aName,
                                                  aValue, aNotify);
 }
 
 //----------------------------------------------------------------------
 // nsSVGElement methods
 
-void
-nsSVGGradientElement::DidAnimateTransform()
-{
-  nsIFrame* frame = GetPrimaryFrame();
-  
-  if (frame) {
-    frame->AttributeChanged(kNameSpaceID_None,
-                            nsGkAtoms::gradientTransform,
-                            nsIDOMMutationEvent::MODIFICATION);
-  }
-}
-
 nsSVGElement::EnumAttributesInfo
 nsSVGGradientElement::GetEnumInfo()
 {
   return EnumAttributesInfo(mEnumAttributes, sEnumInfo,
                             NS_ARRAY_LENGTH(sEnumInfo));
 }
 
 nsSVGElement::StringAttributesInfo
@@ -164,21 +132,19 @@ nsSVGGradientElement::GetStringInfo()
 NS_IMETHODIMP nsSVGGradientElement::GetGradientUnits(nsIDOMSVGAnimatedEnumeration * *aGradientUnits)
 {
   return mEnumAttributes[GRADIENTUNITS].ToDOMAnimatedEnum(aGradientUnits, this);
 }
 
 /* readonly attribute nsIDOMSVGAnimatedTransformList gradientTransform; */
 NS_IMETHODIMP nsSVGGradientElement::GetGradientTransform(nsIDOMSVGAnimatedTransformList * *aGradientTransform)
 {
-  if (!mGradientTransform && NS_FAILED(CreateTransformList()))
-    return NS_ERROR_OUT_OF_MEMORY;
-
-  *aGradientTransform = mGradientTransform;
-  NS_IF_ADDREF(*aGradientTransform);
+  *aGradientTransform =
+    DOMSVGAnimatedTransformList::GetDOMWrapper(GetAnimatedTransformList(), this)
+    .get();
   return NS_OK;
 }
 
 /* readonly attribute nsIDOMSVGAnimatedEnumeration spreadMethod; */
 NS_IMETHODIMP nsSVGGradientElement::GetSpreadMethod(nsIDOMSVGAnimatedEnumeration * *aSpreadMethod)
 {
   return mEnumAttributes[SPREADMETHOD].ToDOMAnimatedEnum(aSpreadMethod, this);
 }
@@ -275,16 +241,25 @@ NS_IMETHODIMP nsSVGLinearGradientElement
 {
   return mLengthAttributes[Y2].ToDOMAnimatedLength(aY2, this);
 }
 
 
 //----------------------------------------------------------------------
 // nsSVGElement methods
 
+SVGAnimatedTransformList*
+nsSVGGradientElement::GetAnimatedTransformList()
+{
+  if (!mGradientTransform) {
+    mGradientTransform = new SVGAnimatedTransformList();
+  }
+  return mGradientTransform;
+}
+
 nsSVGElement::LengthAttributesInfo
 nsSVGLinearGradientElement::GetLengthInfo()
 {
   return LengthAttributesInfo(mLengthAttributes, sLengthInfo,
                               NS_ARRAY_LENGTH(sLengthInfo));
 }
 
 //-------------------------- Radial Gradients ----------------------------
--- a/content/svg/content/src/nsSVGGradientElement.h
+++ b/content/svg/content/src/nsSVGGradientElement.h
@@ -41,16 +41,17 @@
 
 #include "nsIDOMSVGURIReference.h"
 #include "nsIDOMSVGGradientElement.h"
 #include "nsIDOMSVGUnitTypes.h"
 #include "nsSVGStylableElement.h"
 #include "nsSVGLength2.h"
 #include "nsSVGEnum.h"
 #include "nsSVGString.h"
+#include "SVGAnimatedTransformList.h"
 
 //--------------------- Gradients------------------------
 
 typedef nsSVGStylableElement nsSVGGradientElementBase;
 
 class nsSVGGradientElement : public nsSVGGradientElementBase,
                              public nsIDOMSVGURIReference,
                              public nsIDOMSVGUnitTypes
@@ -68,39 +69,39 @@ public:
   NS_DECL_NSIDOMSVGGRADIENTELEMENT
 
   // URI Reference
   NS_DECL_NSIDOMSVGURIREFERENCE
 
   // nsIContent
   NS_IMETHOD_(PRBool) IsAttributeMapped(const nsIAtom* aAttribute) const;
 
+  virtual mozilla::SVGAnimatedTransformList* GetAnimatedTransformList();
+  virtual nsIAtom* GetTransformListAttrName() const {
+    return nsGkAtoms::gradientTransform;
+  }
+
 protected:
   virtual EnumAttributesInfo GetEnumInfo();
   virtual StringAttributesInfo GetStringInfo();
 
-  virtual void DidAnimateTransform();
-
   enum { GRADIENTUNITS, SPREADMETHOD };
   nsSVGEnum mEnumAttributes[2];
   static nsSVGEnumMapping sSpreadMethodMap[];
   static EnumInfo sEnumInfo[2];
 
   enum { HREF };
   nsSVGString mStringAttributes[1];
   static StringInfo sStringInfo[1];
 
   virtual nsresult BeforeSetAttr(PRInt32 aNamespaceID, nsIAtom* aName,
                                  const nsAString* aValue, PRBool aNotify);
 
   // nsIDOMSVGGradientElement values
-  nsCOMPtr<nsIDOMSVGAnimatedTransformList> mGradientTransform;
-
-  // helper
-  nsresult CreateTransformList();
+  nsAutoPtr<mozilla::SVGAnimatedTransformList> mGradientTransform;
 };
 
 //---------------------Linear Gradients------------------------
 
 typedef nsSVGGradientElement nsSVGLinearGradientElementBase;
 
 class nsSVGLinearGradientElement : public nsSVGLinearGradientElementBase,
                                    public nsIDOMSVGLinearGradientElement
--- a/content/svg/content/src/nsSVGGraphicElement.cpp
+++ b/content/svg/content/src/nsSVGGraphicElement.cpp
@@ -34,29 +34,30 @@
  * and other provisions required by the GPL or the LGPL. If you do not delete
  * the provisions above, a recipient may use your version of this file under
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 
 #include "nsSVGGraphicElement.h"
 #include "nsSVGSVGElement.h"
-#include "nsSVGTransformList.h"
-#include "nsSVGAnimatedTransformList.h"
+#include "DOMSVGAnimatedTransformList.h"
+#include "DOMSVGMatrix.h"
 #include "nsGkAtoms.h"
-#include "nsSVGMatrix.h"
 #include "nsIDOMEventTarget.h"
 #include "nsIFrame.h"
 #include "nsISVGChildFrame.h"
 #include "nsIDOMSVGPoint.h"
 #include "nsSVGUtils.h"
 #include "nsDOMError.h"
 #include "nsSVGRect.h"
 #include "nsContentUtils.h"
 
+using namespace mozilla;
+
 //----------------------------------------------------------------------
 // nsISupports methods
 
 NS_IMPL_ADDREF_INHERITED(nsSVGGraphicElement, nsSVGGraphicElementBase)
 NS_IMPL_RELEASE_INHERITED(nsSVGGraphicElement, nsSVGGraphicElementBase)
 
 NS_INTERFACE_MAP_BEGIN(nsSVGGraphicElement)
   NS_INTERFACE_MAP_ENTRY(nsIDOMSVGLocatable)
@@ -104,25 +105,27 @@ NS_IMETHODIMP nsSVGGraphicElement::GetBB
   }
   return NS_ERROR_FAILURE;
 }
 
 /* nsIDOMSVGMatrix getCTM (); */
 NS_IMETHODIMP nsSVGGraphicElement::GetCTM(nsIDOMSVGMatrix * *aCTM)
 {
   gfxMatrix m = nsSVGUtils::GetCTM(this, PR_FALSE);
-  *aCTM = m.IsSingular() ? nsnull : NS_NewSVGMatrix(m).get();
+  *aCTM = m.IsSingular() ? nsnull : new DOMSVGMatrix(m);
+  NS_IF_ADDREF(*aCTM);
   return NS_OK;
 }
 
 /* nsIDOMSVGMatrix getScreenCTM (); */
 NS_IMETHODIMP nsSVGGraphicElement::GetScreenCTM(nsIDOMSVGMatrix * *aCTM)
 {
   gfxMatrix m = nsSVGUtils::GetCTM(this, PR_TRUE);
-  *aCTM = m.IsSingular() ? nsnull : NS_NewSVGMatrix(m).get();
+  *aCTM = m.IsSingular() ? nsnull : new DOMSVGMatrix(m);
+  NS_IF_ADDREF(*aCTM);
   return NS_OK;
 }
 
 /* nsIDOMSVGMatrix getTransformToElement (in nsIDOMSVGElement element); */
 NS_IMETHODIMP nsSVGGraphicElement::GetTransformToElement(nsIDOMSVGElement *element, nsIDOMSVGMatrix **_retval)
 {
   if (!element)
     return NS_ERROR_DOM_SVG_WRONG_TYPE_ERR;
@@ -144,23 +147,22 @@ NS_IMETHODIMP nsSVGGraphicElement::GetTr
   if (NS_FAILED(rv)) return rv;
   return tmp->Multiply(ourScreenCTM, _retval);  // addrefs, so we don't
 }
 
 //----------------------------------------------------------------------
 // nsIDOMSVGTransformable methods
 /* readonly attribute nsIDOMSVGAnimatedTransformList transform; */
 
-NS_IMETHODIMP nsSVGGraphicElement::GetTransform(nsIDOMSVGAnimatedTransformList * *aTransform)
+NS_IMETHODIMP nsSVGGraphicElement::GetTransform(
+    nsIDOMSVGAnimatedTransformList **aTransform)
 {
-  if (!mTransforms && NS_FAILED(CreateTransformList()))
-    return NS_ERROR_OUT_OF_MEMORY;
-      
-  *aTransform = mTransforms;
-  NS_ADDREF(*aTransform);
+  *aTransform =
+    DOMSVGAnimatedTransformList::GetDOMWrapper(GetAnimatedTransformList(), this)
+    .get();
   return NS_OK;
 }
 
 //----------------------------------------------------------------------
 // nsIContent methods
 
 NS_IMETHODIMP_(PRBool)
 nsSVGGraphicElement::IsAttributeMapped(const nsIAtom* name) const
@@ -192,65 +194,43 @@ nsSVGGraphicElement::PrependLocalTransfo
   // animateMotion's resulting transform is supposed to apply *on top of*
   // any transformations from the |transform| attribute. So since we're
   // PRE-multiplying, we need to apply the animateMotion transform *first*.
   if (mAnimateMotionTransform) {
     result.PreMultiply(*mAnimateMotionTransform);
   }
 
   if (mTransforms) {
-    nsresult rv;
-    nsCOMPtr<nsIDOMSVGTransformList> transforms;
-    rv = mTransforms->GetAnimVal(getter_AddRefs(transforms));
-    NS_ENSURE_SUCCESS(rv, aMatrix);
-    PRUint32 count;
-    transforms->GetNumberOfItems(&count);
-    if (count > 0) {
-      nsCOMPtr<nsIDOMSVGMatrix> matrix =
-        nsSVGTransformList::GetConsolidationMatrix(transforms);
-      result.PreMultiply(nsSVGUtils::ConvertSVGMatrixToThebes(matrix));
-    }
+    result.PreMultiply(mTransforms->GetAnimValue().GetConsolidationMatrix());
   }
 
   return result;
 }
 
 void
 nsSVGGraphicElement::SetAnimateMotionTransform(const gfxMatrix* aMatrix)
 {
   mAnimateMotionTransform = aMatrix ? new gfxMatrix(*aMatrix) : nsnull;
-  DidAnimateTransform();
+  DidAnimateTransformList();
+}
+
+SVGAnimatedTransformList*
+nsSVGGraphicElement::GetAnimatedTransformList()
+{
+  if (!mTransforms) {
+    mTransforms = new SVGAnimatedTransformList();
+  }
+  return mTransforms;
 }
 
 nsresult
 nsSVGGraphicElement::BeforeSetAttr(PRInt32 aNamespaceID, nsIAtom* aName,
                                    const nsAString* aValue, PRBool aNotify)
 {
   if (aNamespaceID == kNameSpaceID_None &&
       aName == nsGkAtoms::transform &&
       !mTransforms &&
-      NS_FAILED(CreateTransformList()))
+      !(mTransforms = new SVGAnimatedTransformList()))
     return NS_ERROR_OUT_OF_MEMORY;
 
   return nsSVGGraphicElementBase::BeforeSetAttr(aNamespaceID, aName,
                                                 aValue, aNotify);
 }
-
-nsresult
-nsSVGGraphicElement::CreateTransformList()
-{
-  nsresult rv;
-
-  // DOM property: transform, #IMPLIED attrib: transform
-  nsCOMPtr<nsIDOMSVGTransformList> transformList;
-  rv = nsSVGTransformList::Create(getter_AddRefs(transformList));
-  NS_ENSURE_SUCCESS(rv, rv);
-  rv = NS_NewSVGAnimatedTransformList(getter_AddRefs(mTransforms),
-                                      transformList);
-  NS_ENSURE_SUCCESS(rv, rv);
-  rv = AddMappedSVGValue(nsGkAtoms::transform, mTransforms);
-  if (NS_FAILED(rv)) {
-    mTransforms = nsnull;
-    return rv;
-  }
-
-  return NS_OK;
-}
--- a/content/svg/content/src/nsSVGGraphicElement.h
+++ b/content/svg/content/src/nsSVGGraphicElement.h
@@ -37,17 +37,17 @@
  * ***** END LICENSE BLOCK ***** */
 
 #ifndef __NS_SVGGRAPHICELEMENT_H__
 #define __NS_SVGGRAPHICELEMENT_H__
 
 #include "nsSVGStylableElement.h"
 #include "nsIDOMSVGLocatable.h"
 #include "nsIDOMSVGTransformable.h"
-#include "nsIDOMSVGAnimTransformList.h"
+#include "SVGAnimatedTransformList.h"
 #include "gfxMatrix.h"
 
 typedef nsSVGStylableElement nsSVGGraphicElementBase;
 
 class nsSVGGraphicElement : public nsSVGGraphicElementBase,
                             public nsIDOMSVGTransformable // : nsIDOMSVGLocatable
 {
 protected:
@@ -60,25 +60,27 @@ public:
   NS_DECL_NSIDOMSVGTRANSFORMABLE
 
   // nsIContent interface
   NS_IMETHOD_(PRBool) IsAttributeMapped(const nsIAtom* aAttribute) const;
 
   virtual gfxMatrix PrependLocalTransformTo(const gfxMatrix &aMatrix) const;
   virtual void SetAnimateMotionTransform(const gfxMatrix* aMatrix);
 
+  virtual mozilla::SVGAnimatedTransformList* GetAnimatedTransformList();
+  virtual nsIAtom* GetTransformListAttrName() const {
+    return nsGkAtoms::transform;
+  }
+
 protected:
   // nsSVGElement overrides
   virtual PRBool IsEventName(nsIAtom* aName);
   
   virtual nsresult BeforeSetAttr(PRInt32 aNamespaceID, nsIAtom* aName,
                                  const nsAString* aValue, PRBool aNotify);
 
-  nsCOMPtr<nsIDOMSVGAnimatedTransformList> mTransforms;
+  nsAutoPtr<mozilla::SVGAnimatedTransformList> mTransforms;
 
   // XXX maybe move this to property table, to save space on un-animated elems?
   nsAutoPtr<gfxMatrix> mAnimateMotionTransform;
-
-  // helper
-  nsresult CreateTransformList();
 };
 
 #endif // __NS_SVGGRAPHICELEMENT_H__
--- a/content/svg/content/src/nsSVGMarkerElement.cpp
+++ b/content/svg/content/src/nsSVGMarkerElement.cpp
@@ -33,17 +33,16 @@
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 
 #include "nsGkAtoms.h"
 #include "nsCOMPtr.h"
 #include "nsISVGValueUtils.h"
 #include "SVGAnimatedPreserveAspectRatio.h"
-#include "nsSVGMatrix.h"
 #include "nsDOMError.h"
 #include "nsSVGUtils.h"
 #include "nsSVGMarkerElement.h"
 #include "gfxMatrix.h"
 #include "nsContentUtils.h" // NS_ENSURE_FINITE
 
 using namespace mozilla;
 
@@ -393,15 +392,15 @@ nsSVGMarkerElement::GetViewBoxTransform(
 
     float refX = mLengthAttributes[REFX].GetAnimValue(mCoordCtx);
     float refY = mLengthAttributes[REFY].GetAnimValue(mCoordCtx);
 
     gfxPoint ref = viewBoxTM.Transform(gfxPoint(refX, refY));
 
     gfxMatrix TM = viewBoxTM * gfxMatrix().Translate(gfxPoint(-ref.x, -ref.y));
 
-    mViewBoxToViewportTransform = NS_NewSVGMatrix(TM);
+    mViewBoxToViewportTransform = new gfxMatrix(TM);
   }
 
-  return nsSVGUtils::ConvertSVGMatrixToThebes(mViewBoxToViewportTransform);
+  return *mViewBoxToViewportTransform;
 }
 
 
--- a/content/svg/content/src/nsSVGMarkerElement.h
+++ b/content/svg/content/src/nsSVGMarkerElement.h
@@ -40,16 +40,17 @@
 #include "nsSVGGraphicElement.h"
 #include "nsIDOMSVGMarkerElement.h"
 #include "nsIDOMSVGFitToViewBox.h"
 #include "nsSVGLength2.h"
 #include "nsSVGEnum.h"
 #include "nsSVGAngle.h"
 #include "nsSVGViewBox.h"
 #include "SVGAnimatedPreserveAspectRatio.h"
+#include "gfxMatrix.h"
 
 class nsSVGOrientType
 {
 public:
   nsSVGOrientType()
    : mAnimVal(nsIDOMSVGMarkerElement::SVG_MARKER_ORIENT_ANGLE),
      mBaseVal(nsIDOMSVGMarkerElement::SVG_MARKER_ORIENT_ANGLE) {}
 
@@ -172,12 +173,12 @@ protected:
 
   nsSVGViewBox             mViewBox;
   SVGAnimatedPreserveAspectRatio mPreserveAspectRatio;
 
   // derived properties (from 'orient') handled separately
   nsSVGOrientType                        mOrientType;
 
   nsSVGSVGElement                       *mCoordCtx;
-  nsCOMPtr<nsIDOMSVGMatrix>         mViewBoxToViewportTransform;
+  nsAutoPtr<gfxMatrix>                   mViewBoxToViewportTransform;
 };
 
 #endif
--- a/content/svg/content/src/nsSVGPatternElement.cpp
+++ b/content/svg/content/src/nsSVGPatternElement.cpp
@@ -31,18 +31,17 @@
  * use your version of this file under the terms of the MPL, indicate your
  * decision by deleting the provisions above and replace them with the notice
  * and other provisions required by the GPL or the LGPL. If you do not delete
  * the provisions above, a recipient may use your version of this file under
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 
-#include "nsSVGTransformList.h"
-#include "nsSVGAnimatedTransformList.h"
+#include "DOMSVGAnimatedTransformList.h"
 #include "nsIDOMMutationEvent.h"
 #include "nsCOMPtr.h"
 #include "nsGkAtoms.h"
 #include "nsSVGPatternElement.h"
 #include "nsIFrame.h"
 
 using namespace mozilla;
 
@@ -95,44 +94,23 @@ NS_INTERFACE_MAP_END_INHERITING(nsSVGPat
 // Implementation
 
 nsSVGPatternElement::nsSVGPatternElement(already_AddRefed<nsINodeInfo> aNodeInfo)
   : nsSVGPatternElementBase(aNodeInfo)
 {
 }
 
 nsresult
-nsSVGPatternElement::CreateTransformList()
-{
-  nsresult rv;
-
-  // DOM property: transform, #IMPLIED attrib: transform
-  nsCOMPtr<nsIDOMSVGTransformList> transformList;
-  rv = nsSVGTransformList::Create(getter_AddRefs(transformList));
-  NS_ENSURE_SUCCESS(rv, rv);
-  rv = NS_NewSVGAnimatedTransformList(getter_AddRefs(mPatternTransform),
-                                      transformList);
-  NS_ENSURE_SUCCESS(rv, rv);
-  rv = AddMappedSVGValue(nsGkAtoms::patternTransform, mPatternTransform);
-  if (NS_FAILED(rv)) {
-    mPatternTransform = nsnull;
-    return rv;
-  }
-
-  return NS_OK;
-}
-
-nsresult
 nsSVGPatternElement::BeforeSetAttr(PRInt32 aNamespaceID, nsIAtom* aName,
                                    const nsAString* aValue, PRBool aNotify)
 {
   if (aNamespaceID == kNameSpaceID_None &&
       aName == nsGkAtoms::patternTransform &&
       !mPatternTransform &&
-      NS_FAILED(CreateTransformList()))
+      !(mPatternTransform = new SVGAnimatedTransformList()))
     return NS_ERROR_OUT_OF_MEMORY;
 
   return nsSVGPatternElementBase::BeforeSetAttr(aNamespaceID, aName,
                                                 aValue, aNotify);
 }
 
 //----------------------------------------------------------------------
 // nsIDOMNode method
@@ -169,21 +147,19 @@ NS_IMETHODIMP nsSVGPatternElement::GetPa
 NS_IMETHODIMP nsSVGPatternElement::GetPatternContentUnits(nsIDOMSVGAnimatedEnumeration * *aPatternUnits)
 {
   return mEnumAttributes[PATTERNCONTENTUNITS].ToDOMAnimatedEnum(aPatternUnits, this);
 }
 
 /* readonly attribute nsIDOMSVGAnimatedTransformList patternTransform; */
 NS_IMETHODIMP nsSVGPatternElement::GetPatternTransform(nsIDOMSVGAnimatedTransformList * *aPatternTransform)
 {
-  if (!mPatternTransform && NS_FAILED(CreateTransformList()))
-    return NS_ERROR_OUT_OF_MEMORY;
-
-  *aPatternTransform = mPatternTransform;
-  NS_IF_ADDREF(*aPatternTransform);
+  *aPatternTransform =
+    DOMSVGAnimatedTransformList::GetDOMWrapper(GetAnimatedTransformList(), this)
+    .get();
   return NS_OK;
 }
 
 /* readonly attribute nsIDOMSVGAnimatedLength x; */
 NS_IMETHODIMP nsSVGPatternElement::GetX(nsIDOMSVGAnimatedLength * *aX)
 {
   return mLengthAttributes[X].ToDOMAnimatedLength(aX, this);
 }
@@ -236,26 +212,23 @@ nsSVGPatternElement::IsAttributeMapped(c
 
   return FindAttributeDependence(name, map, NS_ARRAY_LENGTH(map)) ||
     nsSVGPatternElementBase::IsAttributeMapped(name);
 }
 
 //----------------------------------------------------------------------
 // nsSVGElement methods
 
-void
-nsSVGPatternElement::DidAnimateTransform()
+SVGAnimatedTransformList*
+nsSVGPatternElement::GetAnimatedTransformList()
 {
-  nsIFrame* frame = GetPrimaryFrame();
-  
-  if (frame) {
-    frame->AttributeChanged(kNameSpaceID_None,
-                            nsGkAtoms::patternTransform,
-                            nsIDOMMutationEvent::MODIFICATION);
+  if (!mPatternTransform) {
+    mPatternTransform = new SVGAnimatedTransformList();
   }
+  return mPatternTransform;
 }
 
 nsSVGElement::LengthAttributesInfo
 nsSVGPatternElement::GetLengthInfo()
 {
   return LengthAttributesInfo(mLengthAttributes, sLengthInfo,
                               NS_ARRAY_LENGTH(sLengthInfo));
 }
--- a/content/svg/content/src/nsSVGPatternElement.h
+++ b/content/svg/content/src/nsSVGPatternElement.h
@@ -44,16 +44,17 @@
 #include "nsIDOMSVGFitToViewBox.h"
 #include "nsIDOMSVGPatternElement.h"
 #include "nsIDOMSVGUnitTypes.h"
 #include "nsSVGLength2.h"
 #include "nsSVGEnum.h"
 #include "nsSVGString.h"
 #include "nsSVGViewBox.h"
 #include "SVGAnimatedPreserveAspectRatio.h"
+#include "SVGAnimatedTransformList.h"
 
 //--------------------- Patterns ------------------------
 
 typedef nsSVGStylableElement nsSVGPatternElementBase;
 
 class nsSVGPatternElement : public nsSVGPatternElementBase,
                             public nsIDOMSVGURIReference,
                             public nsIDOMSVGFitToViewBox,
@@ -87,46 +88,46 @@ public:
   NS_FORWARD_NSIDOMSVGELEMENT(nsSVGElement::)
 
   // nsIContent interface
   NS_IMETHOD_(PRBool) IsAttributeMapped(const nsIAtom* name) const;
 
   virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const;
 
   virtual nsXPCClassInfo* GetClassInfo();
+
+  virtual mozilla::SVGAnimatedTransformList* GetAnimatedTransformList();
+  virtual nsIAtom* GetTransformListAttrName() const {
+    return nsGkAtoms::patternTransform;
+  }
 protected:
 
   virtual nsresult BeforeSetAttr(PRInt32 aNamespaceID, nsIAtom* aName,
                                  const nsAString* aValue, PRBool aNotify);
 
   virtual LengthAttributesInfo GetLengthInfo();
   virtual EnumAttributesInfo GetEnumInfo();
   virtual nsSVGViewBox *GetViewBox();
   virtual SVGAnimatedPreserveAspectRatio *GetPreserveAspectRatio();
   virtual StringAttributesInfo GetStringInfo();
 
-  virtual void DidAnimateTransform();
-
   // nsIDOMSVGPatternElement values
   enum { X, Y, WIDTH, HEIGHT };
   nsSVGLength2 mLengthAttributes[4];
   static LengthInfo sLengthInfo[4];
 
   enum { PATTERNUNITS, PATTERNCONTENTUNITS };
   nsSVGEnum mEnumAttributes[2];
   static EnumInfo sEnumInfo[2];
 
-  nsCOMPtr<nsIDOMSVGAnimatedTransformList> mPatternTransform;
+  nsAutoPtr<mozilla::SVGAnimatedTransformList> mPatternTransform;
 
   // nsIDOMSVGURIReference properties
   enum { HREF };
   nsSVGString mStringAttributes[1];
   static StringInfo sStringInfo[1];
 
   // nsIDOMSVGFitToViewbox properties
   nsSVGViewBox mViewBox;
   SVGAnimatedPreserveAspectRatio mPreserveAspectRatio;
-
-  // helper
-  nsresult CreateTransformList();
 };
 
 #endif
--- a/content/svg/content/src/nsSVGSVGElement.cpp
+++ b/content/svg/content/src/nsSVGSVGElement.cpp
@@ -42,19 +42,18 @@
 #include "DOMSVGNumber.h"
 #include "DOMSVGLength.h"
 #include "nsSVGAngle.h"
 #include "nsCOMPtr.h"
 #include "nsIPresShell.h"
 #include "nsContentUtils.h"
 #include "nsIDocument.h"
 #include "nsPresContext.h"
-#include "nsSVGMatrix.h"
+#include "DOMSVGMatrix.h"
 #include "DOMSVGPoint.h"
-#include "nsSVGTransform.h"
 #include "nsIDOMEventTarget.h"
 #include "nsIFrame.h"
 #include "nsISVGSVGFrame.h" //XXX
 #include "nsSVGRect.h"
 #include "nsISVGValueUtils.h"
 #include "nsDOMError.h"
 #include "nsISVGChildFrame.h"
 #include "nsGUIEvent.h"
@@ -644,45 +643,46 @@ nsSVGSVGElement::CreateSVGPoint(nsIDOMSV
   NS_ADDREF(*_retval = new DOMSVGPoint(0, 0));
   return NS_OK;
 }
 
 /* nsIDOMSVGMatrix createSVGMatrix (); */
 NS_IMETHODIMP
 nsSVGSVGElement::CreateSVGMatrix(nsIDOMSVGMatrix **_retval)
 {
-  return NS_NewSVGMatrix(_retval);
+  NS_ADDREF(*_retval = new DOMSVGMatrix());
+  return NS_OK;
 }
 
 /* nsIDOMSVGRect createSVGRect (); */
 NS_IMETHODIMP
 nsSVGSVGElement::CreateSVGRect(nsIDOMSVGRect **_retval)
 {
   return NS_NewSVGRect(_retval);
 }
 
 /* nsIDOMSVGTransform createSVGTransform (); */
 NS_IMETHODIMP
 nsSVGSVGElement::CreateSVGTransform(nsIDOMSVGTransform **_retval)
 {
-  return NS_NewSVGTransform(_retval);
+  NS_ADDREF(*_retval = new DOMSVGTransform());
+  return NS_OK;
 }
 
 /* nsIDOMSVGTransform createSVGTransformFromMatrix (in nsIDOMSVGMatrix matrix); */
 NS_IMETHODIMP
 nsSVGSVGElement::CreateSVGTransformFromMatrix(nsIDOMSVGMatrix *matrix, 
                                               nsIDOMSVGTransform **_retval)
 {
-  NS_ENSURE_NATIVE_MATRIX(matrix, _retval);
+  nsCOMPtr<DOMSVGMatrix> domItem = do_QueryInterface(matrix);
+  if (!domItem) {
+    return NS_ERROR_DOM_SVG_WRONG_TYPE_ERR;
+  }
 
-  nsresult rv = NS_NewSVGTransform(_retval);
-  if (NS_FAILED(rv))
-    return rv;
-
-  (*_retval)->SetMatrix(matrix);
+  NS_ADDREF(*_retval = new DOMSVGTransform(domItem->Matrix()));
   return NS_OK;
 }
 
 /* nsIDOMElement getElementById (in DOMString elementId); */
 NS_IMETHODIMP
 nsSVGSVGElement::GetElementById(const nsAString & elementId, nsIDOMElement **_retval)
 {
   return NS_ERROR_NOT_IMPLEMENTED;
@@ -743,26 +743,28 @@ nsSVGSVGElement::GetBBox(nsIDOMSVGRect *
   return NS_ERROR_NOT_IMPLEMENTED; // XXX: outer svg
 }
 
 /* nsIDOMSVGMatrix getCTM (); */
 NS_IMETHODIMP
 nsSVGSVGElement::GetCTM(nsIDOMSVGMatrix * *aCTM)
 {
   gfxMatrix m = nsSVGUtils::GetCTM(this, PR_FALSE);
-  *aCTM = m.IsSingular() ? nsnull : NS_NewSVGMatrix(m).get();
+  *aCTM = m.IsSingular() ? nsnull : new DOMSVGMatrix(m);
+  NS_IF_ADDREF(*aCTM);
   return NS_OK;
 }
 
 /* nsIDOMSVGMatrix getScreenCTM (); */
 NS_IMETHODIMP
 nsSVGSVGElement::GetScreenCTM(nsIDOMSVGMatrix **aCTM)
 {
   gfxMatrix m = nsSVGUtils::GetCTM(this, PR_TRUE);
-  *aCTM = m.IsSingular() ? nsnull : NS_NewSVGMatrix(m).get();
+  *aCTM = m.IsSingular() ? nsnull : new DOMSVGMatrix(m);
+  NS_IF_ADDREF(*aCTM);
   return NS_OK;
 }
 
 /* nsIDOMSVGMatrix getTransformToElement (in nsIDOMSVGElement element); */
 NS_IMETHODIMP
 nsSVGSVGElement::GetTransformToElement(nsIDOMSVGElement *element,
                                        nsIDOMSVGMatrix **_retval)
 {