Skip to content

Commit

Permalink
Schedule tasks in stead of animation frames for updating timelines
Browse files Browse the repository at this point in the history
  • Loading branch information
johannesodland committed Dec 31, 2023
1 parent fa54f02 commit 6562f34
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
6 changes: 3 additions & 3 deletions src/scroll-timeline-base.js
Original file line number Diff line number Diff line change
Expand Up @@ -230,9 +230,9 @@ function updateMeasurements(source) {
}
}

requestAnimationFrame(() => {
// Defer ticking timeline to animation frame to prevent
// "ResizeObserver loop completed with undelivered notifications"
setTimeout(() => {
// Schedule a task to update timelines after all measurements are completed
// TODO: run task only once if there are multiple calls to updateMeasurements for the same source
for (const ref of details.timelineRefs) {
const timeline = ref.deref();
if (timeline) {
Expand Down
8 changes: 4 additions & 4 deletions test/expected.txt
Original file line number Diff line number Diff line change
Expand Up @@ -555,7 +555,7 @@ PASS /scroll-animations/scroll-timelines/cancel-animation.html The finished prom
PASS /scroll-animations/scroll-timelines/cancel-animation.html The cancel event should NOT be fired if the animation is already idle
PASS /scroll-animations/scroll-timelines/cancel-animation.html Canceling an animation should fire cancel event on orphaned element
PASS /scroll-animations/scroll-timelines/cancel-animation.html Canceling an animation with inactive timeline should cause its start time and hold time to be unresolved
FAIL /scroll-animations/scroll-timelines/cancel-animation.html oncancel event is fired when the timeline is inactive.
TIMEOUT /scroll-animations/scroll-timelines/cancel-animation.html oncancel event is fired when the timeline is inactive.
PASS /scroll-animations/scroll-timelines/constructor-no-document.html The source can be null if the document.scrollingElement does not exist
PASS /scroll-animations/scroll-timelines/constructor.html A ScrollTimeline can be created with a source
PASS /scroll-animations/scroll-timelines/constructor.html A ScrollTimeline can be created with a non-scrolling source
Expand Down Expand Up @@ -790,12 +790,12 @@ PASS /scroll-animations/scroll-timelines/scroll-animation-effect-phases.tentativ
PASS /scroll-animations/scroll-timelines/scroll-animation-inactive-timeline.html Play pending task doesn't run when the timeline is inactive.
PASS /scroll-animations/scroll-timelines/scroll-animation-inactive-timeline.html Animation start and current times are correct if scroll timeline is activated after animation.play call.
PASS /scroll-animations/scroll-timelines/scroll-animation-inactive-timeline.html Animation start and current times are correct if scroll timeline is activated after setting start time.
FAIL /scroll-animations/scroll-timelines/scroll-animation-inactive-timeline.html Animation current time is correct when the timeline becomes newly inactive and then active again.
PASS /scroll-animations/scroll-timelines/scroll-animation-inactive-timeline.html Animation current time is correct when the timeline becomes newly inactive and then active again.
FAIL /scroll-animations/scroll-timelines/scroll-animation.html Animation start and current times are correct for each animation state.
FAIL /scroll-animations/scroll-timelines/scroll-animation.html Animation start and current times are correct for each animation state when the animation starts playing with advanced scroller.
PASS /scroll-animations/scroll-timelines/scroll-animation.html Finished animation plays on reverse scrolling.
FAIL /scroll-animations/scroll-timelines/scroll-animation.html Sending animation finished events by finished animation on reverse scrolling.
FAIL /scroll-animations/scroll-timelines/scroll-timeline-invalidation.html Animation current time and effect local time are updated after scroller content size changes.
PASS /scroll-animations/scroll-timelines/scroll-timeline-invalidation.html Animation current time and effect local time are updated after scroller content size changes.
PASS /scroll-animations/scroll-timelines/scroll-timeline-invalidation.html Animation current time and effect local time are updated after scroller size changes.
FAIL /scroll-animations/scroll-timelines/scroll-timeline-invalidation.html If scroll animation resizes its scroll timeline scroller, layout reruns once per frame.
FAIL /scroll-animations/scroll-timelines/scroll-timeline-range.html Scroll timeline with percentage range [JavaScript API]
Expand Down Expand Up @@ -957,4 +957,4 @@ FAIL /scroll-animations/view-timelines/view-timeline-sticky-block.html View time
FAIL /scroll-animations/view-timelines/view-timeline-sticky-inline.html View timeline with sticky target, block axis.
FAIL /scroll-animations/view-timelines/view-timeline-subject-size-changes.html View timeline with subject size change after the creation of the animation
FAIL /scroll-animations/view-timelines/zero-intrinsic-iteration-duration.tentative.html Intrinsic iteration duration is non-negative
Passed 432 of 959 tests.
Passed 434 of 959 tests.

0 comments on commit 6562f34

Please sign in to comment.