1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 10:48:11 +00:00

LibWeb: Make DOM::Window into an EventTarget

This will allow us to dispatch window events.
This commit is contained in:
Andreas Kling 2020-10-18 13:43:44 +02:00
parent 77c1957961
commit b92bc9c6e5
2 changed files with 26 additions and 2 deletions

View file

@ -32,14 +32,25 @@
#include <AK/RefPtr.h>
#include <LibWeb/Bindings/WindowObject.h>
#include <LibWeb/Bindings/Wrappable.h>
#include <LibWeb/DOM/EventTarget.h>
namespace Web::DOM {
class Window : public RefCounted<Window> {
class Window final
: public RefCounted<Window>
, public EventTarget {
public:
static NonnullRefPtr<Window> create_with_document(Document&);
~Window();
using RefCounted::ref;
using RefCounted::unref;
virtual void ref_event_target() override { RefCounted::ref(); }
virtual void unref_event_target() override { RefCounted::unref(); }
virtual void dispatch_event(NonnullRefPtr<Event>) override;
virtual Bindings::EventTargetWrapper* create_wrapper(JS::GlobalObject&) override;
const Document& document() const { return m_document; }
Document& document() { return m_document; }