summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibWeb/HTML/Window.cpp
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2022-08-04 21:19:30 +0200
committerAndreas Kling <kling@serenityos.org>2022-08-05 12:42:46 +0200
commite756b5450da8a788d5b625f0b0293f137e137b68 (patch)
tree859cd03827ef2e43a77493a557bd9b45e773d0d4 /Userland/Libraries/LibWeb/HTML/Window.cpp
parenteca08732450d9fa2eccea7c4103a54d8e449d447 (diff)
downloadserenity-e756b5450da8a788d5b625f0b0293f137e137b68.zip
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.
Diffstat (limited to 'Userland/Libraries/LibWeb/HTML/Window.cpp')
-rw-r--r--Userland/Libraries/LibWeb/HTML/Window.cpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/Userland/Libraries/LibWeb/HTML/Window.cpp b/Userland/Libraries/LibWeb/HTML/Window.cpp
index 9be67eb7e8..ab07a46022 100644
--- a/Userland/Libraries/LibWeb/HTML/Window.cpp
+++ b/Userland/Libraries/LibWeb/HTML/Window.cpp
@@ -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;
+}
+
}