mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-05-03 13:02:09 +02:00
CSSRuleList::evaluate_media_queries previously compared CSSMediaRule::condition_matches() (which reads MediaQuery::m_matches, default false) against the freshly-computed result. A brand-new @media rule whose condition matches would therefore look like a false->true flip the very first time it was evaluated, the same shape as the CSSStyleSheet outer-MediaList bug fixed in the previous commit. In practice all known paths that introduce a new @media rule (StyleSheetList::add_sheet, AdoptedStyleSheets on_set, CSSStyleSheet::invalidate_owners, CSSImportRule::set_style_sheet) call through CSSStyleSheet::evaluate_media_queries eagerly and absorb the flip before the next Document::evaluate_media_rules pass, so this change does not move counters in the existing tests. It does make the inner-@media handling consistent with the outer one, and protects any future path (e.g. CSSGroupingRule::insert_rule into a nested rule list) where a new @media rule might be evaluated for the first time during the regular media-rule pass. Track per-rule whether evaluate has been called yet via a sticky m_did_evaluate flag on CSSMediaRule, and only record a flip on subsequent evaluations.
1.6 KiB
1.6 KiB