mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 19:47:44 +00:00
LibWeb: Implement MediaQuery matching :^)
Currently, `evaluate()` recalculates whether the MediaQuery matches or not, and stores it in `m_matches`, which users can query using `matches()`. This allows us to know when the match-state changes, which is required to fire MediaQueryList's change event.
This commit is contained in:
parent
f354fd72f1
commit
1c829e0417
6 changed files with 163 additions and 1 deletions
|
@ -8,6 +8,7 @@
|
|||
|
||||
#include <AK/Forward.h>
|
||||
#include <AK/RefCounted.h>
|
||||
#include <AK/Weakable.h>
|
||||
#include <LibWeb/Bindings/Wrappable.h>
|
||||
#include <LibWeb/CSS/MediaQuery.h>
|
||||
#include <LibWeb/DOM/EventTarget.h>
|
||||
|
@ -18,6 +19,7 @@ namespace Web::CSS {
|
|||
// 4.2. The MediaQueryList Interface, https://drafts.csswg.org/cssom-view/#the-mediaquerylist-interface
|
||||
class MediaQueryList final
|
||||
: public RefCounted<MediaQueryList>
|
||||
, public Weakable<MediaQueryList>
|
||||
, public DOM::EventTarget
|
||||
, public Bindings::Wrappable {
|
||||
|
||||
|
@ -36,6 +38,7 @@ public:
|
|||
|
||||
String media() const;
|
||||
bool matches() const;
|
||||
bool evaluate();
|
||||
|
||||
// ^EventTarget
|
||||
virtual void ref_event_target() override { ref(); }
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue