diff options
author | Sam Atkins <atkinssj@serenityos.org> | 2021-10-04 17:41:35 +0100 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-10-05 18:51:39 +0200 |
commit | 050823bea7123d34286c37a798cf58834af36708 (patch) | |
tree | 5a8790aef4269d2a1485f97a2a5638c30ce0d1cf /Userland/Libraries/LibWeb/Bindings | |
parent | 1c829e0417ede6ae70cde68269e25afa363df48f (diff) | |
download | serenity-050823bea7123d34286c37a798cf58834af36708.zip |
LibWeb: Fire MediaQueryListEvents when an MQL's match-state changes
The HTML event loop does a check for MQL match-state changes and
dispatches the events. This requires us to keep a list of MQLs on the
Document.
Diffstat (limited to 'Userland/Libraries/LibWeb/Bindings')
-rw-r--r-- | Userland/Libraries/LibWeb/Bindings/EventWrapperFactory.cpp | 3 | ||||
-rw-r--r-- | Userland/Libraries/LibWeb/Bindings/WindowObjectHelper.h | 3 |
2 files changed, 6 insertions, 0 deletions
diff --git a/Userland/Libraries/LibWeb/Bindings/EventWrapperFactory.cpp b/Userland/Libraries/LibWeb/Bindings/EventWrapperFactory.cpp index cefc244352..c7d4a067b9 100644 --- a/Userland/Libraries/LibWeb/Bindings/EventWrapperFactory.cpp +++ b/Userland/Libraries/LibWeb/Bindings/EventWrapperFactory.cpp @@ -10,6 +10,7 @@ #include <LibWeb/Bindings/EventWrapper.h> #include <LibWeb/Bindings/EventWrapperFactory.h> #include <LibWeb/Bindings/KeyboardEventWrapper.h> +#include <LibWeb/Bindings/MediaQueryListEventWrapper.h> #include <LibWeb/Bindings/MessageEventWrapper.h> #include <LibWeb/Bindings/MouseEventWrapper.h> #include <LibWeb/Bindings/PageTransitionEventWrapper.h> @@ -22,6 +23,8 @@ EventWrapper* wrap(JS::GlobalObject& global_object, DOM::Event& event) { if (is<DOM::CustomEvent>(event)) return static_cast<CustomEventWrapper*>(wrap_impl(global_object, static_cast<DOM::CustomEvent&>(event))); + if (is<CSS::MediaQueryListEvent>(event)) + return static_cast<MediaQueryListEventWrapper*>(wrap_impl(global_object, static_cast<CSS::MediaQueryListEvent&>(event))); if (is<HTML::CloseEvent>(event)) return static_cast<CloseEventWrapper*>(wrap_impl(global_object, static_cast<HTML::CloseEvent&>(event))); if (is<HTML::MessageEvent>(event)) diff --git a/Userland/Libraries/LibWeb/Bindings/WindowObjectHelper.h b/Userland/Libraries/LibWeb/Bindings/WindowObjectHelper.h index 6f13e48230..2ecdfbb0fb 100644 --- a/Userland/Libraries/LibWeb/Bindings/WindowObjectHelper.h +++ b/Userland/Libraries/LibWeb/Bindings/WindowObjectHelper.h @@ -204,6 +204,8 @@ #include <LibWeb/Bindings/ImageDataConstructor.h> #include <LibWeb/Bindings/ImageDataPrototype.h> #include <LibWeb/Bindings/MediaQueryListConstructor.h> +#include <LibWeb/Bindings/MediaQueryListEventConstructor.h> +#include <LibWeb/Bindings/MediaQueryListEventPrototype.h> #include <LibWeb/Bindings/MediaQueryListPrototype.h> #include <LibWeb/Bindings/MessageChannelConstructor.h> #include <LibWeb/Bindings/MessageChannelPrototype.h> @@ -371,6 +373,7 @@ ADD_WINDOW_OBJECT_INTERFACE(HTMLVideoElement) \ ADD_WINDOW_OBJECT_INTERFACE(ImageData) \ ADD_WINDOW_OBJECT_INTERFACE(MediaQueryList) \ + ADD_WINDOW_OBJECT_INTERFACE(MediaQueryListEvent) \ ADD_WINDOW_OBJECT_INTERFACE(MessageChannel) \ ADD_WINDOW_OBJECT_INTERFACE(MessageEvent) \ ADD_WINDOW_OBJECT_INTERFACE(MouseEvent) \ |