summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibWeb/DOM
diff options
context:
space:
mode:
authorSam Atkins <atkinssj@serenityos.org>2021-10-08 20:21:46 +0100
committerAndreas Kling <kling@serenityos.org>2021-10-08 23:02:57 +0200
commit5098cd22a478b7264db9226c996f7fa229fcdb60 (patch)
tree8d4421c5db6bd8778e7101c75468c9466e44f3eb /Userland/Libraries/LibWeb/DOM
parent57a25139a553d94d89f899eb93ca054301131be1 (diff)
downloadserenity-5098cd22a478b7264db9226c996f7fa229fcdb60.zip
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! :^)
Diffstat (limited to 'Userland/Libraries/LibWeb/DOM')
-rw-r--r--Userland/Libraries/LibWeb/DOM/Document.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/Userland/Libraries/LibWeb/DOM/Document.cpp b/Userland/Libraries/LibWeb/DOM/Document.cpp
index e575c64128..1e20c5b3e2 100644
--- a/Userland/Libraries/LibWeb/DOM/Document.cpp
+++ b/Userland/Libraries/LibWeb/DOM/Document.cpp
@@ -1156,6 +1156,11 @@ void Document::evaluate_media_queries_and_report_changes()
media_query_list->dispatch_event(event);
}
}
+
+ // Also not in the spec, but this is as good a place as any to evaluate @media rules!
+ for (auto& style_sheet : style_sheets().sheets()) {
+ style_sheet.evaluate_media_queries(window());
+ }
}
}