/src/mozilla-central/dom/smil/nsSMILInterval.h
Line | Count | Source (jump to first uncovered line) |
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_SMILINTERVAL_H_ |
8 | | #define NS_SMILINTERVAL_H_ |
9 | | |
10 | | #include "nsSMILInstanceTime.h" |
11 | | #include "nsTArray.h" |
12 | | |
13 | | //---------------------------------------------------------------------- |
14 | | // nsSMILInterval class |
15 | | // |
16 | | // A structure consisting of a begin and end time. The begin time must be |
17 | | // resolved (i.e. not indefinite or unresolved). |
18 | | // |
19 | | // For an overview of how this class is related to other SMIL time classes see |
20 | | // the documentation in nsSMILTimeValue.h |
21 | | |
22 | | class nsSMILInterval |
23 | | { |
24 | | public: |
25 | | nsSMILInterval(); |
26 | | nsSMILInterval(const nsSMILInterval& aOther); |
27 | | ~nsSMILInterval(); |
28 | | void Unlink(bool aFiltered = false); |
29 | | |
30 | | const nsSMILInstanceTime* Begin() const |
31 | 0 | { |
32 | 0 | MOZ_ASSERT(mBegin && mEnd, |
33 | 0 | "Requesting Begin() on un-initialized instance time"); |
34 | 0 | return mBegin; |
35 | 0 | } |
36 | | nsSMILInstanceTime* Begin(); |
37 | | |
38 | | const nsSMILInstanceTime* End() const |
39 | 0 | { |
40 | 0 | MOZ_ASSERT(mBegin && mEnd, |
41 | 0 | "Requesting End() on un-initialized instance time"); |
42 | 0 | return mEnd; |
43 | 0 | } |
44 | | nsSMILInstanceTime* End(); |
45 | | |
46 | | void SetBegin(nsSMILInstanceTime& aBegin); |
47 | | void SetEnd(nsSMILInstanceTime& aEnd); |
48 | | void Set(nsSMILInstanceTime& aBegin, nsSMILInstanceTime& aEnd) |
49 | 0 | { |
50 | 0 | SetBegin(aBegin); |
51 | 0 | SetEnd(aEnd); |
52 | 0 | } |
53 | | |
54 | | void FixBegin(); |
55 | | void FixEnd(); |
56 | | |
57 | | typedef nsTArray<RefPtr<nsSMILInstanceTime> > InstanceTimeList; |
58 | | |
59 | | void AddDependentTime(nsSMILInstanceTime& aTime); |
60 | | void RemoveDependentTime(const nsSMILInstanceTime& aTime); |
61 | | void GetDependentTimes(InstanceTimeList& aTimes); |
62 | | |
63 | | // Cue for assessing if this interval can be filtered |
64 | | bool IsDependencyChainLink() const; |
65 | | |
66 | | private: |
67 | | RefPtr<nsSMILInstanceTime> mBegin; |
68 | | RefPtr<nsSMILInstanceTime> mEnd; |
69 | | |
70 | | // nsSMILInstanceTimes to notify when this interval is changed or deleted. |
71 | | InstanceTimeList mDependentTimes; |
72 | | |
73 | | // Indicates if the end points of the interval are fixed or not. |
74 | | // |
75 | | // Note that this is not the same as having an end point whose TIME is fixed |
76 | | // (i.e. nsSMILInstanceTime::IsFixed() returns true). This is because it is |
77 | | // possible to have an end point with a fixed TIME and yet still update the |
78 | | // end point to refer to a different nsSMILInstanceTime object. |
79 | | // |
80 | | // However, if mBegin/EndFixed is true, then BOTH the nsSMILInstanceTime |
81 | | // OBJECT returned for that end point and its TIME value will not change. |
82 | | bool mBeginFixed; |
83 | | bool mEndFixed; |
84 | | }; |
85 | | |
86 | | #endif // NS_SMILINTERVAL_H_ |