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 #ifndef mozilla_TimelineManager_h
7 #define mozilla_TimelineManager_h
9 #include "mozilla/Assertions.h"
10 #include "mozilla/LinkedList.h"
11 #include "mozilla/TimelineCollection.h"
12 #include "nsStyleAutoArray.h"
18 enum class PseudoStyleType
: uint8_t;
26 class TimelineManager
{
28 explicit TimelineManager(nsPresContext
* aPresContext
)
29 : mPresContext(aPresContext
) {}
32 MOZ_ASSERT(!mPresContext
, "Disconnect should have been called");
36 while (auto* head
= mScrollTimelineCollections
.getFirst()) {
39 while (auto* head
= mViewTimelineCollections
.getFirst()) {
43 mPresContext
= nullptr;
46 enum class ProgressTimelineType
: uint8_t {
50 void UpdateTimelines(dom::Element
* aElement
, PseudoStyleType aPseudoType
,
51 const ComputedStyle
* aComputedStyle
,
52 ProgressTimelineType aType
);
54 void UpdateHiddenByContentVisibilityForAnimations();
57 template <typename StyleType
, typename TimelineType
>
58 void DoUpdateTimelines(nsPresContext
* aPresContext
, dom::Element
* aElement
,
59 PseudoStyleType aPseudoType
,
60 const nsStyleAutoArray
<StyleType
>& aStyleTimelines
,
61 size_t aTimelineCount
);
64 void AddTimelineCollection(TimelineCollection
<T
>* aCollection
);
66 LinkedList
<TimelineCollection
<dom::ScrollTimeline
>>
67 mScrollTimelineCollections
;
68 LinkedList
<TimelineCollection
<dom::ViewTimeline
>> mViewTimelineCollections
;
69 nsPresContext
* mPresContext
;
73 inline void TimelineManager::AddTimelineCollection(
74 TimelineCollection
<dom::ScrollTimeline
>* aCollection
) {
75 mScrollTimelineCollections
.insertBack(aCollection
);
79 inline void TimelineManager::AddTimelineCollection(
80 TimelineCollection
<dom::ViewTimeline
>* aCollection
) {
81 mViewTimelineCollections
.insertBack(aCollection
);
84 } // namespace mozilla
86 #endif // mozilla_TimelineManager_h