mirror of
https://github.com/fergalmoran/ladybird.git
synced 2025-12-26 03:09:08 +00:00
LibWeb: Make DOM::Window into an EventTarget
This will allow us to dispatch window events.
This commit is contained in:
@@ -28,6 +28,8 @@
|
||||
#include <LibGUI/MessageBox.h>
|
||||
#include <LibJS/Runtime/Function.h>
|
||||
#include <LibWeb/DOM/Document.h>
|
||||
#include <LibWeb/DOM/Event.h>
|
||||
#include <LibWeb/DOM/EventDispatcher.h>
|
||||
#include <LibWeb/DOM/Timer.h>
|
||||
#include <LibWeb/DOM/Window.h>
|
||||
#include <LibWeb/HighResolutionTime/Performance.h>
|
||||
@@ -42,7 +44,8 @@ NonnullRefPtr<Window> Window::create_with_document(Document& document)
|
||||
}
|
||||
|
||||
Window::Window(Document& document)
|
||||
: m_document(document)
|
||||
: EventTarget(static_cast<Bindings::ScriptExecutionContext&>(document))
|
||||
, m_document(document)
|
||||
, m_performance(make<HighResolutionTime::Performance>(*this))
|
||||
{
|
||||
}
|
||||
@@ -157,4 +160,14 @@ void Window::did_call_location_reload(Badge<Bindings::LocationObject>)
|
||||
frame->loader().load(document().url(), FrameLoader::Type::Reload);
|
||||
}
|
||||
|
||||
void Window::dispatch_event(NonnullRefPtr<Event> event)
|
||||
{
|
||||
EventDispatcher::dispatch(*this, event);
|
||||
}
|
||||
|
||||
Bindings::EventTargetWrapper* Window::create_wrapper(JS::GlobalObject&)
|
||||
{
|
||||
ASSERT_NOT_REACHED();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user