LibWeb: Set DocumentTimeline origin time to zero

The current time should be used to set the timeline's new current time,
not its origin time
This commit is contained in:
Matthew Olsson 2024-02-14 21:41:38 +00:00 committed by Andreas Kling
parent 727a9a6472
commit 14200de80b
Notes: sideshowbarker 2024-07-17 03:45:48 +09:00

View file

@ -3690,9 +3690,12 @@ HashMap<AK::URL, JS::GCPtr<HTML::SharedImageRequest>>& Document::shared_image_re
// https://www.w3.org/TR/web-animations-1/#dom-document-timeline
JS::NonnullGCPtr<Animations::DocumentTimeline> Document::timeline()
{
// The DocumentTimeline object representing the default document timeline.
if (!m_default_timeline)
m_default_timeline = Animations::DocumentTimeline::create(realm(), *this, static_cast<double>(MonotonicTime::now().milliseconds()));
// The DocumentTimeline object representing the default document timeline. The default document timeline has an
// origin time of zero.
if (!m_default_timeline) {
m_default_timeline = Animations::DocumentTimeline::create(realm(), *this, 0.0);
m_default_timeline->set_current_time(MonotonicTime::now().milliseconds());
}
return *m_default_timeline;
}