Bug 1403500, part 5 - Document and do some renaming for nsSMILTimeValueSpec's TimeReferenceElement. r=longsonr draft
authorJonathan Watt <jwatt@jwatt.org>
Wed, 04 Oct 2017 00:09:29 +0100
changeset 674537 e9e842a2ae5b9200904efaa3c1d7c8d73294b36e
parent 674536 a6a7345edd13ddde01410981f85ef7ee8eaeb027
child 734370 4f7b1b321e50746019f293d7e888840a8ae18db2
push id82877
push userjwatt@jwatt.org
push dateTue, 03 Oct 2017 23:10:08 +0000
reviewerslongsonr
bugs1403500
milestone58.0a1
Bug 1403500, part 5 - Document and do some renaming for nsSMILTimeValueSpec's TimeReferenceElement. r=longsonr MozReview-Commit-ID: IQjMKLz7Q7M
dom/smil/nsSMILTimeValueSpec.h
--- a/dom/smil/nsSMILTimeValueSpec.h
+++ b/dom/smil/nsSMILTimeValueSpec.h
@@ -33,16 +33,17 @@ class EventListenerManager;
 //
 // 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;
+  typedef mozilla::dom::IDTracker IDTracker;
 
   nsSMILTimeValueSpec(nsSMILTimedElement& aOwner, bool aIsBegin);
   ~nsSMILTimeValueSpec();
 
   nsresult SetSpec(const nsAString& aStringSpec, Element* aContextNode);
   void     ResolveReferences(nsIContent* aContextNode);
   bool     IsEventBased() const;
 
@@ -81,20 +82,31 @@ protected:
   nsSMILTimedElement*           mOwner;
   bool                          mIsBegin; // Indicates if *we* are a begin spec,
                                           // not to be confused with
                                           // mParams.mSyncBegin which indicates
                                           // if we're synced with the begin of
                                           // the target.
   nsSMILTimeValueSpecParams     mParams;
 
-  class TimeReferenceElement : public mozilla::dom::IDTracker
+  /**
+   * If our nsSMILTimeValueSpec exists for a 'begin' or 'end' attribute with a
+   * value that specifies a time that is relative to the animation of some
+   * other element, it will create an instance of this class to reference and
+   * track that other element.  For example, if the nsSMILTimeValueSpec is for
+   * end='a.end+2s', an instance of this class will be created to track the
+   * element associate with the element ID "a".  This class will notify the
+   * nsSMILTimeValueSpec if the element that that ID identifies changes.
+   */
+  class TimeReferenceTracker final : public IDTracker
   {
   public:
-    explicit TimeReferenceElement(nsSMILTimeValueSpec* aOwner) : mSpec(aOwner) { }
+    explicit TimeReferenceTracker(nsSMILTimeValueSpec* aOwner)
+      : mSpec(aOwner)
+    {}
     void ResetWithElement(Element* aTo) {
       RefPtr<Element> from = get();
       Unlink();
       ElementChanged(from, aTo);
     }
 
   protected:
     virtual void ElementChanged(Element* aFrom, Element* aTo) override
@@ -102,17 +114,17 @@ protected:
       IDTracker::ElementChanged(aFrom, aTo);
       mSpec->UpdateReferencedElement(aFrom, aTo);
     }
     virtual bool IsPersistent() override { return true; }
   private:
     nsSMILTimeValueSpec* mSpec;
   };
 
-  TimeReferenceElement mReferencedElement;
+  TimeReferenceTracker mReferencedElement;
 
   class EventListener final : public nsIDOMEventListener
   {
     ~EventListener() {}
   public:
     explicit EventListener(nsSMILTimeValueSpec* aOwner) : mSpec(aOwner) { }
     void Disconnect()
     {