mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 13:07:46 +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/Array.h>
|
||||||
#include <LibJS/Runtime/FunctionObject.h>
|
#include <LibJS/Runtime/FunctionObject.h>
|
||||||
#include <LibJS/Runtime/NativeFunction.h>
|
#include <LibJS/Runtime/NativeFunction.h>
|
||||||
|
#include <LibWeb/Animations/DocumentTimeline.h>
|
||||||
#include <LibWeb/Bindings/MainThreadVM.h>
|
#include <LibWeb/Bindings/MainThreadVM.h>
|
||||||
#include <LibWeb/CSS/MediaQueryList.h>
|
#include <LibWeb/CSS/MediaQueryList.h>
|
||||||
#include <LibWeb/CSS/MediaQueryListEvent.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_lazy_load_intersection_observer);
|
||||||
visitor.visit(m_visual_viewport);
|
visitor.visit(m_visual_viewport);
|
||||||
|
|
||||||
|
visitor.visit(m_default_timeline);
|
||||||
|
|
||||||
for (auto& script : m_scripts_to_execute_when_parsing_has_finished)
|
for (auto& script : m_scripts_to_execute_when_parsing_has_finished)
|
||||||
visitor.visit(script);
|
visitor.visit(script);
|
||||||
for (auto& script : m_scripts_to_execute_as_soon_as_possible)
|
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;
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -534,6 +534,8 @@ public:
|
||||||
|
|
||||||
HashMap<AK::URL, HTML::SharedImageRequest*>& shared_image_requests();
|
HashMap<AK::URL, HTML::SharedImageRequest*>& shared_image_requests();
|
||||||
|
|
||||||
|
JS::NonnullGCPtr<Animations::DocumentTimeline> timeline();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void initialize(JS::Realm&) override;
|
virtual void initialize(JS::Realm&) override;
|
||||||
virtual void visit_edges(Cell::Visitor&) override;
|
virtual void visit_edges(Cell::Visitor&) override;
|
||||||
|
@ -740,6 +742,9 @@ private:
|
||||||
JS::GCPtr<HTML::SessionHistoryEntry> m_latest_entry;
|
JS::GCPtr<HTML::SessionHistoryEntry> m_latest_entry;
|
||||||
|
|
||||||
HashMap<AK::URL, HTML::SharedImageRequest*> m_shared_image_requests;
|
HashMap<AK::URL, HTML::SharedImageRequest*> m_shared_image_requests;
|
||||||
|
|
||||||
|
// https://www.w3.org/TR/web-animations-1/#document-default-document-timeline
|
||||||
|
JS::GCPtr<Animations::DocumentTimeline> m_default_timeline;
|
||||||
};
|
};
|
||||||
|
|
||||||
template<>
|
template<>
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
#import <Animations/DocumentTimeline.idl>
|
||||||
#import <CSS/StyleSheetList.idl>
|
#import <CSS/StyleSheetList.idl>
|
||||||
#import <DOM/Comment.idl>
|
#import <DOM/Comment.idl>
|
||||||
#import <DOM/DOMImplementation.idl>
|
#import <DOM/DOMImplementation.idl>
|
||||||
|
@ -112,6 +113,9 @@ interface Document : Node {
|
||||||
[NewObject] TreeWalker createTreeWalker(Node root, optional unsigned long whatToShow = 0xFFFFFFFF, optional NodeFilter? filter = null);
|
[NewObject] TreeWalker createTreeWalker(Node root, optional unsigned long whatToShow = 0xFFFFFFFF, optional NodeFilter? filter = null);
|
||||||
|
|
||||||
Selection? getSelection();
|
Selection? getSelection();
|
||||||
|
|
||||||
|
// https://www.w3.org/TR/web-animations-1/#extensions-to-the-document-interface
|
||||||
|
readonly attribute DocumentTimeline timeline;
|
||||||
};
|
};
|
||||||
|
|
||||||
dictionary ElementCreationOptions {
|
dictionary ElementCreationOptions {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue