mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 03:37:45 +00:00
LibWeb: Evaluate @media
rules
We now evaluate the conditions of `@media` rules at the same point in the HTML event loop as evaluation of `MediaQueryList`s. This is not strictly to spec, but since the spec doesn't actually say when to do this, it seems to make the most sense. In any case, it works! :^)
This commit is contained in:
parent
57a25139a5
commit
5098cd22a4
8 changed files with 47 additions and 2 deletions
|
@ -30,11 +30,12 @@ public:
|
|||
|
||||
virtual String condition_text() const override;
|
||||
virtual void set_condition_text(String) override;
|
||||
// FIXME: We need to evaluate() the query before matches() will work!
|
||||
virtual bool condition_matches() const override { return m_media->matches(); }
|
||||
|
||||
NonnullRefPtr<MediaList> const& media() const { return m_media; }
|
||||
|
||||
bool evaluate(DOM::Window const& window) { return m_media->evaluate(window); }
|
||||
|
||||
private:
|
||||
explicit CSSMediaRule(NonnullRefPtr<MediaList>&&, NonnullRefPtrVector<CSSRule>&&);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue