dom/smil/nsSMILInterval.h

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/dom/smil/nsSMILInterval.h	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,85 @@
     1.4 +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
     1.5 +/* This Source Code Form is subject to the terms of the Mozilla Public
     1.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this
     1.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     1.8 +
     1.9 +#ifndef NS_SMILINTERVAL_H_
    1.10 +#define NS_SMILINTERVAL_H_
    1.11 +
    1.12 +#include "nsSMILInstanceTime.h"
    1.13 +#include "nsTArray.h"
    1.14 +
    1.15 +//----------------------------------------------------------------------
    1.16 +// nsSMILInterval class
    1.17 +//
    1.18 +// A structure consisting of a begin and end time. The begin time must be
    1.19 +// resolved (i.e. not indefinite or unresolved).
    1.20 +//
    1.21 +// For an overview of how this class is related to other SMIL time classes see
    1.22 +// the documentation in nsSMILTimeValue.h
    1.23 +
    1.24 +class nsSMILInterval
    1.25 +{
    1.26 +public:
    1.27 +  nsSMILInterval();
    1.28 +  nsSMILInterval(const nsSMILInterval& aOther);
    1.29 +  ~nsSMILInterval();
    1.30 +  void Unlink(bool aFiltered = false);
    1.31 +
    1.32 +  const nsSMILInstanceTime* Begin() const
    1.33 +  {
    1.34 +    NS_ABORT_IF_FALSE(mBegin && mEnd,
    1.35 +        "Requesting Begin() on un-initialized instance time");
    1.36 +    return mBegin;
    1.37 +  }
    1.38 +  nsSMILInstanceTime* Begin();
    1.39 +
    1.40 +  const nsSMILInstanceTime* End() const
    1.41 +  {
    1.42 +    NS_ABORT_IF_FALSE(mBegin && mEnd,
    1.43 +        "Requesting End() on un-initialized instance time");
    1.44 +    return mEnd;
    1.45 +  }
    1.46 +  nsSMILInstanceTime* End();
    1.47 +
    1.48 +  void SetBegin(nsSMILInstanceTime& aBegin);
    1.49 +  void SetEnd(nsSMILInstanceTime& aEnd);
    1.50 +  void Set(nsSMILInstanceTime& aBegin, nsSMILInstanceTime& aEnd)
    1.51 +  {
    1.52 +    SetBegin(aBegin);
    1.53 +    SetEnd(aEnd);
    1.54 +  }
    1.55 +
    1.56 +  void FixBegin();
    1.57 +  void FixEnd();
    1.58 +
    1.59 +  typedef nsTArray<nsRefPtr<nsSMILInstanceTime> > InstanceTimeList;
    1.60 +
    1.61 +  void AddDependentTime(nsSMILInstanceTime& aTime);
    1.62 +  void RemoveDependentTime(const nsSMILInstanceTime& aTime);
    1.63 +  void GetDependentTimes(InstanceTimeList& aTimes);
    1.64 +
    1.65 +  // Cue for assessing if this interval can be filtered
    1.66 +  bool IsDependencyChainLink() const;
    1.67 +
    1.68 +private:
    1.69 +  nsRefPtr<nsSMILInstanceTime> mBegin;
    1.70 +  nsRefPtr<nsSMILInstanceTime> mEnd;
    1.71 +
    1.72 +  // nsSMILInstanceTimes to notify when this interval is changed or deleted.
    1.73 +  InstanceTimeList mDependentTimes;
    1.74 +
    1.75 +  // Indicates if the end points of the interval are fixed or not.
    1.76 +  //
    1.77 +  // Note that this is not the same as having an end point whose TIME is fixed
    1.78 +  // (i.e. nsSMILInstanceTime::IsFixed() returns true). This is because it is
    1.79 +  // possible to have an end point with a fixed TIME and yet still update the
    1.80 +  // end point to refer to a different nsSMILInstanceTime object.
    1.81 +  //
    1.82 +  // However, if mBegin/EndFixed is true, then BOTH the nsSMILInstanceTime
    1.83 +  // OBJECT returned for that end point and its TIME value will not change.
    1.84 +  bool mBeginFixed;
    1.85 +  bool mEndFixed;
    1.86 +};
    1.87 +
    1.88 +#endif // NS_SMILINTERVAL_H_

mercurial