1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 09:28:11 +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

@ -56,11 +56,24 @@ private:
u32 m_handle { 0 };
};
NonnullRefPtr<Window> Window::create()
{
return adopt_ref(*new Window);
}
NonnullRefPtr<Window> Window::create_with_document(DOM::Document& document)
{
return adopt_ref(*new Window(document));
}
Window::Window()
: DOM::EventTarget()
, m_performance(make<HighResolutionTime::Performance>(*this))
, m_crypto(Crypto::Crypto::create())
, m_screen(CSS::Screen::create({}, *this))
{
}
Window::Window(DOM::Document& document)
: DOM::EventTarget()
, m_associated_document(document)
@ -670,4 +683,9 @@ void Window::cancel_idle_callback(u32 handle)
});
}
void Window::set_associated_document(DOM::Document& document)
{
m_associated_document = document;
}
}