Bug 1423492 part 1. Stop overring UnsetAttr in SVGAnimationElement. r=bytesized
authorBoris Zbarsky <bzbarsky@mit.edu>
Wed, 03 Jan 2018 21:03:27 -0500
changeset 397906 f0cb5b7abb37b98400b7bcb3072b8c094f0fe387
parent 397804 8b100f473b7db72dbe93d28e45dd5ca33f6d3e59
child 397907 a24287fb46abc6959e2d8e17d632b8016cd613c1
push id33194
push usertoros@mozilla.com
push dateFri, 05 Jan 2018 09:58:30 +0000
treeherdermozilla-central@81362f7306fe [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbytesized
bugs1423492
milestone59.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 1423492 part 1. Stop overring UnsetAttr in SVGAnimationElement. r=bytesized MozReview-Commit-ID: Ih8QmVkoOFZ
dom/svg/SVGAnimationElement.cpp
dom/svg/SVGAnimationElement.h
--- a/dom/svg/SVGAnimationElement.cpp
+++ b/dom/svg/SVGAnimationElement.cpp
@@ -286,16 +286,24 @@ SVGAnimationElement::ParseAttribute(int3
 
 nsresult
 SVGAnimationElement::AfterSetAttr(int32_t aNamespaceID, nsAtom* aName,
                                   const nsAttrValue* aValue,
                                   const nsAttrValue* aOldValue,
                                   nsIPrincipal* aSubjectPrincipal,
                                   bool aNotify)
 {
+  if (!aValue && aNamespaceID == kNameSpaceID_None) {
+    // Attribute is being removed.
+    if (AnimationFunction().UnsetAttr(aName) ||
+        mTimedElement.UnsetAttr(aName)) {
+      AnimationNeedsResample();
+    }
+  }
+
   nsresult rv =
     SVGAnimationElementBase::AfterSetAttr(aNamespaceID, aName, aValue,
                                           aOldValue, aSubjectPrincipal, aNotify);
 
   if (SVGTests::IsConditionalProcessingAttribute(aName)) {
     bool isDisabled = !SVGTests::PassesConditionalProcessingTests();
     if (mTimedElement.SetIsDisabled(isDisabled)) {
       AnimationNeedsResample();
@@ -334,34 +342,16 @@ SVGAnimationElement::AfterSetAttr(int32_
                "Expected href attribute to be string type");
     UpdateHrefTarget(this, aValue->GetStringValue());
   } // else: we're not yet in a document -- we'll update the target on
     // next BindToTree call.
 
   return rv;
 }
 
-nsresult
-SVGAnimationElement::UnsetAttr(int32_t aNamespaceID,
-                               nsAtom* aAttribute, bool aNotify)
-{
-  nsresult rv = SVGAnimationElementBase::UnsetAttr(aNamespaceID, aAttribute,
-                                                   aNotify);
-  NS_ENSURE_SUCCESS(rv,rv);
-
-  if (aNamespaceID == kNameSpaceID_None) {
-    if (AnimationFunction().UnsetAttr(aAttribute) ||
-        mTimedElement.UnsetAttr(aAttribute)) {
-      AnimationNeedsResample();
-    }
-  }
-
-  return NS_OK;
-}
-
 bool
 SVGAnimationElement::IsNodeOfType(uint32_t aFlags) const
 {
   return !(aFlags & ~eANIMATION);
 }
 
 //----------------------------------------------------------------------
 // SVGTests methods
--- a/dom/svg/SVGAnimationElement.h
+++ b/dom/svg/SVGAnimationElement.h
@@ -43,19 +43,16 @@ public:
                          bool aPreallocateChildren) const override = 0;
 
   // nsIContent specializations
   virtual nsresult BindToTree(nsIDocument* aDocument, nsIContent* aParent,
                               nsIContent* aBindingParent,
                               bool aCompileEventHandlers) override;
   virtual void UnbindFromTree(bool aDeep, bool aNullParent) override;
 
-  virtual nsresult UnsetAttr(int32_t aNamespaceID, nsAtom* aAttribute,
-                             bool aNotify) override;
-
   virtual bool IsNodeOfType(uint32_t aFlags) const override;
 
   // Element specializations
   virtual bool ParseAttribute(int32_t aNamespaceID,
                                 nsAtom* aAttribute,
                                 const nsAString& aValue,
                                 nsIPrincipal* aMaybeScriptedPrincipal,
                                 nsAttrValue& aResult) override;