summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibWeb/CSS/CSSRuleList.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Userland/Libraries/LibWeb/CSS/CSSRuleList.cpp')
-rw-r--r--Userland/Libraries/LibWeb/CSS/CSSRuleList.cpp18
1 files changed, 15 insertions, 3 deletions
diff --git a/Userland/Libraries/LibWeb/CSS/CSSRuleList.cpp b/Userland/Libraries/LibWeb/CSS/CSSRuleList.cpp
index ebb810806f..92f02249d5 100644
--- a/Userland/Libraries/LibWeb/CSS/CSSRuleList.cpp
+++ b/Userland/Libraries/LibWeb/CSS/CSSRuleList.cpp
@@ -6,6 +6,7 @@
#include <AK/TypeCasts.h>
#include <LibWeb/CSS/CSSImportRule.h>
+#include <LibWeb/CSS/CSSMediaRule.h>
#include <LibWeb/CSS/CSSRuleList.h>
#include <LibWeb/DOM/ExceptionOr.h>
@@ -79,12 +80,21 @@ DOM::ExceptionOr<void> CSSRuleList::remove_a_css_rule(u32 index)
void CSSRuleList::for_each_effective_style_rule(Function<void(CSSStyleRule const&)> const& callback) const
{
for (auto& rule : m_rules) {
- if (rule.type() == CSSRule::Type::Style) {
+ switch (rule.type()) {
+ case CSSRule::Type::Style:
callback(verify_cast<CSSStyleRule>(rule));
- } else if (rule.type() == CSSRule::Type::Import) {
- const auto& import_rule = verify_cast<CSSImportRule>(rule);
+ break;
+ case CSSRule::Type::Import: {
+ auto const& import_rule = verify_cast<CSSImportRule>(rule);
if (import_rule.has_import_result())
import_rule.loaded_style_sheet()->for_each_effective_style_rule(callback);
+ break;
+ }
+ case CSSRule::Type::Media:
+ verify_cast<CSSMediaRule>(rule).for_each_effective_style_rule(callback);
+ break;
+ case CSSRule::Type::__Count:
+ VERIFY_NOT_REACHED();
}
}
}
@@ -102,6 +112,8 @@ bool CSSRuleList::for_first_not_loaded_import_rule(Function<void(CSSImportRule&)
if (import_rule.loaded_style_sheet()->for_first_not_loaded_import_rule(callback)) {
return true;
}
+ } else if (rule.type() == CSSRule::Type::Media) {
+ return verify_cast<CSSMediaRule>(rule).for_first_not_loaded_import_rule(callback);
}
}