|
@@ -6,6 +6,7 @@
|
|
|
|
|
|
#include <AK/TypeCasts.h>
|
|
#include <AK/TypeCasts.h>
|
|
#include <LibWeb/CSS/CSSImportRule.h>
|
|
#include <LibWeb/CSS/CSSImportRule.h>
|
|
|
|
+#include <LibWeb/CSS/CSSMediaRule.h>
|
|
#include <LibWeb/CSS/CSSRuleList.h>
|
|
#include <LibWeb/CSS/CSSRuleList.h>
|
|
#include <LibWeb/DOM/ExceptionOr.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
|
|
void CSSRuleList::for_each_effective_style_rule(Function<void(CSSStyleRule const&)> const& callback) const
|
|
{
|
|
{
|
|
for (auto& rule : m_rules) {
|
|
for (auto& rule : m_rules) {
|
|
- if (rule.type() == CSSRule::Type::Style) {
|
|
|
|
|
|
+ switch (rule.type()) {
|
|
|
|
+ case CSSRule::Type::Style:
|
|
callback(verify_cast<CSSStyleRule>(rule));
|
|
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())
|
|
if (import_rule.has_import_result())
|
|
import_rule.loaded_style_sheet()->for_each_effective_style_rule(callback);
|
|
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)) {
|
|
if (import_rule.loaded_style_sheet()->for_first_not_loaded_import_rule(callback)) {
|
|
return true;
|
|
return true;
|
|
}
|
|
}
|
|
|
|
+ } else if (rule.type() == CSSRule::Type::Media) {
|
|
|
|
+ return verify_cast<CSSMediaRule>(rule).for_first_not_loaded_import_rule(callback);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|