Bug 485157: SMIL event timing, part 4 refactor nsIContent usage to use mozilla::dom::Element instead, r=dholbert, sr=roc, a=roc
authorBrian Birtles <birtles@gmail.com>
Wed, 18 Aug 2010 19:20:24 +0900
changeset 50805 31a2747a096b
parent 50804 26e34fda3938
child 50806 fd27d7619098
push id15162
push userbbirtles@mozilla.com
push date2010-08-18 10:24 +0000
treeherdermozilla-central@ca457b5758e0 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdholbert, roc, roc
bugs485157
milestone2.0b5pre
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 485157: SMIL event timing, part 4 refactor nsIContent usage to use mozilla::dom::Element instead, r=dholbert, sr=roc, a=roc
content/smil/nsISMILAnimationElement.h
content/smil/nsSMILAnimationFunction.cpp
content/smil/nsSMILTimeValueSpec.cpp
content/smil/nsSMILTimeValueSpec.h
content/smil/nsSMILTimedElement.cpp
content/smil/nsSMILTimedElement.h
content/svg/content/src/SVGMotionSMILAnimationFunction.cpp
content/svg/content/src/nsSVGAnimationElement.cpp
content/svg/content/src/nsSVGAnimationElement.h
--- a/content/smil/nsISMILAnimationElement.h
+++ b/content/smil/nsISMILAnimationElement.h
@@ -48,17 +48,16 @@
 #define NS_ISMILANIMATIONELEMENT_IID \
 { 0x5c891601, 0x47aa, 0x4230,        \
   { 0xb8, 0xdc, 0xb9, 0x26, 0xd1, 0xe7, 0xd7, 0xf4 } }
 
 class nsISMILAttr;
 class nsSMILAnimationFunction;
 class nsSMILTimeContainer;
 class nsSMILTimedElement;
-class nsIContent;
 class nsIAtom;
 class nsAttrValue;
 
 namespace mozilla {
 namespace dom {
 class Element;
 } // namespace dom
 } // namespace mozilla
@@ -70,24 +69,24 @@ enum nsSMILTargetAttrType {
 };
 
 class nsISMILAnimationElement : public nsISupports
 {
 public:
   NS_DECLARE_STATIC_IID_ACCESSOR(NS_ISMILANIMATIONELEMENT_IID)
 
   /*
-   * Returns this element as nsIContent.
+   * Returns this element as a mozilla::dom::Element.
    */
-  virtual const nsIContent& Content() const = 0;
+  virtual const mozilla::dom::Element& AsElement() const = 0;
 
   /*
-   * Non-const version of Content()
+   * Non-const version of Element()
    */
-  virtual nsIContent& Content() = 0;
+  virtual mozilla::dom::Element& AsElement() = 0;
 
   /*
    * Returns the source attribute as an nsAttrValue. The global namespace will
    * be used.
    *
    * (The 'Anim' here and below is largely to avoid conflicts for subclasses
    * that derive from nsGenericElement)
    *
--- a/content/smil/nsSMILAnimationFunction.cpp
+++ b/content/smil/nsSMILAnimationFunction.cpp
@@ -319,18 +319,18 @@ nsSMILAnimationFunction::CompareTo(const
     aOther->mAnimationElement->TimedElement();
   if (thisTimedElement.IsTimeDependent(otherTimedElement))
     return 1;
   if (otherTimedElement.IsTimeDependent(thisTimedElement))
     return -1;
 
   // Animations that appear later in the document sort after those earlier in
   // the document
-  nsIContent& thisContent = mAnimationElement->Content();
-  nsIContent& otherContent = aOther->mAnimationElement->Content();
+  nsIContent& thisContent = mAnimationElement->AsElement();
+  nsIContent& otherContent = aOther->mAnimationElement->AsElement();
 
   NS_ABORT_IF_FALSE(&thisContent != &otherContent,
       "Two animations cannot have the same animation content element!");
 
   return (nsContentUtils::PositionIsBefore(&thisContent, &otherContent))
           ? -1 : 1;
 }
 
--- a/content/smil/nsSMILTimeValueSpec.cpp
+++ b/content/smil/nsSMILTimeValueSpec.cpp
@@ -44,16 +44,18 @@
 #include "nsSMILParserUtils.h"
 #include "nsISMILAnimationElement.h"
 #include "nsContentUtils.h"
 #include "nsIEventListenerManager.h"
 #include "nsIDOMEventGroup.h"
 #include "nsGUIEvent.h"
 #include "nsString.h"
 
+using namespace mozilla::dom;
+
 //----------------------------------------------------------------------
 // Nested class: EventListener
 
 NS_IMPL_ISUPPORTS1(nsSMILTimeValueSpec::EventListener, nsIDOMEventListener)
 
 NS_IMETHODIMP
 nsSMILTimeValueSpec::EventListener::HandleEvent(nsIDOMEvent* aEvent)
 {
@@ -90,17 +92,17 @@ nsSMILTimeValueSpec::~nsSMILTimeValueSpe
   if (mEventListener) {
     mEventListener->Disconnect();
     mEventListener = nsnull;
   }
 }
 
 nsresult
 nsSMILTimeValueSpec::SetSpec(const nsAString& aStringSpec,
-                             nsIContent* aContextNode)
+                             Element* aContextNode)
 {
   nsSMILTimeValueSpecParams params;
   nsresult rv =
     nsSMILParserUtils::ParseTimeValueSpecParams(aStringSpec, params);
 
   if (NS_FAILED(rv))
     return rv;
 
@@ -130,27 +132,27 @@ nsSMILTimeValueSpec::ResolveReferences(n
   NS_ABORT_IF_FALSE(aContextNode,
       "null context node for resolving timing references against");
 
   // If we're not bound to the document yet, don't worry, we'll get called again
   // when that happens
   if (!aContextNode->IsInDoc())
     return;
 
-  // Hold ref to the old content so that it isn't destroyed in between resetting
+  // Hold ref to the old element so that it isn't destroyed in between resetting
   // the referenced element and using the pointer to update the referenced
   // element.
-  nsRefPtr<nsIContent> oldReferencedContent = mReferencedElement.get();
+  nsRefPtr<Element> oldReferencedElement = mReferencedElement.get();
 
   // XXX Support default event targets
   NS_ABORT_IF_FALSE(mParams.mDependentElemID, "NULL dependent element id");
   nsString idStr;
   mParams.mDependentElemID->ToString(idStr);
   mReferencedElement.ResetWithID(aContextNode, idStr);
-  UpdateReferencedElement(oldReferencedContent, mReferencedElement.get());
+  UpdateReferencedElement(oldReferencedElement, mReferencedElement.get());
 }
 
 PRBool
 nsSMILTimeValueSpec::IsEventBased() const
 {
   return mParams.mType == nsSMILTimeValueSpecParams::EVENT ||
          mParams.mType == nsSMILTimeValueSpecParams::REPEAT ||
          mParams.mType == nsSMILTimeValueSpecParams::ACCESSKEY;
@@ -230,65 +232,65 @@ nsSMILTimeValueSpec::Unlink()
   UnregisterFromReferencedElement(mReferencedElement.get());
   mReferencedElement.Unlink();
 }
 
 //----------------------------------------------------------------------
 // Implementation helpers
 
 void
-nsSMILTimeValueSpec::UpdateReferencedElement(nsIContent* aFrom, nsIContent* aTo)
+nsSMILTimeValueSpec::UpdateReferencedElement(Element* aFrom, Element* aTo)
 {
   if (aFrom == aTo)
     return;
 
   UnregisterFromReferencedElement(aFrom);
 
   if (mParams.mType == nsSMILTimeValueSpecParams::SYNCBASE) {
-    nsSMILTimedElement* to = GetTimedElementFromContent(aTo);
+    nsSMILTimedElement* to = GetTimedElement(aTo);
     if (to) {
       to->AddDependent(*this);
     }
   } else if (mParams.mType == nsSMILTimeValueSpecParams::EVENT) {
     RegisterEventListener(aTo);
   }
 }
 
 void
-nsSMILTimeValueSpec::UnregisterFromReferencedElement(nsIContent* aContent)
+nsSMILTimeValueSpec::UnregisterFromReferencedElement(Element* aElement)
 {
-  if (!aContent)
+  if (!aElement)
     return;
 
   if (mParams.mType == nsSMILTimeValueSpecParams::SYNCBASE) {
-    nsSMILTimedElement* timedElement = GetTimedElementFromContent(aContent);
+    nsSMILTimedElement* timedElement = GetTimedElement(aElement);
     if (timedElement) {
       timedElement->RemoveDependent(*this);
     }
     mOwner->RemoveInstanceTimesForCreator(this, mIsBegin);
   } else if (mParams.mType == nsSMILTimeValueSpecParams::EVENT) {
-    UnregisterEventListener(aContent);
+    UnregisterEventListener(aElement);
   }
 }
 
 nsSMILTimedElement*
-nsSMILTimeValueSpec::GetTimedElementFromContent(nsIContent* aContent)
+nsSMILTimeValueSpec::GetTimedElement(Element* aElement)
 {
-  if (!aContent)
+  if (!aElement)
     return nsnull;
 
-  nsCOMPtr<nsISMILAnimationElement> animElement = do_QueryInterface(aContent);
+  nsCOMPtr<nsISMILAnimationElement> animElement = do_QueryInterface(aElement);
   if (!animElement)
     return nsnull;
 
   return &animElement->TimedElement();
 }
 
 void
-nsSMILTimeValueSpec::RegisterEventListener(nsIContent* aTarget)
+nsSMILTimeValueSpec::RegisterEventListener(Element* aTarget)
 {
   NS_ABORT_IF_FALSE(mParams.mType == nsSMILTimeValueSpecParams::EVENT,
     "Attempting to register event-listener for non-event nsSMILTimeValueSpec");
   NS_ABORT_IF_FALSE(mParams.mEventSymbol,
     "Attempting to register event-listener but there is no event name");
 
   // XXX Support default event targets
   if (!aTarget)
@@ -307,17 +309,17 @@ nsSMILTimeValueSpec::RegisterEventListen
   elm->AddEventListenerByType(mEventListener,
                               nsDependentAtomString(mParams.mEventSymbol),
                               NS_EVENT_FLAG_BUBBLE |
                               NS_PRIV_EVENT_UNTRUSTED_PERMITTED,
                               sysGroup);
 }
 
 void
-nsSMILTimeValueSpec::UnregisterEventListener(nsIContent* aTarget)
+nsSMILTimeValueSpec::UnregisterEventListener(Element* aTarget)
 {
   if (!aTarget || !mEventListener)
     return;
 
   nsCOMPtr<nsIDOMEventGroup> sysGroup;
   nsIEventListenerManager* elm =
     GetEventListenerManager(aTarget, getter_AddRefs(sysGroup));
   if (!elm)
@@ -326,17 +328,17 @@ nsSMILTimeValueSpec::UnregisterEventList
   elm->RemoveEventListenerByType(mEventListener,
                                  nsDependentAtomString(mParams.mEventSymbol),
                                  NS_EVENT_FLAG_BUBBLE |
                                  NS_PRIV_EVENT_UNTRUSTED_PERMITTED,
                                  sysGroup);
 }
 
 nsIEventListenerManager*
-nsSMILTimeValueSpec::GetEventListenerManager(nsIContent* aTarget,
+nsSMILTimeValueSpec::GetEventListenerManager(Element* aTarget,
                                              nsIDOMEventGroup** aSystemGroup)
 {
   NS_ABORT_IF_FALSE(aTarget, "null target; can't get EventListenerManager");
   NS_ABORT_IF_FALSE(aSystemGroup && !*aSystemGroup,
       "Bad out param for system group");
 
   nsIEventListenerManager* elm = aTarget->GetListenerManager(PR_TRUE);
   if (!elm)
--- a/content/smil/nsSMILTimeValueSpec.h
+++ b/content/smil/nsSMILTimeValueSpec.h
@@ -59,20 +59,22 @@ class nsSMILInterval;
 // and synchronisation (for syncbase specifications).
 //
 // For an overview of how this class is related to other SMIL time classes see
 // the documentation in nsSMILTimeValue.h
 
 class nsSMILTimeValueSpec
 {
 public:
+  typedef mozilla::dom::Element Element;
+
   nsSMILTimeValueSpec(nsSMILTimedElement& aOwner, PRBool aIsBegin);
   ~nsSMILTimeValueSpec();
 
-  nsresult SetSpec(const nsAString& aStringSpec, nsIContent* aContextNode);
+  nsresult SetSpec(const nsAString& aStringSpec, Element* aContextNode);
   void     ResolveReferences(nsIContent* aContextNode);
   PRBool   IsEventBased() const;
 
   void     HandleNewInterval(nsSMILInterval& aInterval,
                              const nsSMILTimeContainer* aSrcContainer);
 
   // For created nsSMILInstanceTime objects
   PRBool   DependsOnBegin() const;
@@ -82,22 +84,22 @@ public:
                                      PRBool aObjectChanged);
   void     HandleDeletedInstanceTime(nsSMILInstanceTime& aInstanceTime);
 
   // Cycle-collection support
   void Traverse(nsCycleCollectionTraversalCallback* aCallback);
   void Unlink();
 
 protected:
-  void UpdateReferencedElement(nsIContent* aFrom, nsIContent* aTo);
-  void UnregisterFromReferencedElement(nsIContent* aContent);
-  nsSMILTimedElement* GetTimedElementFromContent(nsIContent* aContent);
-  void RegisterEventListener(nsIContent* aTarget);
-  void UnregisterEventListener(nsIContent* aTarget);
-  nsIEventListenerManager* GetEventListenerManager(nsIContent* aTarget,
+  void UpdateReferencedElement(Element* aFrom, Element* aTo);
+  void UnregisterFromReferencedElement(Element* aElement);
+  nsSMILTimedElement* GetTimedElement(Element* aElement);
+  void RegisterEventListener(Element* aElement);
+  void UnregisterEventListener(Element* aElement);
+  nsIEventListenerManager* GetEventListenerManager(Element* aElement,
       nsIDOMEventGroup** aSystemGroup);
   void HandleEvent(nsIDOMEvent* aEvent);
   nsSMILTimeValue ConvertBetweenTimeContainers(const nsSMILTimeValue& aSrcTime,
                                       const nsSMILTimeContainer* aSrcContainer);
 
   nsSMILTimedElement*           mOwner;
   PRPackedBool                  mIsBegin; // Indicates if *we* are a begin spec,
                                           // not to be confused with
--- a/content/smil/nsSMILTimedElement.cpp
+++ b/content/smil/nsSMILTimedElement.cpp
@@ -704,23 +704,23 @@ nsSMILTimedElement::Rewind()
 
   if (mClient) {
     mClient->Inactivate(PR_FALSE);
   }
 
   if (mAnimationElement->HasAnimAttr(nsGkAtoms::begin)) {
     nsAutoString attValue;
     mAnimationElement->GetAnimAttr(nsGkAtoms::begin, attValue);
-    SetBeginSpec(attValue, &mAnimationElement->Content(), RemoveNonDynamic);
+    SetBeginSpec(attValue, &mAnimationElement->AsElement(), RemoveNonDynamic);
   }
 
   if (mAnimationElement->HasAnimAttr(nsGkAtoms::end)) {
     nsAutoString attValue;
     mAnimationElement->GetAnimAttr(nsGkAtoms::end, attValue);
-    SetEndSpec(attValue, &mAnimationElement->Content(), RemoveNonDynamic);
+    SetEndSpec(attValue, &mAnimationElement->AsElement(), RemoveNonDynamic);
   }
 
   mPrevRegisteredMilestone = sMaxMilestone;
   RegisterMilestone();
 }
 
 namespace
 {
@@ -728,17 +728,18 @@ namespace
   RemoveNonDOM(nsSMILInstanceTime* aInstanceTime)
   {
     return !aInstanceTime->FromDOM();
   }
 }
 
 PRBool
 nsSMILTimedElement::SetAttr(nsIAtom* aAttribute, const nsAString& aValue,
-                            nsAttrValue& aResult, nsIContent* aContextNode,
+                            nsAttrValue& aResult,
+                            Element* aContextNode,
                             nsresult* aParseResult)
 {
   PRBool foundMatch = PR_TRUE;
   nsresult parseResult = NS_OK;
 
   if (aAttribute == nsGkAtoms::begin) {
     parseResult = SetBeginSpec(aValue, aContextNode, RemoveNonDOM);
   } else if (aAttribute == nsGkAtoms::dur) {
@@ -801,33 +802,33 @@ nsSMILTimedElement::UnsetAttr(nsIAtom* a
   return foundMatch;
 }
 
 //----------------------------------------------------------------------
 // Setters and unsetters
 
 nsresult
 nsSMILTimedElement::SetBeginSpec(const nsAString& aBeginSpec,
-                                 nsIContent* aContextNode,
+                                 Element* aContextNode,
                                  RemovalTestFunction aRemove)
 {
   return SetBeginOrEndSpec(aBeginSpec, aContextNode, PR_TRUE /*isBegin*/,
                            aRemove);
 }
 
 void
 nsSMILTimedElement::UnsetBeginSpec(RemovalTestFunction aRemove)
 {
   ClearSpecs(mBeginSpecs, mBeginInstances, aRemove);
   UpdateCurrentInterval();
 }
 
 nsresult
 nsSMILTimedElement::SetEndSpec(const nsAString& aEndSpec,
-                               nsIContent* aContextNode,
+                               Element* aContextNode,
                                RemovalTestFunction aRemove)
 {
   return SetBeginOrEndSpec(aEndSpec, aContextNode, PR_FALSE /*!isBegin*/,
                            aRemove);
 }
 
 void
 nsSMILTimedElement::UnsetEndSpec(RemovalTestFunction aRemove)
@@ -1100,27 +1101,22 @@ nsSMILTimedElement::IsTimeDependent(cons
 }
 
 void
 nsSMILTimedElement::BindToTree(nsIContent* aContextNode)
 {
   // Resolve references to other parts of the tree
   PRUint32 count = mBeginSpecs.Length();
   for (PRUint32 i = 0; i < count; ++i) {
-    nsSMILTimeValueSpec* beginSpec = mBeginSpecs[i];
-    NS_ABORT_IF_FALSE(beginSpec,
-        "null nsSMILTimeValueSpec in list of begin specs");
-    beginSpec->ResolveReferences(aContextNode);
+    mBeginSpecs[i]->ResolveReferences(aContextNode);
   }
 
   count = mEndSpecs.Length();
   for (PRUint32 j = 0; j < count; ++j) {
-    nsSMILTimeValueSpec* endSpec = mEndSpecs[j];
-    NS_ABORT_IF_FALSE(endSpec, "null nsSMILTimeValueSpec in list of end specs");
-    endSpec->ResolveReferences(aContextNode);
+    mEndSpecs[j]->ResolveReferences(aContextNode);
   }
 
   // Clear any previous milestone since it might be been processed whilst we
   // were not bound to the tree.
   mPrevRegisteredMilestone = sMaxMilestone;
 
   RegisterMilestone();
 }
@@ -1163,17 +1159,17 @@ nsSMILTimedElement::Unlink()
   }
 }
 
 //----------------------------------------------------------------------
 // Implementation helpers
 
 nsresult
 nsSMILTimedElement::SetBeginOrEndSpec(const nsAString& aSpec,
-                                      nsIContent* aContextNode,
+                                      Element* aContextNode,
                                       PRBool aIsBegin,
                                       RemovalTestFunction aRemove)
 {
   PRInt32 start;
   PRInt32 end = -1;
   PRInt32 length;
   nsresult rv = NS_OK;
   TimeValueSpecList& timeSpecsList = aIsBegin ? mBeginSpecs : mEndSpecs;
@@ -2048,17 +2044,17 @@ nsSMILTimedElement::NotifyChangedInterva
 
 void
 nsSMILTimedElement::FireTimeEventAsync(PRUint32 aMsg, PRInt32 aDetail)
 {
   if (!mAnimationElement)
     return;
 
   nsCOMPtr<nsIRunnable> event =
-    new AsyncTimeEventRunner(&mAnimationElement->Content(), aMsg, aDetail);
+    new AsyncTimeEventRunner(&mAnimationElement->AsElement(), aMsg, aDetail);
   NS_DispatchToMainThread(event, NS_DISPATCH_NORMAL);
 }
 
 const nsSMILInstanceTime*
 nsSMILTimedElement::GetEffectiveBeginInstance() const
 {
   switch (mElementState)
   {
--- a/content/smil/nsSMILTimedElement.h
+++ b/content/smil/nsSMILTimedElement.h
@@ -60,16 +60,18 @@ class nsIAtom;
 // nsSMILTimedElement
 
 class nsSMILTimedElement
 {
 public:
   nsSMILTimedElement();
   ~nsSMILTimedElement();
 
+  typedef mozilla::dom::Element Element;
+
   /*
    * Sets the owning animation element which this class uses to convert between
    * container times and to register timebase elements.
    */
   void SetAnimationElement(nsISMILAnimationElement* aElement);
 
   /*
    * Returns the time container with which this timed element is associated or
@@ -244,26 +246,26 @@ public:
    * @param aAttribute  The name of the attribute to set. The namespace of this
    *                    attribute is not specified as it is checked by the host
    *                    element. Only attributes in the namespace defined for
    *                    SMIL attributes in the host language are passed to the
    *                    timed element.
    * @param aValue      The attribute value.
    * @param aResult     The nsAttrValue object that may be used for storing the
    *                    parsed result.
-   * @param aContextNode The node to use for context when resolving references
-   *                     to other elements.
+   * @param aContextNode The element to use for context when resolving
+   *                     references to other elements.
    * @param[out] aParseResult The result of parsing the attribute. Will be set
    *                          to NS_OK if parsing is successful.
    *
    * @return PR_TRUE if the given attribute is a timing attribute, PR_FALSE
    * otherwise.
    */
   PRBool SetAttr(nsIAtom* aAttribute, const nsAString& aValue,
-                 nsAttrValue& aResult, nsIContent* aContextNode,
+                 nsAttrValue& aResult, Element* aContextNode,
                  nsresult* aParseResult = nsnull);
 
   /**
    * Attempts to unset an attribute on this timed element.
    *
    * @param aAttribute  The name of the attribute to set. As with SetAttr the
    *                    namespace of the attribute is not specified (see
    *                    SetAttr).
@@ -355,20 +357,20 @@ protected:
   template <class TestFunctor>
   void RemoveInstanceTimes(InstanceTimeList& aArray, TestFunctor& aTest);
 
   //
   // Implementation helpers
   //
 
   nsresult          SetBeginSpec(const nsAString& aBeginSpec,
-                                 nsIContent* aContextNode,
+                                 Element* aContextNode,
                                  RemovalTestFunction aRemove);
   nsresult          SetEndSpec(const nsAString& aEndSpec,
-                               nsIContent* aContextNode,
+                               Element* aContextNode,
                                RemovalTestFunction aRemove);
   nsresult          SetSimpleDuration(const nsAString& aDurSpec);
   nsresult          SetMin(const nsAString& aMinSpec);
   nsresult          SetMax(const nsAString& aMaxSpec);
   nsresult          SetRestart(const nsAString& aRestartSpec);
   nsresult          SetRepeatCount(const nsAString& aRepeatCountSpec);
   nsresult          SetRepeatDur(const nsAString& aRepeatDurSpec);
   nsresult          SetFillMode(const nsAString& aFillModeSpec);
@@ -379,17 +381,17 @@ protected:
   void              UnsetMin();
   void              UnsetMax();
   void              UnsetRestart();
   void              UnsetRepeatCount();
   void              UnsetRepeatDur();
   void              UnsetFillMode();
 
   nsresult          SetBeginOrEndSpec(const nsAString& aSpec,
-                                      nsIContent* aContextNode,
+                                      Element* aContextNode,
                                       PRBool aIsBegin,
                                       RemovalTestFunction aRemove);
   void              ClearSpecs(TimeValueSpecList& aSpecs,
                                InstanceTimeList& aInstances,
                                RemovalTestFunction aRemove);
   void              RewindTiming();
   void              DoSampleAt(nsSMILTime aContainerTime, PRBool aEndOnly);
 
--- a/content/svg/content/src/SVGMotionSMILAnimationFunction.cpp
+++ b/content/svg/content/src/SVGMotionSMILAnimationFunction.cpp
@@ -341,17 +341,17 @@ SVGMotionSMILAnimationFunction::
   // Clear stale data
   mPath = nsnull;
   mPathVertices.Clear();
   mPathSourceType = ePathSourceType_None;
 
   // Do we have a mpath child? if so, it trumps everything. Otherwise, we look
   // through our list of path-defining attributes, in order of priority.
   nsSVGMpathElement* firstMpathChild =
-    GetFirstMpathChild(&mAnimationElement->Content());
+    GetFirstMpathChild(&mAnimationElement->AsElement());
 
   if (firstMpathChild) {
     RebuildPathAndVerticesFromMpathElem(firstMpathChild);
     mValueNeedsReparsingEverySample = PR_FALSE;
   } else if (HasAttr(nsGkAtoms::path)) {
     RebuildPathAndVerticesFromPathAttr();
     mValueNeedsReparsingEverySample = PR_FALSE;
   } else {
--- a/content/svg/content/src/nsSVGAnimationElement.cpp
+++ b/content/svg/content/src/nsSVGAnimationElement.cpp
@@ -101,24 +101,24 @@ nsSVGAnimationElement::Init()
   mTimedElement.SetTimeClient(&AnimationFunction());
 
   return NS_OK;
 }
 
 //----------------------------------------------------------------------
 // nsISMILAnimationElement methods
 
-const nsIContent&
-nsSVGAnimationElement::Content() const
+const Element&
+nsSVGAnimationElement::AsElement() const
 {
   return *this;
 }
 
-nsIContent&
-nsSVGAnimationElement::Content()
+Element&
+nsSVGAnimationElement::AsElement()
 {
   return *this;
 }
 
 const nsAttrValue*
 nsSVGAnimationElement::GetAnimAttr(nsIAtom* aName) const
 {
   return mAttrsAndChildren.GetAttr(aName, kNameSpaceID_None);
--- a/content/svg/content/src/nsSVGAnimationElement.h
+++ b/content/svg/content/src/nsSVGAnimationElement.h
@@ -81,22 +81,22 @@ public:
 
   // nsGenericElement specializations
   virtual PRBool ParseAttribute(PRInt32 aNamespaceID,
                                 nsIAtom* aAttribute,
                                 const nsAString& aValue,
                                 nsAttrValue& aResult);
 
   // nsISMILAnimationElement interface
-  virtual const nsIContent& Content() const;
-  virtual nsIContent& Content();
+  virtual const Element& AsElement() const;
+  virtual Element& AsElement();
   virtual const nsAttrValue* GetAnimAttr(nsIAtom* aName) const;
   virtual PRBool GetAnimAttr(nsIAtom* aAttName, nsAString& aResult) const;
   virtual PRBool HasAnimAttr(nsIAtom* aAttName) const;
-  virtual mozilla::dom::Element* GetTargetElementContent();
+  virtual Element* GetTargetElementContent();
   virtual nsIAtom* GetTargetAttributeName() const;
   virtual nsSMILTargetAttrType GetTargetAttributeType() const;
   virtual nsSMILTimedElement& TimedElement();
   virtual nsSMILTimeContainer* GetTimeContainer();
 
 protected:
   // nsSVGElement overrides
   PRBool IsEventName(nsIAtom* aName);