LCOV - code coverage report
Current view: top level - dom/smil - nsSMILTimedElement.h (source / functions) Hit Total Coverage
Test: output.info Lines: 0 15 0.0 %
Date: 2017-07-14 16:53:18 Functions: 0 6 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
       2             : /* vim: set ts=8 sts=2 et sw=2 tw=80: */
       3             : /* This Source Code Form is subject to the terms of the Mozilla Public
       4             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       5             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
       6             : 
       7             : #ifndef NS_SMILTIMEDELEMENT_H_
       8             : #define NS_SMILTIMEDELEMENT_H_
       9             : 
      10             : #include "mozilla/EventForwards.h"
      11             : #include "mozilla/Move.h"
      12             : #include "nsSMILInterval.h"
      13             : #include "nsSMILInstanceTime.h"
      14             : #include "nsSMILMilestone.h"
      15             : #include "nsSMILTimeValueSpec.h"
      16             : #include "nsSMILRepeatCount.h"
      17             : #include "nsSMILTypes.h"
      18             : #include "nsTArray.h"
      19             : #include "nsTHashtable.h"
      20             : #include "nsHashKeys.h"
      21             : #include "nsAutoPtr.h"
      22             : #include "nsAttrValue.h"
      23             : 
      24             : class nsSMILAnimationFunction;
      25             : class nsSMILTimeContainer;
      26             : class nsSMILTimeValue;
      27             : class nsIAtom;
      28             : 
      29             : namespace mozilla {
      30             : namespace dom {
      31             : class SVGAnimationElement;
      32             : } // namespace dom
      33             : } // namespace mozilla
      34             : 
      35             : //----------------------------------------------------------------------
      36             : // nsSMILTimedElement
      37             : 
      38             : class nsSMILTimedElement
      39             : {
      40             : public:
      41             :   nsSMILTimedElement();
      42             :   ~nsSMILTimedElement();
      43             : 
      44             :   typedef mozilla::dom::Element Element;
      45             : 
      46             :   /*
      47             :    * Sets the owning animation element which this class uses to convert between
      48             :    * container times and to register timebase elements.
      49             :    */
      50             :   void SetAnimationElement(mozilla::dom::SVGAnimationElement* aElement);
      51             : 
      52             :   /*
      53             :    * Returns the time container with which this timed element is associated or
      54             :    * nullptr if it is not associated with a time container.
      55             :    */
      56             :   nsSMILTimeContainer* GetTimeContainer();
      57             : 
      58             :   /*
      59             :    * Returns the element targeted by the animation element. Needed for
      60             :    * registering event listeners against the appropriate element.
      61             :    */
      62             :   mozilla::dom::Element* GetTargetElement();
      63             : 
      64             :   /**
      65             :    * Methods for supporting the nsIDOMElementTimeControl interface.
      66             :    */
      67             : 
      68             :   /*
      69             :    * Adds a new begin instance time at the current container time plus or minus
      70             :    * the specified offset.
      71             :    *
      72             :    * @param aOffsetSeconds A real number specifying the number of seconds to add
      73             :    *                       to the current container time.
      74             :    * @return NS_OK if the operation succeeeded, or an error code otherwise.
      75             :    */
      76             :   nsresult BeginElementAt(double aOffsetSeconds);
      77             : 
      78             :   /*
      79             :    * Adds a new end instance time at the current container time plus or minus
      80             :    * the specified offset.
      81             :    *
      82             :    * @param aOffsetSeconds A real number specifying the number of seconds to add
      83             :    *                       to the current container time.
      84             :    * @return NS_OK if the operation succeeeded, or an error code otherwise.
      85             :    */
      86             :   nsresult EndElementAt(double aOffsetSeconds);
      87             : 
      88             :   /**
      89             :    * Methods for supporting the nsSVGAnimationElement interface.
      90             :    */
      91             : 
      92             :   /**
      93             :    * According to SVG 1.1 SE this returns
      94             :    *
      95             :    *   the begin time, in seconds, for this animation element's current
      96             :    *   interval, if it exists, regardless of whether the interval has begun yet.
      97             :    *
      98             :    * @return the start time as defined above in milliseconds or an unresolved
      99             :    * time if there is no current interval.
     100             :    */
     101             :   nsSMILTimeValue GetStartTime() const;
     102             : 
     103             :   /**
     104             :    * Returns the simple duration of this element.
     105             :    *
     106             :    * @return the simple duration in milliseconds or INDEFINITE.
     107             :    */
     108           0 :   nsSMILTimeValue GetSimpleDuration() const
     109             :   {
     110           0 :     return mSimpleDur;
     111             :   }
     112             : 
     113             :   /**
     114             :    * Methods for supporting hyperlinking
     115             :    */
     116             : 
     117             :   /**
     118             :    * Internal SMIL methods
     119             :    */
     120             : 
     121             :   /**
     122             :    * Returns the time to seek the document to when this element is targetted by
     123             :    * a hyperlink.
     124             :    *
     125             :    * The behavior is defined here:
     126             :    *   http://www.w3.org/TR/smil-animation/#HyperlinkSemantics
     127             :    *
     128             :    * It is very similar to GetStartTime() with the exception that when the
     129             :    * element is not active, the begin time of the *first* interval is returned.
     130             :    *
     131             :    * @return the time to seek the documen to in milliseconds or an unresolved
     132             :    * time if there is no resolved interval.
     133             :    */
     134             :   nsSMILTimeValue GetHyperlinkTime() const;
     135             : 
     136             :   /**
     137             :    * Adds an instance time object this element's list of instance times.
     138             :    * These instance times are used when creating intervals.
     139             :    *
     140             :    * This method is typically called by an nsSMILTimeValueSpec.
     141             :    *
     142             :    * @param aInstanceTime   The time to add, expressed in container time.
     143             :    * @param aIsBegin        true if the time to be added represents a begin
     144             :    *                        time or false if it represents an end time.
     145             :    */
     146             :   void AddInstanceTime(nsSMILInstanceTime* aInstanceTime, bool aIsBegin);
     147             : 
     148             :   /**
     149             :    * Requests this element update the given instance time.
     150             :    *
     151             :    * This method is typically called by a child nsSMILTimeValueSpec.
     152             :    *
     153             :    * @param aInstanceTime   The instance time to update.
     154             :    * @param aUpdatedTime    The time to update aInstanceTime with.
     155             :    * @param aDependentTime  The instance time upon which aInstanceTime should be
     156             :    *                        based.
     157             :    * @param aIsBegin        true if the time to be updated represents a begin
     158             :    *                        instance time or false if it represents an end
     159             :    *                        instance time.
     160             :    */
     161             :   void UpdateInstanceTime(nsSMILInstanceTime* aInstanceTime,
     162             :                           nsSMILTimeValue& aUpdatedTime,
     163             :                           bool aIsBegin);
     164             : 
     165             :   /**
     166             :    * Removes an instance time object from this element's list of instance times.
     167             :    *
     168             :    * This method is typically called by a child nsSMILTimeValueSpec.
     169             :    *
     170             :    * @param aInstanceTime   The instance time to remove.
     171             :    * @param aIsBegin        true if the time to be removed represents a begin
     172             :    *                        time or false if it represents an end time.
     173             :    */
     174             :   void RemoveInstanceTime(nsSMILInstanceTime* aInstanceTime, bool aIsBegin);
     175             : 
     176             :   /**
     177             :    * Removes all the instance times associated with the given
     178             :    * nsSMILTimeValueSpec object. Used when an ID assignment changes and hence
     179             :    * all the previously associated instance times become invalid.
     180             :    *
     181             :    * @param aSpec    The nsSMILTimeValueSpec object whose created
     182             :    *                 nsSMILInstanceTime's should be removed.
     183             :    * @param aIsBegin true if the times to be removed represent begin
     184             :    *                 times or false if they are end times.
     185             :    */
     186             :   void RemoveInstanceTimesForCreator(const nsSMILTimeValueSpec* aSpec,
     187             :                                      bool aIsBegin);
     188             : 
     189             :   /**
     190             :    * Sets the object that will be called by this timed element each time it is
     191             :    * sampled.
     192             :    *
     193             :    * In Schmitz's model it is possible to associate several time clients with
     194             :    * a timed element but for now we only allow one.
     195             :    *
     196             :    * @param aClient   The time client to associate. Any previous time client
     197             :    *                  will be disassociated and no longer sampled. Setting this
     198             :    *                  to nullptr will simply disassociate the previous client, if
     199             :    *                  any.
     200             :    */
     201             :   void SetTimeClient(nsSMILAnimationFunction* aClient);
     202             : 
     203             :   /**
     204             :    * Samples the object at the given container time. Timing intervals are
     205             :    * updated and if this element is active at the given time the associated time
     206             :    * client will be sampled with the appropriate simple time.
     207             :    *
     208             :    * @param aContainerTime The container time at which to sample.
     209             :    */
     210             :   void SampleAt(nsSMILTime aContainerTime);
     211             : 
     212             :   /**
     213             :    * Performs a special sample for the end of an interval. Such a sample should
     214             :    * only advance the timed element (and any dependent elements) to the waiting
     215             :    * or postactive state. It should not cause a transition to the active state.
     216             :    * Transition to the active state is only performed on a regular SampleAt.
     217             :    *
     218             :    * This allows all interval ends at a given time to be processed first and
     219             :    * hence the new interval can be established based on full information of the
     220             :    * available instance times.
     221             :    *
     222             :    * @param aContainerTime The container time at which to sample.
     223             :    */
     224             :   void SampleEndAt(nsSMILTime aContainerTime);
     225             : 
     226             :   /**
     227             :    * Informs the timed element that its time container has changed time
     228             :    * relative to document time. The timed element therefore needs to update its
     229             :    * dependent elements (which may belong to a different time container) so they
     230             :    * can re-resolve their times.
     231             :    */
     232             :   void HandleContainerTimeChange();
     233             : 
     234             :   /**
     235             :    * Resets this timed element's accumulated times and intervals back to start
     236             :    * up state.
     237             :    *
     238             :    * This is used for backwards seeking where rather than accumulating
     239             :    * historical timing state and winding it back, we reset the element and seek
     240             :    * forwards.
     241             :    */
     242             :   void Rewind();
     243             : 
     244             :   /**
     245             :    * Marks this element as disabled or not. If the element is disabled, it
     246             :    * will ignore any future samples and discard any accumulated timing state.
     247             :    *
     248             :    * This is used by SVG to "turn off" timed elements when the associated
     249             :    * animation element has failing conditional processing tests.
     250             :    *
     251             :    * Returns true if the disabled state of the timed element was changed
     252             :    * as a result of this call (i.e. it was not a redundant call).
     253             :    */
     254             :   bool SetIsDisabled(bool aIsDisabled);
     255             : 
     256             :   /**
     257             :    * Attempts to set an attribute on this timed element.
     258             :    *
     259             :    * @param aAttribute  The name of the attribute to set. The namespace of this
     260             :    *                    attribute is not specified as it is checked by the host
     261             :    *                    element. Only attributes in the namespace defined for
     262             :    *                    SMIL attributes in the host language are passed to the
     263             :    *                    timed element.
     264             :    * @param aValue      The attribute value.
     265             :    * @param aResult     The nsAttrValue object that may be used for storing the
     266             :    *                    parsed result.
     267             :    * @param aContextNode The element to use for context when resolving
     268             :    *                     references to other elements.
     269             :    * @param[out] aParseResult The result of parsing the attribute. Will be set
     270             :    *                          to NS_OK if parsing is successful.
     271             :    *
     272             :    * @return true if the given attribute is a timing attribute, false
     273             :    * otherwise.
     274             :    */
     275             :   bool SetAttr(nsIAtom* aAttribute, const nsAString& aValue,
     276             :                  nsAttrValue& aResult, Element* aContextNode,
     277             :                  nsresult* aParseResult = nullptr);
     278             : 
     279             :   /**
     280             :    * Attempts to unset an attribute on this timed element.
     281             :    *
     282             :    * @param aAttribute  The name of the attribute to set. As with SetAttr the
     283             :    *                    namespace of the attribute is not specified (see
     284             :    *                    SetAttr).
     285             :    *
     286             :    * @return true if the given attribute is a timing attribute, false
     287             :    * otherwise.
     288             :    */
     289             :   bool UnsetAttr(nsIAtom* aAttribute);
     290             : 
     291             :   /**
     292             :    * Adds a syncbase dependency to the list of dependents that will be notified
     293             :    * when this timed element creates, deletes, or updates its current interval.
     294             :    *
     295             :    * @param aDependent  The nsSMILTimeValueSpec object to notify. A raw pointer
     296             :    *                    to this object will be stored. Therefore it is necessary
     297             :    *                    for the object to be explicitly unregistered (with
     298             :    *                    RemoveDependent) when it is destroyed.
     299             :    */
     300             :   void AddDependent(nsSMILTimeValueSpec& aDependent);
     301             : 
     302             :   /**
     303             :    * Removes a syncbase dependency from the list of dependents that are notified
     304             :    * when the current interval is modified.
     305             :    *
     306             :    * @param aDependent  The nsSMILTimeValueSpec object to unregister.
     307             :    */
     308             :   void RemoveDependent(nsSMILTimeValueSpec& aDependent);
     309             : 
     310             :   /**
     311             :    * Determines if this timed element is dependent on the given timed element's
     312             :    * begin time for the interval currently in effect. Whilst the element is in
     313             :    * the active state this is the current interval and in the postactive or
     314             :    * waiting state this is the previous interval if one exists. In all other
     315             :    * cases the element is not considered a time dependent of any other element.
     316             :    *
     317             :    * @param aOther    The potential syncbase element.
     318             :    * @return true if this timed element's begin time for the currently
     319             :    * effective interval is directly or indirectly derived from aOther, false
     320             :    * otherwise.
     321             :    */
     322             :   bool IsTimeDependent(const nsSMILTimedElement& aOther) const;
     323             : 
     324             :   /**
     325             :    * Called when the timed element has been bound to the document so that
     326             :    * references from this timed element to other elements can be resolved.
     327             :    *
     328             :    * @param aContextNode  The node which provides the necessary context for
     329             :    *                      resolving references. This is typically the element in
     330             :    *                      the host language that owns this timed element. Should
     331             :    *                      not be null.
     332             :    */
     333             :   void BindToTree(nsIContent* aContextNode);
     334             : 
     335             :   /**
     336             :    * Called when the target of the animation has changed so that event
     337             :    * registrations can be updated.
     338             :    */
     339             :   void HandleTargetElementChange(mozilla::dom::Element* aNewTarget);
     340             : 
     341             :   /**
     342             :    * Called when the timed element has been removed from a document so that
     343             :    * references to other elements can be broken.
     344             :    */
     345           0 :   void DissolveReferences() { Unlink(); }
     346             : 
     347             :   // Cycle collection
     348             :   void Traverse(nsCycleCollectionTraversalCallback* aCallback);
     349             :   void Unlink();
     350             : 
     351             :   typedef bool (*RemovalTestFunction)(nsSMILInstanceTime* aInstance);
     352             : 
     353             : protected:
     354             :   // Typedefs
     355             :   typedef nsTArray<nsAutoPtr<nsSMILTimeValueSpec> > TimeValueSpecList;
     356             :   typedef nsTArray<RefPtr<nsSMILInstanceTime> >   InstanceTimeList;
     357             :   typedef nsTArray<nsAutoPtr<nsSMILInterval> >      IntervalList;
     358             :   typedef nsPtrHashKey<nsSMILTimeValueSpec> TimeValueSpecPtrKey;
     359             :   typedef nsTHashtable<TimeValueSpecPtrKey> TimeValueSpecHashSet;
     360             : 
     361             :   // Helper classes
     362             :   class InstanceTimeComparator {
     363             :     public:
     364             :       bool Equals(const nsSMILInstanceTime* aElem1,
     365             :                     const nsSMILInstanceTime* aElem2) const;
     366             :       bool LessThan(const nsSMILInstanceTime* aElem1,
     367             :                       const nsSMILInstanceTime* aElem2) const;
     368             :   };
     369             : 
     370             :   // Templated helper functions
     371             :   template <class TestFunctor>
     372             :   void RemoveInstanceTimes(InstanceTimeList& aArray, TestFunctor& aTest);
     373             : 
     374             :   //
     375             :   // Implementation helpers
     376             :   //
     377             : 
     378             :   nsresult          SetBeginSpec(const nsAString& aBeginSpec,
     379             :                                  Element* aContextNode,
     380             :                                  RemovalTestFunction aRemove);
     381             :   nsresult          SetEndSpec(const nsAString& aEndSpec,
     382             :                                Element* aContextNode,
     383             :                                RemovalTestFunction aRemove);
     384             :   nsresult          SetSimpleDuration(const nsAString& aDurSpec);
     385             :   nsresult          SetMin(const nsAString& aMinSpec);
     386             :   nsresult          SetMax(const nsAString& aMaxSpec);
     387             :   nsresult          SetRestart(const nsAString& aRestartSpec);
     388             :   nsresult          SetRepeatCount(const nsAString& aRepeatCountSpec);
     389             :   nsresult          SetRepeatDur(const nsAString& aRepeatDurSpec);
     390             :   nsresult          SetFillMode(const nsAString& aFillModeSpec);
     391             : 
     392             :   void              UnsetBeginSpec(RemovalTestFunction aRemove);
     393             :   void              UnsetEndSpec(RemovalTestFunction aRemove);
     394             :   void              UnsetSimpleDuration();
     395             :   void              UnsetMin();
     396             :   void              UnsetMax();
     397             :   void              UnsetRestart();
     398             :   void              UnsetRepeatCount();
     399             :   void              UnsetRepeatDur();
     400             :   void              UnsetFillMode();
     401             : 
     402             :   nsresult          SetBeginOrEndSpec(const nsAString& aSpec,
     403             :                                       Element* aContextNode,
     404             :                                       bool aIsBegin,
     405             :                                       RemovalTestFunction aRemove);
     406             :   void              ClearSpecs(TimeValueSpecList& aSpecs,
     407             :                                InstanceTimeList& aInstances,
     408             :                                RemovalTestFunction aRemove);
     409             :   void              ClearIntervals();
     410             :   void              DoSampleAt(nsSMILTime aContainerTime, bool aEndOnly);
     411             : 
     412             :   /**
     413             :    * Helper function to check for an early end and, if necessary, update the
     414             :    * current interval accordingly.
     415             :    *
     416             :    * See SMIL 3.0, section 5.4.5, Element life cycle, "Active Time - Playing an
     417             :    * interval" for a description of ending early.
     418             :    *
     419             :    * @param aSampleTime The current sample time. Early ends should only be
     420             :    *                    applied at the last possible moment (i.e. if they are at
     421             :    *                    or before the current sample time) and only if the
     422             :    *                    current interval is not already ending.
     423             :    * @return true if the end time of the current interval was updated,
     424             :    *         false otherwise.
     425             :    */
     426             :   bool ApplyEarlyEnd(const nsSMILTimeValue& aSampleTime);
     427             : 
     428             :   /**
     429             :    * Clears certain state in response to the element restarting.
     430             :    *
     431             :    * This state is described in SMIL 3.0, section 5.4.3, Resetting element state
     432             :    */
     433             :   void Reset();
     434             : 
     435             :   /**
     436             :    * Clears all accumulated timing state except for those instance times for
     437             :    * which aRemove does not return true.
     438             :    *
     439             :    * Unlike the Reset method which only clears instance times, this clears the
     440             :    * element's state, intervals (including current interval), and tells the
     441             :    * client animation function to stop applying a result. In effect, it returns
     442             :    * the element to its initial state but preserves any instance times excluded
     443             :    * by the passed-in function.
     444             :    */
     445             :   void ClearTimingState(RemovalTestFunction aRemove);
     446             : 
     447             :   /**
     448             :    * Recreates timing state by re-applying begin/end attributes specified on
     449             :    * the associated animation element.
     450             :    *
     451             :    * Note that this does not completely restore the information cleared by
     452             :    * ClearTimingState since it leaves the element in the startup state.
     453             :    * The element state will be updated on the next sample.
     454             :    */
     455             :   void RebuildTimingState(RemovalTestFunction aRemove);
     456             : 
     457             :   /**
     458             :    * Completes a seek operation by sending appropriate events and, in the case
     459             :    * of a backwards seek, updating the state of timing information that was
     460             :    * previously considered historical.
     461             :    */
     462             :   void DoPostSeek();
     463             : 
     464             :   /**
     465             :    * Unmarks instance times that were previously preserved because they were
     466             :    * considered important historical milestones but are no longer such because
     467             :    * a backwards seek has been performed.
     468             :    */
     469             :   void UnpreserveInstanceTimes(InstanceTimeList& aList);
     470             : 
     471             :   /**
     472             :    * Helper function to iterate through this element's accumulated timing
     473             :    * information (specifically old nsSMILIntervals and nsSMILTimeInstanceTimes)
     474             :    * and discard items that are no longer needed or exceed some threshold of
     475             :    * accumulated state.
     476             :    */
     477             :   void FilterHistory();
     478             : 
     479             :   // Helper functions for FilterHistory to clear old nsSMILIntervals and
     480             :   // nsSMILInstanceTimes respectively.
     481             :   void FilterIntervals();
     482             :   void FilterInstanceTimes(InstanceTimeList& aList);
     483             : 
     484             :   /**
     485             :    * Calculates the next acceptable interval for this element after the
     486             :    * specified interval, or, if no previous interval is specified, it will be
     487             :    * the first interval with an end time after t=0.
     488             :    *
     489             :    * @see SMILANIM 3.6.8
     490             :    *
     491             :    * @param aPrevInterval   The previous interval used. If supplied, the first
     492             :    *                        interval that begins after aPrevInterval will be
     493             :    *                        returned. May be nullptr.
     494             :    * @param aReplacedInterval The interval that is being updated (if any). This
     495             :    *                        used to ensure we don't return interval endpoints
     496             :    *                        that are dependent on themselves. May be nullptr.
     497             :    * @param aFixedBeginTime The time to use for the start of the interval. This
     498             :    *                        is used when only the endpoint of the interval
     499             :    *                        should be updated such as when the animation is in
     500             :    *                        the ACTIVE state. May be nullptr.
     501             :    * @param[out] aResult    The next interval. Will be unchanged if no suitable
     502             :    *                        interval was found (in which case false will be
     503             :    *                        returned).
     504             :    * @return  true if a suitable interval was found, false otherwise.
     505             :    */
     506             :   bool              GetNextInterval(const nsSMILInterval* aPrevInterval,
     507             :                                     const nsSMILInterval* aReplacedInterval,
     508             :                                     const nsSMILInstanceTime* aFixedBeginTime,
     509             :                                     nsSMILInterval& aResult) const;
     510             :   nsSMILInstanceTime* GetNextGreater(const InstanceTimeList& aList,
     511             :                                      const nsSMILTimeValue& aBase,
     512             :                                      int32_t& aPosition) const;
     513             :   nsSMILInstanceTime* GetNextGreaterOrEqual(const InstanceTimeList& aList,
     514             :                                             const nsSMILTimeValue& aBase,
     515             :                                             int32_t& aPosition) const;
     516             :   nsSMILTimeValue   CalcActiveEnd(const nsSMILTimeValue& aBegin,
     517             :                                   const nsSMILTimeValue& aEnd) const;
     518             :   nsSMILTimeValue   GetRepeatDuration() const;
     519             :   nsSMILTimeValue   ApplyMinAndMax(const nsSMILTimeValue& aDuration) const;
     520             :   nsSMILTime        ActiveTimeToSimpleTime(nsSMILTime aActiveTime,
     521             :                                            uint32_t& aRepeatIteration);
     522             :   nsSMILInstanceTime* CheckForEarlyEnd(
     523             :                         const nsSMILTimeValue& aContainerTime) const;
     524             :   void              UpdateCurrentInterval(bool aForceChangeNotice = false);
     525             :   void              SampleSimpleTime(nsSMILTime aActiveTime);
     526             :   void              SampleFillValue();
     527             :   nsresult          AddInstanceTimeFromCurrentTime(nsSMILTime aCurrentTime,
     528             :                         double aOffsetSeconds, bool aIsBegin);
     529             :   void              RegisterMilestone();
     530             :   bool              GetNextMilestone(nsSMILMilestone& aNextMilestone) const;
     531             : 
     532             :   // Notification methods. Note that these notifications can result in nested
     533             :   // calls to this same object. Therefore,
     534             :   // (i)  we should not perform notification until this object is in
     535             :   //      a consistent state to receive callbacks, and
     536             :   // (ii) after calling these methods we must assume that the state of the
     537             :   //      element may have changed.
     538             :   void              NotifyNewInterval();
     539             :   void              NotifyChangedInterval(nsSMILInterval* aInterval,
     540             :                                           bool aBeginObjectChanged,
     541             :                                           bool aEndObjectChanged);
     542             : 
     543             :   void              FireTimeEventAsync(mozilla::EventMessage aMsg,
     544             :                                        int32_t aDetail);
     545             :   const nsSMILInstanceTime* GetEffectiveBeginInstance() const;
     546             :   const nsSMILInterval* GetPreviousInterval() const;
     547           0 :   bool              HasPlayed() const { return !mOldIntervals.IsEmpty(); }
     548             :   bool              HasClientInFillRange() const;
     549             :   bool              EndHasEventConditions() const;
     550             :   bool              AreEndTimesDependentOn(
     551             :                       const nsSMILInstanceTime* aBase) const;
     552             : 
     553             :   // Reset the current interval by first passing ownership to a temporary
     554             :   // variable so that if Unlink() results in us receiving a callback,
     555             :   // mCurrentInterval will be nullptr and we will be in a consistent state.
     556           0 :   void ResetCurrentInterval()
     557             :   {
     558           0 :     if (mCurrentInterval) {
     559             :       // Transfer ownership to temp var. (This sets mCurrentInterval to null.)
     560           0 :       nsAutoPtr<nsSMILInterval> interval(mozilla::Move(mCurrentInterval));
     561           0 :       interval->Unlink();
     562             :     }
     563           0 :   }
     564             : 
     565             :   //
     566             :   // Members
     567             :   //
     568             :   mozilla::dom::SVGAnimationElement* mAnimationElement; // [weak] won't outlive
     569             :                                                         // owner
     570             :   TimeValueSpecList               mBeginSpecs; // [strong]
     571             :   TimeValueSpecList               mEndSpecs; // [strong]
     572             : 
     573             :   nsSMILTimeValue                 mSimpleDur;
     574             : 
     575             :   nsSMILRepeatCount               mRepeatCount;
     576             :   nsSMILTimeValue                 mRepeatDur;
     577             : 
     578             :   nsSMILTimeValue                 mMin;
     579             :   nsSMILTimeValue                 mMax;
     580             : 
     581             :   enum nsSMILFillMode : uint8_t
     582             :   {
     583             :     FILL_REMOVE,
     584             :     FILL_FREEZE
     585             :   };
     586             :   nsSMILFillMode                  mFillMode;
     587             :   static const nsAttrValue::EnumTable sFillModeTable[];
     588             : 
     589             :   enum nsSMILRestartMode : uint8_t
     590             :   {
     591             :     RESTART_ALWAYS,
     592             :     RESTART_WHENNOTACTIVE,
     593             :     RESTART_NEVER
     594             :   };
     595             :   nsSMILRestartMode               mRestartMode;
     596             :   static const nsAttrValue::EnumTable sRestartModeTable[];
     597             : 
     598             :   InstanceTimeList                mBeginInstances;
     599             :   InstanceTimeList                mEndInstances;
     600             :   uint32_t                        mInstanceSerialIndex;
     601             : 
     602             :   nsSMILAnimationFunction*        mClient;
     603             :   nsAutoPtr<nsSMILInterval>       mCurrentInterval;
     604             :   IntervalList                    mOldIntervals;
     605             :   uint32_t                        mCurrentRepeatIteration;
     606             :   nsSMILMilestone                 mPrevRegisteredMilestone;
     607             :   static const nsSMILMilestone    sMaxMilestone;
     608             :   static const uint8_t            sMaxNumIntervals;
     609             :   static const uint8_t            sMaxNumInstanceTimes;
     610             : 
     611             :   // Set of dependent time value specs to be notified when establishing a new
     612             :   // current interval. Change notifications and delete notifications are handled
     613             :   // by the interval.
     614             :   //
     615             :   // [weak] The nsSMILTimeValueSpec objects register themselves and unregister
     616             :   // on destruction. Likewise, we notify them when we are destroyed.
     617             :   TimeValueSpecHashSet mTimeDependents;
     618             : 
     619             :   /**
     620             :    * The state of the element in its life-cycle. These states are based on the
     621             :    * element life-cycle described in SMILANIM 3.6.8
     622             :    */
     623             :   enum nsSMILElementState
     624             :   {
     625             :     STATE_STARTUP,
     626             :     STATE_WAITING,
     627             :     STATE_ACTIVE,
     628             :     STATE_POSTACTIVE
     629             :   };
     630             :   nsSMILElementState              mElementState;
     631             : 
     632             :   enum nsSMILSeekState
     633             :   {
     634             :     SEEK_NOT_SEEKING,
     635             :     SEEK_FORWARD_FROM_ACTIVE,
     636             :     SEEK_FORWARD_FROM_INACTIVE,
     637             :     SEEK_BACKWARD_FROM_ACTIVE,
     638             :     SEEK_BACKWARD_FROM_INACTIVE
     639             :   };
     640             :   nsSMILSeekState                 mSeekState;
     641             : 
     642             :   // Used to batch updates to the timing model
     643             :   class AutoIntervalUpdateBatcher;
     644             :   bool mDeferIntervalUpdates;
     645             :   bool mDoDeferredUpdate; // Set if an update to the current interval was
     646             :                           // requested while mDeferIntervalUpdates was set
     647             :   bool mIsDisabled;
     648             : 
     649             :   // Stack-based helper class to call UpdateCurrentInterval when it is destroyed
     650             :   class AutoIntervalUpdater;
     651             : 
     652             :   // Recursion depth checking
     653             :   uint8_t              mDeleteCount;
     654             :   uint8_t              mUpdateIntervalRecursionDepth;
     655             :   static const uint8_t sMaxUpdateIntervalRecursionDepth;
     656             : };
     657             : 
     658             : inline void
     659           0 : ImplCycleCollectionUnlink(nsSMILTimedElement& aField)
     660             : {
     661           0 :   aField.Unlink();
     662           0 : }
     663             : 
     664             : inline void
     665           0 : ImplCycleCollectionTraverse(nsCycleCollectionTraversalCallback& aCallback,
     666             :                             nsSMILTimedElement& aField,
     667             :                             const char* aName,
     668             :                             uint32_t aFlags = 0)
     669             : {
     670           0 :   aField.Traverse(&aCallback);
     671           0 : }
     672             : 
     673             : #endif // NS_SMILTIMEDELEMENT_H_

Generated by: LCOV version 1.13