1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 20:27:45 +00:00

LibWeb: Actually visit rules and media queries in imported style sheets

Due to CSSImportRule::has_import_result() being backwards, we never
actually entered imported style sheets when traversing style rules or
media queries.

With this fixed, we no longer need the "collect style sheets" step in
StyleComputer, as normal for_each_effective_style_rule() will now
actually find all the rules. :^)
This commit is contained in:
Andreas Kling 2023-03-30 12:08:41 +02:00
parent fe761a4e9b
commit 45f8542965
6 changed files with 21 additions and 19 deletions

View file

@ -128,7 +128,7 @@ void CSSRuleList::for_each_effective_style_rule(Function<void(CSSStyleRule const
break;
case CSSRule::Type::Import: {
auto const& import_rule = static_cast<CSSImportRule const&>(*rule);
if (import_rule.has_import_result() && import_rule.loaded_style_sheet())
if (import_rule.loaded_style_sheet())
import_rule.loaded_style_sheet()->for_each_effective_style_rule(callback);
break;
}
@ -155,7 +155,7 @@ bool CSSRuleList::evaluate_media_queries(HTML::Window const& window)
break;
case CSSRule::Type::Import: {
auto& import_rule = verify_cast<CSSImportRule>(*rule);
if (import_rule.has_import_result() && import_rule.loaded_style_sheet() && import_rule.loaded_style_sheet()->evaluate_media_queries(window))
if (import_rule.loaded_style_sheet() && import_rule.loaded_style_sheet()->evaluate_media_queries(window))
any_media_queries_changed_match_state = true;
break;
}