Bug 1403500, part 5 - Document and do some renaming for nsSMILTimeValueSpec's TimeReferenceElement. r=longsonr
MozReview-Commit-ID: IQjMKLz7Q7M
--- 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()
{