|
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/. */ |
|
5 |
|
6 #ifndef NS_SMILINTERVAL_H_ |
|
7 #define NS_SMILINTERVAL_H_ |
|
8 |
|
9 #include "nsSMILInstanceTime.h" |
|
10 #include "nsTArray.h" |
|
11 |
|
12 //---------------------------------------------------------------------- |
|
13 // nsSMILInterval class |
|
14 // |
|
15 // A structure consisting of a begin and end time. The begin time must be |
|
16 // resolved (i.e. not indefinite or unresolved). |
|
17 // |
|
18 // For an overview of how this class is related to other SMIL time classes see |
|
19 // the documentation in nsSMILTimeValue.h |
|
20 |
|
21 class nsSMILInterval |
|
22 { |
|
23 public: |
|
24 nsSMILInterval(); |
|
25 nsSMILInterval(const nsSMILInterval& aOther); |
|
26 ~nsSMILInterval(); |
|
27 void Unlink(bool aFiltered = false); |
|
28 |
|
29 const nsSMILInstanceTime* Begin() const |
|
30 { |
|
31 NS_ABORT_IF_FALSE(mBegin && mEnd, |
|
32 "Requesting Begin() on un-initialized instance time"); |
|
33 return mBegin; |
|
34 } |
|
35 nsSMILInstanceTime* Begin(); |
|
36 |
|
37 const nsSMILInstanceTime* End() const |
|
38 { |
|
39 NS_ABORT_IF_FALSE(mBegin && mEnd, |
|
40 "Requesting End() on un-initialized instance time"); |
|
41 return mEnd; |
|
42 } |
|
43 nsSMILInstanceTime* End(); |
|
44 |
|
45 void SetBegin(nsSMILInstanceTime& aBegin); |
|
46 void SetEnd(nsSMILInstanceTime& aEnd); |
|
47 void Set(nsSMILInstanceTime& aBegin, nsSMILInstanceTime& aEnd) |
|
48 { |
|
49 SetBegin(aBegin); |
|
50 SetEnd(aEnd); |
|
51 } |
|
52 |
|
53 void FixBegin(); |
|
54 void FixEnd(); |
|
55 |
|
56 typedef nsTArray<nsRefPtr<nsSMILInstanceTime> > InstanceTimeList; |
|
57 |
|
58 void AddDependentTime(nsSMILInstanceTime& aTime); |
|
59 void RemoveDependentTime(const nsSMILInstanceTime& aTime); |
|
60 void GetDependentTimes(InstanceTimeList& aTimes); |
|
61 |
|
62 // Cue for assessing if this interval can be filtered |
|
63 bool IsDependencyChainLink() const; |
|
64 |
|
65 private: |
|
66 nsRefPtr<nsSMILInstanceTime> mBegin; |
|
67 nsRefPtr<nsSMILInstanceTime> mEnd; |
|
68 |
|
69 // nsSMILInstanceTimes to notify when this interval is changed or deleted. |
|
70 InstanceTimeList mDependentTimes; |
|
71 |
|
72 // Indicates if the end points of the interval are fixed or not. |
|
73 // |
|
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. |
|
78 // |
|
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; |
|
83 }; |
|
84 |
|
85 #endif // NS_SMILINTERVAL_H_ |