mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 04:37:44 +00:00
LibWeb: Only invalidate styles if a @media
rule changes match status
This commit is contained in:
parent
144ef3eb9f
commit
fd24782d85
5 changed files with 26 additions and 15 deletions
|
@ -1161,13 +1161,14 @@ void Document::evaluate_media_queries_and_report_changes()
|
|||
}
|
||||
|
||||
// Also not in the spec, but this is as good a place as any to evaluate @media rules!
|
||||
bool any_media_queries_changed_match_state = false;
|
||||
for (auto& style_sheet : style_sheets().sheets()) {
|
||||
style_sheet.evaluate_media_queries(window());
|
||||
if (style_sheet.evaluate_media_queries(window()))
|
||||
any_media_queries_changed_match_state = true;
|
||||
}
|
||||
|
||||
// FIXME: This invalidates too often!
|
||||
// We should only invalidate when one or more @media rules changes evaluation status.
|
||||
style_computer().invalidate_rule_cache();
|
||||
if (any_media_queries_changed_match_state)
|
||||
style_computer().invalidate_rule_cache();
|
||||
}
|
||||
|
||||
NonnullRefPtr<DOMImplementation> Document::implementation() const
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue