Skip to content

Commit d0cad31

Browse files
committed
Revert "Bug 1817051 - Part 3: Start to sample scroll timeline in the HTML loop. r=firefox-style-system-reviewers,layout-reviewers,hiro,emilio" on request for causing timeout
This reverts commit 42e172e. Revert "Bug 1817051 - Part 2: Add scroll timeline into AnimationTimelinesController. r=hiro,layout-reviewers" This reverts commit 4bdbdb5. Revert "Bug 1817051 - Part 1: Add AnimationTimelinesController. r=layout-reviewers,hiro,dom-core,smaug" This reverts commit 85c927d.
1 parent 42e172e commit d0cad31

23 files changed

+331
-272
lines changed

dom/animation/AnimationEventDispatcher.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
#include "mozilla/ProfilerMarkers.h"
1717
#include "mozilla/Variant.h"
1818
#include "mozilla/dom/AnimationPlaybackEvent.h"
19-
#include "mozilla/dom/Document.h"
2019
#include "mozilla/dom/KeyframeEffect.h"
2120
#include "nsCycleCollectionParticipant.h"
2221
#include "nsPresContext.h"

dom/animation/AnimationTimelinesController.cpp

Lines changed: 0 additions & 64 deletions
This file was deleted.

dom/animation/AnimationTimelinesController.h

Lines changed: 0 additions & 49 deletions
This file was deleted.

dom/animation/DocumentTimeline.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ DocumentTimeline::DocumentTimeline(Document* aDocument,
4747
mDocument(aDocument),
4848
mOriginTime(aOriginTime) {
4949
if (mDocument) {
50-
mDocument->TimelinesController().AddDocumentTimeline(*this);
50+
mDocument->Timelines().insertBack(this);
5151
}
5252
// Ensure mLastRefreshDriverTime is valid.
5353
UpdateLastRefreshDriverTime();

dom/animation/ElementAnimationData.cpp

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ void ElementAnimationData::ClearAllAnimationCollections() {
5151
mElementData.mTransitions = nullptr;
5252
mElementData.mScrollTimelines = nullptr;
5353
mElementData.mViewTimelines = nullptr;
54+
mElementData.mProgressTimelineScheduler = nullptr;
5455
ClearAllPseudos(false);
5556
}
5657

@@ -76,6 +77,7 @@ void ElementAnimationData::ClearAllPseudos(bool aOnlyViewTransitions) {
7677
data->mTransitions = nullptr;
7778
data->mScrollTimelines = nullptr;
7879
data->mViewTimelines = nullptr;
80+
data->mProgressTimelineScheduler = nullptr;
7981

8082
if (data->IsEmpty()) {
8183
iter.Remove();
@@ -176,6 +178,13 @@ void ElementAnimationData::ClearViewTimelineCollectionFor(
176178
});
177179
}
178180

181+
void ElementAnimationData::ClearProgressTimelineScheduler(
182+
const PseudoStyleRequest& aRequest) {
183+
WithDataForRemoval(aRequest, [](PerElementOrPseudoData& aData) {
184+
aData.mProgressTimelineScheduler = nullptr;
185+
});
186+
}
187+
179188
ElementAnimationData::PerElementOrPseudoData::PerElementOrPseudoData() =
180189
default;
181190
ElementAnimationData::PerElementOrPseudoData::~PerElementOrPseudoData() =
@@ -228,4 +237,11 @@ ElementAnimationData::PerElementOrPseudoData::DoEnsureViewTimelines(
228237
return *mViewTimelines;
229238
}
230239

240+
dom::ProgressTimelineScheduler& ElementAnimationData::PerElementOrPseudoData::
241+
DoEnsureProgressTimelineScheduler() {
242+
MOZ_ASSERT(!mProgressTimelineScheduler);
243+
mProgressTimelineScheduler = MakeUnique<dom::ProgressTimelineScheduler>();
244+
return *mProgressTimelineScheduler;
245+
}
246+
231247
} // namespace mozilla

dom/animation/ElementAnimationData.h

Lines changed: 45 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ namespace dom {
2323
class Element;
2424
class CSSAnimation;
2525
class CSSTransition;
26+
class ProgressTimelineScheduler;
2627
class ScrollTimeline;
2728
class ViewTimeline;
2829
} // namespace dom
@@ -46,15 +47,31 @@ class ElementAnimationData {
4647
//
4748
// So it should be fine to create timeline objects only on the elements and
4849
// pseudo elements which support animations.
49-
//
50-
// Note: TimelineCollection owns and manages the named progress timeline
51-
// generated by specifying scroll-timeline-name property and
52-
// view-timeline-name property on this element. However, the anonymous
53-
// progress timelines (e.g. animation-timeline:scroll()) are owned by
54-
// Animation objects only.
5550
UniquePtr<ScrollTimelineCollection> mScrollTimelines;
5651
UniquePtr<ViewTimelineCollection> mViewTimelines;
5752

53+
// This is different from |mScrollTimelines|. We use this to schedule all
54+
// scroll-driven animations (which use anonymous/named scroll timelines or
55+
// anonymous/name view timelines) for a specific scroll source (which is the
56+
// element with ScrollContainerFrame).
57+
//
58+
// TimelineCollection owns and manages the named progress timeline generated
59+
// by specifying scroll-timeline-name property and view-timeline-name
60+
// property on this element. However, the anonymous progress timelines (e.g.
61+
// animation-timeline:scroll()) are owned by Animation objects only.
62+
//
63+
// Note:
64+
// 1. For named scroll timelines. The element which specifies
65+
// scroll-timeline-name is the scroll source. However, for named view
66+
// timelines, the element which specifies view-timeline-name may not be
67+
// the scroll source because we use its nearest scroll container as the
68+
// scroll source.
69+
// 2. For anonymous progress timelines, we don't keep their timeline obejcts
70+
// in TimelineCollection.
71+
// So, per 1) and 2), we use |mProgressTimelineScheduler| for the scroll
72+
// source element to schedule scroll-driven animations.
73+
UniquePtr<dom::ProgressTimelineScheduler> mProgressTimelineScheduler;
74+
5875
PerElementOrPseudoData();
5976
~PerElementOrPseudoData();
6077

@@ -67,10 +84,12 @@ class ElementAnimationData {
6784
dom::Element&, const PseudoStyleRequest&);
6885
ViewTimelineCollection& DoEnsureViewTimelines(dom::Element&,
6986
const PseudoStyleRequest&);
87+
dom::ProgressTimelineScheduler& DoEnsureProgressTimelineScheduler();
7088

7189
bool IsEmpty() const {
7290
return !mEffectSet && !mAnimations && !mTransitions &&
73-
!mScrollTimelines && !mViewTimelines;
91+
!mScrollTimelines && !mViewTimelines &&
92+
!mProgressTimelineScheduler;
7493
}
7594

7695
void Traverse(nsCycleCollectionTraversalCallback&);
@@ -242,6 +261,25 @@ class ElementAnimationData {
242261
return data.DoEnsureViewTimelines(aOwner, aRequest);
243262
}
244263

264+
dom::ProgressTimelineScheduler* GetProgressTimelineScheduler(
265+
const PseudoStyleRequest& aRequest) const {
266+
if (auto* data = GetData(aRequest)) {
267+
return data->mProgressTimelineScheduler.get();
268+
}
269+
return nullptr;
270+
}
271+
272+
void ClearProgressTimelineScheduler(const PseudoStyleRequest& aRequest);
273+
274+
dom::ProgressTimelineScheduler& EnsureProgressTimelineScheduler(
275+
const PseudoStyleRequest& aRequest) {
276+
auto& data = GetOrCreateData(aRequest);
277+
if (auto* collection = data.mProgressTimelineScheduler.get()) {
278+
return *collection;
279+
}
280+
return data.DoEnsureProgressTimelineScheduler();
281+
}
282+
245283
ElementAnimationData() = default;
246284
};
247285

0 commit comments

Comments
 (0)