1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 14:57:35 +00:00

LibWeb: Add a way to construct HTML::Window without a DOM::Document

This will be used to implement the rather intricate construction order
in the HTML spec.
This commit is contained in:
Andreas Kling 2022-08-04 21:19:30 +02:00
parent eca0873245
commit e756b5450d
2 changed files with 21 additions and 0 deletions

View file

@ -34,6 +34,7 @@ class Window final
, public HTML::GlobalEventHandlers
, public HTML::WindowEventHandlers {
public:
static NonnullRefPtr<Window> create();
static NonnullRefPtr<Window> create_with_document(DOM::Document&);
~Window();
@ -51,6 +52,7 @@ public:
// https://html.spec.whatwg.org/multipage/window-object.html#concept-document-window
DOM::Document const& associated_document() const { return *m_associated_document; }
DOM::Document& associated_document() { return *m_associated_document; }
void set_associated_document(DOM::Document&);
// https://html.spec.whatwg.org/multipage/window-object.html#window-bc
HTML::BrowsingContext const* browsing_context() const { return m_associated_document->browsing_context(); }
@ -127,6 +129,7 @@ public:
AnimationFrameCallbackDriver& animation_frame_callback_driver() { return m_animation_frame_callback_driver; }
private:
Window();
explicit Window(DOM::Document&);
// ^HTML::GlobalEventHandlers