Skip to content

script: Implement AnimationTimeline and DocumentTimeline from Web Animations#43711

Merged
mrobinson merged 1 commit intoservo:mainfrom
mrobinson:document-timeline
Mar 27, 2026
Merged

script: Implement AnimationTimeline and DocumentTimeline from Web Animations#43711
mrobinson merged 1 commit intoservo:mainfrom
mrobinson:document-timeline

Conversation

@mrobinson
Copy link
Copy Markdown
Member

This is the first step toward implementing the Web Animations
specification. It adds support for the AnimationTimeline and
DocumentTimeline specification concepts. Note that there was already
an AnimationTimeline, but it did not implement the specification.

Testing: Various WPT start to pass or no longer error / timeout.

@mrobinson mrobinson requested a review from gterzian as a code owner March 27, 2026 08:44
@servo-highfive servo-highfive added the S-awaiting-review There is new code that needs to be reviewed. label Mar 27, 2026
Copy link
Copy Markdown
Member

@simonwuelker simonwuelker left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice.

Two main points:

  1. I'd prefer if we used the Duration instead of f64 everywhere, then we don't need to document the unit of time.
  2. Should this API be exposed behind a preference? You can add it to the experimental web platform features to enable it during WPT

Comment thread components/script/dom/animations/documenttimeline.rs Outdated
Comment thread components/script/dom/document/document.rs Outdated
Comment thread components/script/dom/animations/documenttimeline.rs
Comment thread components/script/dom/animations/animationtimeline.rs
Comment thread components/script/dom/animations/animationtimeline.rs Outdated
@servo-highfive servo-highfive added the S-needs-rebase There are merge conflict errors. label Mar 27, 2026
@servo-highfive servo-highfive removed the S-needs-rebase There are merge conflict errors. label Mar 27, 2026
@mrobinson
Copy link
Copy Markdown
Member Author

@simonwuelker Thanks for the review. I think I have addressed all of your comments. PTAL.

global.as_window().advance_animation_clock(ms);
global
.as_window()
.advance_animation_clock(Duration::seconds(ms as i64));
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ms seems to indicate that the unit is milliseconds, so I suppose we should use Duration::milliseconds?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤦 Thanks.

@servo-highfive servo-highfive removed the S-awaiting-review There is new code that needs to be reviewed. label Mar 27, 2026
… Animations

This is the first step toward implementing the Web Animations
specification. It adds support for the `AnimationTimeline` and
`DocumentTimeline` specification concepts. Note that there was already
an `AnimationTimeline`, but it did not implement the specification.

Signed-off-by: Martin Robinson <mrobinson@abandonedwig.info>
@servo-highfive servo-highfive added the S-awaiting-review There is new code that needs to be reviewed. label Mar 27, 2026
@mrobinson mrobinson enabled auto-merge March 27, 2026 11:56
@mrobinson mrobinson added this pull request to the merge queue Mar 27, 2026
@servo-highfive servo-highfive added the S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI. label Mar 27, 2026
@github-merge-queue github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Mar 27, 2026
@servo-highfive servo-highfive added S-tests-failed The changes caused existing tests to fail. and removed S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI. labels Mar 27, 2026
@mrobinson mrobinson added this pull request to the merge queue Mar 27, 2026
@servo-highfive servo-highfive added S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI. and removed S-tests-failed The changes caused existing tests to fail. labels Mar 27, 2026
Merged via the queue into servo:main with commit 8acfe7a Mar 27, 2026
39 checks passed
@mrobinson mrobinson deleted the document-timeline branch March 27, 2026 16:43
@servo-highfive servo-highfive removed the S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI. label Mar 27, 2026
@mrobinson
Copy link
Copy Markdown
Member Author

  1. Should this API be exposed behind a preference? You can add it to the experimental web platform features to enable it during WPT

Sorry. I just realized I didn't answer this question. My hope is that when implementing Web Animations we can avoid having a feature flag as they are part of the Baseline Widely Available web platform features. I am going to attempt to add features here in a way that doesn't break pages, but gradually adds functionality. There may be moments during the implementation when animations misbehave, but hopefully not more than they already do.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-awaiting-review There is new code that needs to be reviewed.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants