no bug - Bumping Firefox l10n changesets r=release a=l10n-bump DONTBUILD CLOSED TREE
[gecko.git] / dom / smil / SMILInterval.h
bloba569fce14753fa738c7f872286e412a5a1936784
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/. */
7 #ifndef DOM_SMIL_SMILINTERVAL_H_
8 #define DOM_SMIL_SMILINTERVAL_H_
10 #include "mozilla/SMILInstanceTime.h"
11 #include "nsTArray.h"
13 namespace mozilla {
15 //----------------------------------------------------------------------
16 // SMILInterval class
18 // A structure consisting of a begin and end time. The begin time must be
19 // resolved (i.e. not indefinite or unresolved).
21 // For an overview of how this class is related to other SMIL time classes see
22 // the documentation in SMILTimeValue.h
24 class SMILInterval {
25 public:
26 SMILInterval();
27 SMILInterval(const SMILInterval& aOther);
28 ~SMILInterval();
29 void Unlink(bool aFiltered = false);
31 const SMILInstanceTime* Begin() const {
32 MOZ_ASSERT(mBegin && mEnd,
33 "Requesting Begin() on un-initialized instance time");
34 return mBegin;
36 SMILInstanceTime* Begin();
38 const SMILInstanceTime* End() const {
39 MOZ_ASSERT(mBegin && mEnd,
40 "Requesting End() on un-initialized instance time");
41 return mEnd;
43 SMILInstanceTime* End();
45 void SetBegin(SMILInstanceTime& aBegin);
46 void SetEnd(SMILInstanceTime& aEnd);
47 void Set(SMILInstanceTime& aBegin, SMILInstanceTime& aEnd) {
48 SetBegin(aBegin);
49 SetEnd(aEnd);
52 void FixBegin();
53 void FixEnd();
55 using InstanceTimeList = nsTArray<RefPtr<SMILInstanceTime>>;
57 void AddDependentTime(SMILInstanceTime& aTime);
58 void RemoveDependentTime(const SMILInstanceTime& aTime);
59 void GetDependentTimes(InstanceTimeList& aTimes);
61 // Cue for assessing if this interval can be filtered
62 bool IsDependencyChainLink() const;
64 private:
65 RefPtr<SMILInstanceTime> mBegin;
66 RefPtr<SMILInstanceTime> mEnd;
68 // SMILInstanceTimes to notify when this interval is changed or deleted.
69 InstanceTimeList mDependentTimes;
71 // Indicates if the end points of the interval are fixed or not.
73 // Note that this is not the same as having an end point whose TIME is fixed
74 // (i.e. SMILInstanceTime::IsFixed() returns true). This is because it is
75 // possible to have an end point with a fixed TIME and yet still update the
76 // end point to refer to a different SMILInstanceTime object.
78 // However, if mBegin/EndFixed is true, then BOTH the SMILInstanceTime
79 // OBJECT returned for that end point and its TIME value will not change.
80 bool mBeginFixed;
81 bool mEndFixed;
84 } // namespace mozilla
86 #endif // DOM_SMIL_SMILINTERVAL_H_