Bumping manifests a=b2g-bump
[gecko.git] / dom / smil / nsSMILInterval.h
blob2f7eafd2b3b9683657a6d0463914eb8fba9e82b0
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 #ifndef NS_SMILINTERVAL_H_
7 #define NS_SMILINTERVAL_H_
9 #include "nsSMILInstanceTime.h"
10 #include "nsTArray.h"
12 //----------------------------------------------------------------------
13 // nsSMILInterval class
15 // A structure consisting of a begin and end time. The begin time must be
16 // resolved (i.e. not indefinite or unresolved).
18 // For an overview of how this class is related to other SMIL time classes see
19 // the documentation in nsSMILTimeValue.h
21 class nsSMILInterval
23 public:
24 nsSMILInterval();
25 nsSMILInterval(const nsSMILInterval& aOther);
26 ~nsSMILInterval();
27 void Unlink(bool aFiltered = false);
29 const nsSMILInstanceTime* Begin() const
31 NS_ABORT_IF_FALSE(mBegin && mEnd,
32 "Requesting Begin() on un-initialized instance time");
33 return mBegin;
35 nsSMILInstanceTime* Begin();
37 const nsSMILInstanceTime* End() const
39 NS_ABORT_IF_FALSE(mBegin && mEnd,
40 "Requesting End() on un-initialized instance time");
41 return mEnd;
43 nsSMILInstanceTime* End();
45 void SetBegin(nsSMILInstanceTime& aBegin);
46 void SetEnd(nsSMILInstanceTime& aEnd);
47 void Set(nsSMILInstanceTime& aBegin, nsSMILInstanceTime& aEnd)
49 SetBegin(aBegin);
50 SetEnd(aEnd);
53 void FixBegin();
54 void FixEnd();
56 typedef nsTArray<nsRefPtr<nsSMILInstanceTime> > InstanceTimeList;
58 void AddDependentTime(nsSMILInstanceTime& aTime);
59 void RemoveDependentTime(const nsSMILInstanceTime& aTime);
60 void GetDependentTimes(InstanceTimeList& aTimes);
62 // Cue for assessing if this interval can be filtered
63 bool IsDependencyChainLink() const;
65 private:
66 nsRefPtr<nsSMILInstanceTime> mBegin;
67 nsRefPtr<nsSMILInstanceTime> mEnd;
69 // nsSMILInstanceTimes to notify when this interval is changed or deleted.
70 InstanceTimeList mDependentTimes;
72 // Indicates if the end points of the interval are fixed or not.
74 // Note that this is not the same as having an end point whose TIME is fixed
75 // (i.e. nsSMILInstanceTime::IsFixed() returns true). This is because it is
76 // possible to have an end point with a fixed TIME and yet still update the
77 // end point to refer to a different nsSMILInstanceTime object.
79 // However, if mBegin/EndFixed is true, then BOTH the nsSMILInstanceTime
80 // OBJECT returned for that end point and its TIME value will not change.
81 bool mBeginFixed;
82 bool mEndFixed;
85 #endif // NS_SMILINTERVAL_H_