summaryrefslogtreecommitdiffstats
path: root/dom/smil/SMILInterval.h
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 19:33:14 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 19:33:14 +0000
commit36d22d82aa202bb199967e9512281e9a53db42c9 (patch)
tree105e8c98ddea1c1e4784a60a5a6410fa416be2de /dom/smil/SMILInterval.h
parentInitial commit. (diff)
downloadfirefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.tar.xz
firefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.zip
Adding upstream version 115.7.0esr.upstream/115.7.0esrupstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'dom/smil/SMILInterval.h')
-rw-r--r--dom/smil/SMILInterval.h86
1 files changed, 86 insertions, 0 deletions
diff --git a/dom/smil/SMILInterval.h b/dom/smil/SMILInterval.h
new file mode 100644
index 0000000000..a569fce147
--- /dev/null
+++ b/dom/smil/SMILInterval.h
@@ -0,0 +1,86 @@
+/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* vim: set ts=8 sts=2 et sw=2 tw=80: */
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+#ifndef DOM_SMIL_SMILINTERVAL_H_
+#define DOM_SMIL_SMILINTERVAL_H_
+
+#include "mozilla/SMILInstanceTime.h"
+#include "nsTArray.h"
+
+namespace mozilla {
+
+//----------------------------------------------------------------------
+// SMILInterval class
+//
+// A structure consisting of a begin and end time. The begin time must be
+// resolved (i.e. not indefinite or unresolved).
+//
+// For an overview of how this class is related to other SMIL time classes see
+// the documentation in SMILTimeValue.h
+
+class SMILInterval {
+ public:
+ SMILInterval();
+ SMILInterval(const SMILInterval& aOther);
+ ~SMILInterval();
+ void Unlink(bool aFiltered = false);
+
+ const SMILInstanceTime* Begin() const {
+ MOZ_ASSERT(mBegin && mEnd,
+ "Requesting Begin() on un-initialized instance time");
+ return mBegin;
+ }
+ SMILInstanceTime* Begin();
+
+ const SMILInstanceTime* End() const {
+ MOZ_ASSERT(mBegin && mEnd,
+ "Requesting End() on un-initialized instance time");
+ return mEnd;
+ }
+ SMILInstanceTime* End();
+
+ void SetBegin(SMILInstanceTime& aBegin);
+ void SetEnd(SMILInstanceTime& aEnd);
+ void Set(SMILInstanceTime& aBegin, SMILInstanceTime& aEnd) {
+ SetBegin(aBegin);
+ SetEnd(aEnd);
+ }
+
+ void FixBegin();
+ void FixEnd();
+
+ using InstanceTimeList = nsTArray<RefPtr<SMILInstanceTime>>;
+
+ void AddDependentTime(SMILInstanceTime& aTime);
+ void RemoveDependentTime(const SMILInstanceTime& aTime);
+ void GetDependentTimes(InstanceTimeList& aTimes);
+
+ // Cue for assessing if this interval can be filtered
+ bool IsDependencyChainLink() const;
+
+ private:
+ RefPtr<SMILInstanceTime> mBegin;
+ RefPtr<SMILInstanceTime> mEnd;
+
+ // SMILInstanceTimes to notify when this interval is changed or deleted.
+ InstanceTimeList mDependentTimes;
+
+ // Indicates if the end points of the interval are fixed or not.
+ //
+ // Note that this is not the same as having an end point whose TIME is fixed
+ // (i.e. SMILInstanceTime::IsFixed() returns true). This is because it is
+ // possible to have an end point with a fixed TIME and yet still update the
+ // end point to refer to a different SMILInstanceTime object.
+ //
+ // However, if mBegin/EndFixed is true, then BOTH the SMILInstanceTime
+ // OBJECT returned for that end point and its TIME value will not change.
+ bool mBeginFixed;
+ bool mEndFixed;
+};
+
+} // namespace mozilla
+
+#endif // DOM_SMIL_SMILINTERVAL_H_