1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 03:37:34 +00:00

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.
This commit is contained in:
Sam Atkins 2021-10-04 17:41:35 +01:00 committed by Andreas Kling
parent 1c829e0417
commit 050823bea7
10 changed files with 122 additions and 2 deletions

View file

@ -285,7 +285,9 @@ NonnullRefPtr<CSS::CSSStyleDeclaration> Window::get_computed_style(DOM::Element&
NonnullRefPtr<CSS::MediaQueryList> Window::match_media(String media)
{
return CSS::MediaQueryList::create(associated_document(), parse_media_query_list(CSS::ParsingContext(associated_document()), media));
auto media_query_list = CSS::MediaQueryList::create(associated_document(), parse_media_query_list(CSS::ParsingContext(associated_document()), media));
associated_document().add_media_query_list(media_query_list);
return media_query_list;
}
RefPtr<CSS::StyleValue> Window::query_media_feature(FlyString const& name) const