summaryrefslogtreecommitdiff
path: root/Userland
diff options
context:
space:
mode:
authorLuke Wilde <lukew@serenityos.org>2021-10-01 01:33:10 +0100
committerLinus Groh <mail@linusgroh.de>2021-10-01 01:35:30 +0100
commit46686f7f94a0b494c455a87f06c41178124dc462 (patch)
tree5fbbe1ed6ece52090e687b5f865c6d2063dfb214 /Userland
parent61e9e802329770db3dc30f6f15a31f5214c9d6db (diff)
downloadserenity-46686f7f94a0b494c455a87f06c41178124dc462.zip
LibWeb: Implement MediaQueryList.onchange
Diffstat (limited to 'Userland')
-rw-r--r--Userland/Libraries/LibWeb/CSS/MediaQueryList.cpp11
-rw-r--r--Userland/Libraries/LibWeb/CSS/MediaQueryList.h3
-rw-r--r--Userland/Libraries/LibWeb/CSS/MediaQueryList.idl3
3 files changed, 15 insertions, 2 deletions
diff --git a/Userland/Libraries/LibWeb/CSS/MediaQueryList.cpp b/Userland/Libraries/LibWeb/CSS/MediaQueryList.cpp
index 5d1c9c23ce..2af28d4128 100644
--- a/Userland/Libraries/LibWeb/CSS/MediaQueryList.cpp
+++ b/Userland/Libraries/LibWeb/CSS/MediaQueryList.cpp
@@ -9,6 +9,7 @@
#include <LibWeb/DOM/Document.h>
#include <LibWeb/DOM/EventDispatcher.h>
#include <LibWeb/DOM/EventListener.h>
+#include <LibWeb/HTML/EventHandler.h>
namespace Web::CSS {
@@ -65,4 +66,14 @@ void MediaQueryList::remove_listener(RefPtr<DOM::EventListener> listener)
remove_event_listener(HTML::EventNames::change, listener);
}
+void MediaQueryList::set_onchange(HTML::EventHandler event_handler)
+{
+ set_event_handler_attribute(HTML::EventNames::change, event_handler);
+}
+
+HTML::EventHandler MediaQueryList::onchange()
+{
+ return event_handler_attribute(HTML::EventNames::change);
+}
+
}
diff --git a/Userland/Libraries/LibWeb/CSS/MediaQueryList.h b/Userland/Libraries/LibWeb/CSS/MediaQueryList.h
index 906f8e5acc..117da92d1b 100644
--- a/Userland/Libraries/LibWeb/CSS/MediaQueryList.h
+++ b/Userland/Libraries/LibWeb/CSS/MediaQueryList.h
@@ -44,6 +44,9 @@ public:
void add_listener(RefPtr<DOM::EventListener> listener);
void remove_listener(RefPtr<DOM::EventListener> listener);
+ void set_onchange(HTML::EventHandler);
+ HTML::EventHandler onchange();
+
private:
MediaQueryList(DOM::Document&, String);
diff --git a/Userland/Libraries/LibWeb/CSS/MediaQueryList.idl b/Userland/Libraries/LibWeb/CSS/MediaQueryList.idl
index d5cb27209a..dcd72c50d8 100644
--- a/Userland/Libraries/LibWeb/CSS/MediaQueryList.idl
+++ b/Userland/Libraries/LibWeb/CSS/MediaQueryList.idl
@@ -2,8 +2,7 @@
interface MediaQueryList : EventTarget {
readonly attribute CSSOMString media;
readonly attribute boolean matches;
- // TODO:
undefined addListener(EventListener? callback);
undefined removeListener(EventListener? callback);
- // attribute EventHandler onchange;
+ attribute EventHandler onchange;
};