mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 20:28:11 +00:00
LibWeb: Add a default DocumentTimeline object to DOM::Document
This commit is contained in:
parent
734076946b
commit
2fbb9649e3
3 changed files with 21 additions and 0 deletions
|
@ -16,6 +16,7 @@
|
|||
#include <LibJS/Runtime/Array.h>
|
||||
#include <LibJS/Runtime/FunctionObject.h>
|
||||
#include <LibJS/Runtime/NativeFunction.h>
|
||||
#include <LibWeb/Animations/DocumentTimeline.h>
|
||||
#include <LibWeb/Bindings/MainThreadVM.h>
|
||||
#include <LibWeb/CSS/MediaQueryList.h>
|
||||
#include <LibWeb/CSS/MediaQueryListEvent.h>
|
||||
|
@ -383,6 +384,8 @@ void Document::visit_edges(Cell::Visitor& visitor)
|
|||
visitor.visit(m_lazy_load_intersection_observer);
|
||||
visitor.visit(m_visual_viewport);
|
||||
|
||||
visitor.visit(m_default_timeline);
|
||||
|
||||
for (auto& script : m_scripts_to_execute_when_parsing_has_finished)
|
||||
visitor.visit(script);
|
||||
for (auto& script : m_scripts_to_execute_as_soon_as_possible)
|
||||
|
@ -3560,4 +3563,13 @@ HashMap<AK::URL, HTML::SharedImageRequest*>& Document::shared_image_requests()
|
|||
return m_shared_image_requests;
|
||||
}
|
||||
|
||||
// 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()));
|
||||
return *m_default_timeline;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue