michael@0: /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #ifndef NS_SMILTIMEDELEMENT_H_ michael@0: #define NS_SMILTIMEDELEMENT_H_ michael@0: michael@0: #include "nsSMILInterval.h" michael@0: #include "nsSMILInstanceTime.h" michael@0: #include "nsSMILMilestone.h" michael@0: #include "nsSMILTimeValueSpec.h" michael@0: #include "nsSMILRepeatCount.h" michael@0: #include "nsSMILTypes.h" michael@0: #include "nsTArray.h" michael@0: #include "nsTHashtable.h" michael@0: #include "nsHashKeys.h" michael@0: #include "nsAutoPtr.h" michael@0: #include "nsAttrValue.h" michael@0: michael@0: class nsSMILAnimationFunction; michael@0: class nsSMILTimeContainer; michael@0: class nsSMILTimeValue; michael@0: class nsIAtom; michael@0: michael@0: namespace mozilla { michael@0: namespace dom { michael@0: class SVGAnimationElement; michael@0: } michael@0: } michael@0: michael@0: //---------------------------------------------------------------------- michael@0: // nsSMILTimedElement michael@0: michael@0: class nsSMILTimedElement michael@0: { michael@0: public: michael@0: nsSMILTimedElement(); michael@0: ~nsSMILTimedElement(); michael@0: michael@0: typedef mozilla::dom::Element Element; michael@0: michael@0: /* michael@0: * Sets the owning animation element which this class uses to convert between michael@0: * container times and to register timebase elements. michael@0: */ michael@0: void SetAnimationElement(mozilla::dom::SVGAnimationElement* aElement); michael@0: michael@0: /* michael@0: * Returns the time container with which this timed element is associated or michael@0: * nullptr if it is not associated with a time container. michael@0: */ michael@0: nsSMILTimeContainer* GetTimeContainer(); michael@0: michael@0: /* michael@0: * Returns the element targeted by the animation element. Needed for michael@0: * registering event listeners against the appropriate element. michael@0: */ michael@0: mozilla::dom::Element* GetTargetElement(); michael@0: michael@0: /** michael@0: * Methods for supporting the nsIDOMElementTimeControl interface. michael@0: */ michael@0: michael@0: /* michael@0: * Adds a new begin instance time at the current container time plus or minus michael@0: * the specified offset. michael@0: * michael@0: * @param aOffsetSeconds A real number specifying the number of seconds to add michael@0: * to the current container time. michael@0: * @return NS_OK if the operation succeeeded, or an error code otherwise. michael@0: */ michael@0: nsresult BeginElementAt(double aOffsetSeconds); michael@0: michael@0: /* michael@0: * Adds a new end instance time at the current container time plus or minus michael@0: * the specified offset. michael@0: * michael@0: * @param aOffsetSeconds A real number specifying the number of seconds to add michael@0: * to the current container time. michael@0: * @return NS_OK if the operation succeeeded, or an error code otherwise. michael@0: */ michael@0: nsresult EndElementAt(double aOffsetSeconds); michael@0: michael@0: /** michael@0: * Methods for supporting the nsSVGAnimationElement interface. michael@0: */ michael@0: michael@0: /** michael@0: * According to SVG 1.1 SE this returns michael@0: * michael@0: * the begin time, in seconds, for this animation element's current michael@0: * interval, if it exists, regardless of whether the interval has begun yet. michael@0: * michael@0: * @return the start time as defined above in milliseconds or an unresolved michael@0: * time if there is no current interval. michael@0: */ michael@0: nsSMILTimeValue GetStartTime() const; michael@0: michael@0: /** michael@0: * Returns the simple duration of this element. michael@0: * michael@0: * @return the simple duration in milliseconds or INDEFINITE. michael@0: */ michael@0: nsSMILTimeValue GetSimpleDuration() const michael@0: { michael@0: return mSimpleDur; michael@0: } michael@0: michael@0: /** michael@0: * Methods for supporting hyperlinking michael@0: */ michael@0: michael@0: /** michael@0: * Internal SMIL methods michael@0: */ michael@0: michael@0: /** michael@0: * Returns the time to seek the document to when this element is targetted by michael@0: * a hyperlink. michael@0: * michael@0: * The behavior is defined here: michael@0: * http://www.w3.org/TR/smil-animation/#HyperlinkSemantics michael@0: * michael@0: * It is very similar to GetStartTime() with the exception that when the michael@0: * element is not active, the begin time of the *first* interval is returned. michael@0: * michael@0: * @return the time to seek the documen to in milliseconds or an unresolved michael@0: * time if there is no resolved interval. michael@0: */ michael@0: nsSMILTimeValue GetHyperlinkTime() const; michael@0: michael@0: /** michael@0: * Adds an instance time object this element's list of instance times. michael@0: * These instance times are used when creating intervals. michael@0: * michael@0: * This method is typically called by an nsSMILTimeValueSpec. michael@0: * michael@0: * @param aInstanceTime The time to add, expressed in container time. michael@0: * @param aIsBegin true if the time to be added represents a begin michael@0: * time or false if it represents an end time. michael@0: */ michael@0: void AddInstanceTime(nsSMILInstanceTime* aInstanceTime, bool aIsBegin); michael@0: michael@0: /** michael@0: * Requests this element update the given instance time. michael@0: * michael@0: * This method is typically called by a child nsSMILTimeValueSpec. michael@0: * michael@0: * @param aInstanceTime The instance time to update. michael@0: * @param aUpdatedTime The time to update aInstanceTime with. michael@0: * @param aDependentTime The instance time upon which aInstanceTime should be michael@0: * based. michael@0: * @param aIsBegin true if the time to be updated represents a begin michael@0: * instance time or false if it represents an end michael@0: * instance time. michael@0: */ michael@0: void UpdateInstanceTime(nsSMILInstanceTime* aInstanceTime, michael@0: nsSMILTimeValue& aUpdatedTime, michael@0: bool aIsBegin); michael@0: michael@0: /** michael@0: * Removes an instance time object from this element's list of instance times. michael@0: * michael@0: * This method is typically called by a child nsSMILTimeValueSpec. michael@0: * michael@0: * @param aInstanceTime The instance time to remove. michael@0: * @param aIsBegin true if the time to be removed represents a begin michael@0: * time or false if it represents an end time. michael@0: */ michael@0: void RemoveInstanceTime(nsSMILInstanceTime* aInstanceTime, bool aIsBegin); michael@0: michael@0: /** michael@0: * Removes all the instance times associated with the given michael@0: * nsSMILTimeValueSpec object. Used when an ID assignment changes and hence michael@0: * all the previously associated instance times become invalid. michael@0: * michael@0: * @param aSpec The nsSMILTimeValueSpec object whose created michael@0: * nsSMILInstanceTime's should be removed. michael@0: * @param aIsBegin true if the times to be removed represent begin michael@0: * times or false if they are end times. michael@0: */ michael@0: void RemoveInstanceTimesForCreator(const nsSMILTimeValueSpec* aSpec, michael@0: bool aIsBegin); michael@0: michael@0: /** michael@0: * Sets the object that will be called by this timed element each time it is michael@0: * sampled. michael@0: * michael@0: * In Schmitz's model it is possible to associate several time clients with michael@0: * a timed element but for now we only allow one. michael@0: * michael@0: * @param aClient The time client to associate. Any previous time client michael@0: * will be disassociated and no longer sampled. Setting this michael@0: * to nullptr will simply disassociate the previous client, if michael@0: * any. michael@0: */ michael@0: void SetTimeClient(nsSMILAnimationFunction* aClient); michael@0: michael@0: /** michael@0: * Samples the object at the given container time. Timing intervals are michael@0: * updated and if this element is active at the given time the associated time michael@0: * client will be sampled with the appropriate simple time. michael@0: * michael@0: * @param aContainerTime The container time at which to sample. michael@0: */ michael@0: void SampleAt(nsSMILTime aContainerTime); michael@0: michael@0: /** michael@0: * Performs a special sample for the end of an interval. Such a sample should michael@0: * only advance the timed element (and any dependent elements) to the waiting michael@0: * or postactive state. It should not cause a transition to the active state. michael@0: * Transition to the active state is only performed on a regular SampleAt. michael@0: * michael@0: * This allows all interval ends at a given time to be processed first and michael@0: * hence the new interval can be established based on full information of the michael@0: * available instance times. michael@0: * michael@0: * @param aContainerTime The container time at which to sample. michael@0: */ michael@0: void SampleEndAt(nsSMILTime aContainerTime); michael@0: michael@0: /** michael@0: * Informs the timed element that its time container has changed time michael@0: * relative to document time. The timed element therefore needs to update its michael@0: * dependent elements (which may belong to a different time container) so they michael@0: * can re-resolve their times. michael@0: */ michael@0: void HandleContainerTimeChange(); michael@0: michael@0: /** michael@0: * Resets this timed element's accumulated times and intervals back to start michael@0: * up state. michael@0: * michael@0: * This is used for backwards seeking where rather than accumulating michael@0: * historical timing state and winding it back, we reset the element and seek michael@0: * forwards. michael@0: */ michael@0: void Rewind(); michael@0: michael@0: /** michael@0: * Attempts to set an attribute on this timed element. michael@0: * michael@0: * @param aAttribute The name of the attribute to set. The namespace of this michael@0: * attribute is not specified as it is checked by the host michael@0: * element. Only attributes in the namespace defined for michael@0: * SMIL attributes in the host language are passed to the michael@0: * timed element. michael@0: * @param aValue The attribute value. michael@0: * @param aResult The nsAttrValue object that may be used for storing the michael@0: * parsed result. michael@0: * @param aContextNode The element to use for context when resolving michael@0: * references to other elements. michael@0: * @param[out] aParseResult The result of parsing the attribute. Will be set michael@0: * to NS_OK if parsing is successful. michael@0: * michael@0: * @return true if the given attribute is a timing attribute, false michael@0: * otherwise. michael@0: */ michael@0: bool SetAttr(nsIAtom* aAttribute, const nsAString& aValue, michael@0: nsAttrValue& aResult, Element* aContextNode, michael@0: nsresult* aParseResult = nullptr); michael@0: michael@0: /** michael@0: * Attempts to unset an attribute on this timed element. michael@0: * michael@0: * @param aAttribute The name of the attribute to set. As with SetAttr the michael@0: * namespace of the attribute is not specified (see michael@0: * SetAttr). michael@0: * michael@0: * @return true if the given attribute is a timing attribute, false michael@0: * otherwise. michael@0: */ michael@0: bool UnsetAttr(nsIAtom* aAttribute); michael@0: michael@0: /** michael@0: * Adds a syncbase dependency to the list of dependents that will be notified michael@0: * when this timed element creates, deletes, or updates its current interval. michael@0: * michael@0: * @param aDependent The nsSMILTimeValueSpec object to notify. A raw pointer michael@0: * to this object will be stored. Therefore it is necessary michael@0: * for the object to be explicitly unregistered (with michael@0: * RemoveDependent) when it is destroyed. michael@0: */ michael@0: void AddDependent(nsSMILTimeValueSpec& aDependent); michael@0: michael@0: /** michael@0: * Removes a syncbase dependency from the list of dependents that are notified michael@0: * when the current interval is modified. michael@0: * michael@0: * @param aDependent The nsSMILTimeValueSpec object to unregister. michael@0: */ michael@0: void RemoveDependent(nsSMILTimeValueSpec& aDependent); michael@0: michael@0: /** michael@0: * Determines if this timed element is dependent on the given timed element's michael@0: * begin time for the interval currently in effect. Whilst the element is in michael@0: * the active state this is the current interval and in the postactive or michael@0: * waiting state this is the previous interval if one exists. In all other michael@0: * cases the element is not considered a time dependent of any other element. michael@0: * michael@0: * @param aOther The potential syncbase element. michael@0: * @return true if this timed element's begin time for the currently michael@0: * effective interval is directly or indirectly derived from aOther, false michael@0: * otherwise. michael@0: */ michael@0: bool IsTimeDependent(const nsSMILTimedElement& aOther) const; michael@0: michael@0: /** michael@0: * Called when the timed element has been bound to the document so that michael@0: * references from this timed element to other elements can be resolved. michael@0: * michael@0: * @param aContextNode The node which provides the necessary context for michael@0: * resolving references. This is typically the element in michael@0: * the host language that owns this timed element. Should michael@0: * not be null. michael@0: */ michael@0: void BindToTree(nsIContent* aContextNode); michael@0: michael@0: /** michael@0: * Called when the target of the animation has changed so that event michael@0: * registrations can be updated. michael@0: */ michael@0: void HandleTargetElementChange(mozilla::dom::Element* aNewTarget); michael@0: michael@0: /** michael@0: * Called when the timed element has been removed from a document so that michael@0: * references to other elements can be broken. michael@0: */ michael@0: void DissolveReferences() { Unlink(); } michael@0: michael@0: // Cycle collection michael@0: void Traverse(nsCycleCollectionTraversalCallback* aCallback); michael@0: void Unlink(); michael@0: michael@0: typedef bool (*RemovalTestFunction)(nsSMILInstanceTime* aInstance); michael@0: michael@0: protected: michael@0: // Typedefs michael@0: typedef nsTArray > TimeValueSpecList; michael@0: typedef nsTArray > InstanceTimeList; michael@0: typedef nsTArray > IntervalList; michael@0: typedef nsPtrHashKey TimeValueSpecPtrKey; michael@0: typedef nsTHashtable TimeValueSpecHashSet; michael@0: michael@0: // Helper classes michael@0: class InstanceTimeComparator { michael@0: public: michael@0: bool Equals(const nsSMILInstanceTime* aElem1, michael@0: const nsSMILInstanceTime* aElem2) const; michael@0: bool LessThan(const nsSMILInstanceTime* aElem1, michael@0: const nsSMILInstanceTime* aElem2) const; michael@0: }; michael@0: michael@0: struct NotifyTimeDependentsParams { michael@0: nsSMILTimedElement* mTimedElement; michael@0: nsSMILTimeContainer* mTimeContainer; michael@0: }; michael@0: michael@0: // Templated helper functions michael@0: template michael@0: void RemoveInstanceTimes(InstanceTimeList& aArray, TestFunctor& aTest); michael@0: michael@0: // michael@0: // Implementation helpers michael@0: // michael@0: michael@0: nsresult SetBeginSpec(const nsAString& aBeginSpec, michael@0: Element* aContextNode, michael@0: RemovalTestFunction aRemove); michael@0: nsresult SetEndSpec(const nsAString& aEndSpec, michael@0: Element* aContextNode, michael@0: RemovalTestFunction aRemove); michael@0: nsresult SetSimpleDuration(const nsAString& aDurSpec); michael@0: nsresult SetMin(const nsAString& aMinSpec); michael@0: nsresult SetMax(const nsAString& aMaxSpec); michael@0: nsresult SetRestart(const nsAString& aRestartSpec); michael@0: nsresult SetRepeatCount(const nsAString& aRepeatCountSpec); michael@0: nsresult SetRepeatDur(const nsAString& aRepeatDurSpec); michael@0: nsresult SetFillMode(const nsAString& aFillModeSpec); michael@0: michael@0: void UnsetBeginSpec(RemovalTestFunction aRemove); michael@0: void UnsetEndSpec(RemovalTestFunction aRemove); michael@0: void UnsetSimpleDuration(); michael@0: void UnsetMin(); michael@0: void UnsetMax(); michael@0: void UnsetRestart(); michael@0: void UnsetRepeatCount(); michael@0: void UnsetRepeatDur(); michael@0: void UnsetFillMode(); michael@0: michael@0: nsresult SetBeginOrEndSpec(const nsAString& aSpec, michael@0: Element* aContextNode, michael@0: bool aIsBegin, michael@0: RemovalTestFunction aRemove); michael@0: void ClearSpecs(TimeValueSpecList& aSpecs, michael@0: InstanceTimeList& aInstances, michael@0: RemovalTestFunction aRemove); michael@0: void ClearIntervals(); michael@0: void DoSampleAt(nsSMILTime aContainerTime, bool aEndOnly); michael@0: michael@0: /** michael@0: * Helper function to check for an early end and, if necessary, update the michael@0: * current interval accordingly. michael@0: * michael@0: * See SMIL 3.0, section 5.4.5, Element life cycle, "Active Time - Playing an michael@0: * interval" for a description of ending early. michael@0: * michael@0: * @param aSampleTime The current sample time. Early ends should only be michael@0: * applied at the last possible moment (i.e. if they are at michael@0: * or before the current sample time) and only if the michael@0: * current interval is not already ending. michael@0: * @return true if the end time of the current interval was updated, michael@0: * false otherwise. michael@0: */ michael@0: bool ApplyEarlyEnd(const nsSMILTimeValue& aSampleTime); michael@0: michael@0: /** michael@0: * Clears certain state in response to the element restarting. michael@0: * michael@0: * This state is described in SMIL 3.0, section 5.4.3, Resetting element state michael@0: */ michael@0: void Reset(); michael@0: michael@0: /** michael@0: * Completes a seek operation by sending appropriate events and, in the case michael@0: * of a backwards seek, updating the state of timing information that was michael@0: * previously considered historical. michael@0: */ michael@0: void DoPostSeek(); michael@0: michael@0: /** michael@0: * Unmarks instance times that were previously preserved because they were michael@0: * considered important historical milestones but are no longer such because michael@0: * a backwards seek has been performed. michael@0: */ michael@0: void UnpreserveInstanceTimes(InstanceTimeList& aList); michael@0: michael@0: /** michael@0: * Helper function to iterate through this element's accumulated timing michael@0: * information (specifically old nsSMILIntervals and nsSMILTimeInstanceTimes) michael@0: * and discard items that are no longer needed or exceed some threshold of michael@0: * accumulated state. michael@0: */ michael@0: void FilterHistory(); michael@0: michael@0: // Helper functions for FilterHistory to clear old nsSMILIntervals and michael@0: // nsSMILInstanceTimes respectively. michael@0: void FilterIntervals(); michael@0: void FilterInstanceTimes(InstanceTimeList& aList); michael@0: michael@0: /** michael@0: * Calculates the next acceptable interval for this element after the michael@0: * specified interval, or, if no previous interval is specified, it will be michael@0: * the first interval with an end time after t=0. michael@0: * michael@0: * @see SMILANIM 3.6.8 michael@0: * michael@0: * @param aPrevInterval The previous interval used. If supplied, the first michael@0: * interval that begins after aPrevInterval will be michael@0: * returned. May be nullptr. michael@0: * @param aReplacedInterval The interval that is being updated (if any). This michael@0: * used to ensure we don't return interval endpoints michael@0: * that are dependent on themselves. May be nullptr. michael@0: * @param aFixedBeginTime The time to use for the start of the interval. This michael@0: * is used when only the endpoint of the interval michael@0: * should be updated such as when the animation is in michael@0: * the ACTIVE state. May be nullptr. michael@0: * @param[out] aResult The next interval. Will be unchanged if no suitable michael@0: * interval was found (in which case false will be michael@0: * returned). michael@0: * @return true if a suitable interval was found, false otherwise. michael@0: */ michael@0: bool GetNextInterval(const nsSMILInterval* aPrevInterval, michael@0: const nsSMILInterval* aReplacedInterval, michael@0: const nsSMILInstanceTime* aFixedBeginTime, michael@0: nsSMILInterval& aResult) const; michael@0: nsSMILInstanceTime* GetNextGreater(const InstanceTimeList& aList, michael@0: const nsSMILTimeValue& aBase, michael@0: int32_t& aPosition) const; michael@0: nsSMILInstanceTime* GetNextGreaterOrEqual(const InstanceTimeList& aList, michael@0: const nsSMILTimeValue& aBase, michael@0: int32_t& aPosition) const; michael@0: nsSMILTimeValue CalcActiveEnd(const nsSMILTimeValue& aBegin, michael@0: const nsSMILTimeValue& aEnd) const; michael@0: nsSMILTimeValue GetRepeatDuration() const; michael@0: nsSMILTimeValue ApplyMinAndMax(const nsSMILTimeValue& aDuration) const; michael@0: nsSMILTime ActiveTimeToSimpleTime(nsSMILTime aActiveTime, michael@0: uint32_t& aRepeatIteration); michael@0: nsSMILInstanceTime* CheckForEarlyEnd( michael@0: const nsSMILTimeValue& aContainerTime) const; michael@0: void UpdateCurrentInterval(bool aForceChangeNotice = false); michael@0: void SampleSimpleTime(nsSMILTime aActiveTime); michael@0: void SampleFillValue(); michael@0: nsresult AddInstanceTimeFromCurrentTime(nsSMILTime aCurrentTime, michael@0: double aOffsetSeconds, bool aIsBegin); michael@0: void RegisterMilestone(); michael@0: bool GetNextMilestone(nsSMILMilestone& aNextMilestone) const; michael@0: michael@0: // Notification methods. Note that these notifications can result in nested michael@0: // calls to this same object. Therefore, michael@0: // (i) we should not perform notification until this object is in michael@0: // a consistent state to receive callbacks, and michael@0: // (ii) after calling these methods we must assume that the state of the michael@0: // element may have changed. michael@0: void NotifyNewInterval(); michael@0: void NotifyChangedInterval(nsSMILInterval* aInterval, michael@0: bool aBeginObjectChanged, michael@0: bool aEndObjectChanged); michael@0: michael@0: void FireTimeEventAsync(uint32_t aMsg, int32_t aDetail); michael@0: const nsSMILInstanceTime* GetEffectiveBeginInstance() const; michael@0: const nsSMILInterval* GetPreviousInterval() const; michael@0: bool HasPlayed() const { return !mOldIntervals.IsEmpty(); } michael@0: bool HasClientInFillRange() const; michael@0: bool EndHasEventConditions() const; michael@0: bool AreEndTimesDependentOn( michael@0: const nsSMILInstanceTime* aBase) const; michael@0: michael@0: // Reset the current interval by first passing ownership to a temporary michael@0: // variable so that if Unlink() results in us receiving a callback, michael@0: // mCurrentInterval will be nullptr and we will be in a consistent state. michael@0: void ResetCurrentInterval() michael@0: { michael@0: if (mCurrentInterval) { michael@0: // Transfer ownership to temp var. (This sets mCurrentInterval to null.) michael@0: nsAutoPtr interval(mCurrentInterval); michael@0: interval->Unlink(); michael@0: } michael@0: } michael@0: michael@0: // Hashtable callback methods michael@0: static PLDHashOperator NotifyNewIntervalCallback( michael@0: TimeValueSpecPtrKey* aKey, void* aData); michael@0: michael@0: // michael@0: // Members michael@0: // michael@0: mozilla::dom::SVGAnimationElement* mAnimationElement; // [weak] won't outlive michael@0: // owner michael@0: TimeValueSpecList mBeginSpecs; // [strong] michael@0: TimeValueSpecList mEndSpecs; // [strong] michael@0: michael@0: nsSMILTimeValue mSimpleDur; michael@0: michael@0: nsSMILRepeatCount mRepeatCount; michael@0: nsSMILTimeValue mRepeatDur; michael@0: michael@0: nsSMILTimeValue mMin; michael@0: nsSMILTimeValue mMax; michael@0: michael@0: enum nsSMILFillMode michael@0: { michael@0: FILL_REMOVE, michael@0: FILL_FREEZE michael@0: }; michael@0: nsSMILFillMode mFillMode; michael@0: static nsAttrValue::EnumTable sFillModeTable[]; michael@0: michael@0: enum nsSMILRestartMode michael@0: { michael@0: RESTART_ALWAYS, michael@0: RESTART_WHENNOTACTIVE, michael@0: RESTART_NEVER michael@0: }; michael@0: nsSMILRestartMode mRestartMode; michael@0: static nsAttrValue::EnumTable sRestartModeTable[]; michael@0: michael@0: InstanceTimeList mBeginInstances; michael@0: InstanceTimeList mEndInstances; michael@0: uint32_t mInstanceSerialIndex; michael@0: michael@0: nsSMILAnimationFunction* mClient; michael@0: nsAutoPtr mCurrentInterval; michael@0: IntervalList mOldIntervals; michael@0: uint32_t mCurrentRepeatIteration; michael@0: nsSMILMilestone mPrevRegisteredMilestone; michael@0: static const nsSMILMilestone sMaxMilestone; michael@0: static const uint8_t sMaxNumIntervals; michael@0: static const uint8_t sMaxNumInstanceTimes; michael@0: michael@0: // Set of dependent time value specs to be notified when establishing a new michael@0: // current interval. Change notifications and delete notifications are handled michael@0: // by the interval. michael@0: // michael@0: // [weak] The nsSMILTimeValueSpec objects register themselves and unregister michael@0: // on destruction. Likewise, we notify them when we are destroyed. michael@0: TimeValueSpecHashSet mTimeDependents; michael@0: michael@0: /** michael@0: * The state of the element in its life-cycle. These states are based on the michael@0: * element life-cycle described in SMILANIM 3.6.8 michael@0: */ michael@0: enum nsSMILElementState michael@0: { michael@0: STATE_STARTUP, michael@0: STATE_WAITING, michael@0: STATE_ACTIVE, michael@0: STATE_POSTACTIVE michael@0: }; michael@0: nsSMILElementState mElementState; michael@0: michael@0: enum nsSMILSeekState michael@0: { michael@0: SEEK_NOT_SEEKING, michael@0: SEEK_FORWARD_FROM_ACTIVE, michael@0: SEEK_FORWARD_FROM_INACTIVE, michael@0: SEEK_BACKWARD_FROM_ACTIVE, michael@0: SEEK_BACKWARD_FROM_INACTIVE michael@0: }; michael@0: nsSMILSeekState mSeekState; michael@0: michael@0: // Used to batch updates to the timing model michael@0: class AutoIntervalUpdateBatcher; michael@0: bool mDeferIntervalUpdates; michael@0: bool mDoDeferredUpdate; // Set if an update to the current interval was michael@0: // requested while mDeferIntervalUpdates was set michael@0: michael@0: // Stack-based helper class to call UpdateCurrentInterval when it is destroyed michael@0: class AutoIntervalUpdater; michael@0: michael@0: // Recursion depth checking michael@0: uint8_t mDeleteCount; michael@0: uint8_t mUpdateIntervalRecursionDepth; michael@0: static const uint8_t sMaxUpdateIntervalRecursionDepth; michael@0: }; michael@0: michael@0: #endif // NS_SMILTIMEDELEMENT_H_