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

LibWeb: Add a simple StyleInvalidator class

This patch adds a simple, naive & inefficient class for document-wide
style invalidation, e.g. after element attribute updates. During
construction it collects a HashMap of a document's elements and their
matching rules, during destruction it does the same and then compares
the results; dirtying all elements that have a different number or order
of matching rules afterwards.

Much room for improvement, but it solves the problem of stale element
styling after attribute updates for now :^)

Fixes #4404.
This commit is contained in:
Linus Groh 2020-12-14 21:31:10 +00:00 committed by Andreas Kling
parent 9a9d655abe
commit 5e7945e26f
6 changed files with 142 additions and 16 deletions

View file

@ -51,6 +51,7 @@ public:
NonnullRefPtr<StyleProperties> resolve_style(const DOM::Element&, const StyleProperties* parent_style) const;
Vector<MatchingRule> collect_matching_rules(const DOM::Element&) const;
void sort_matching_rules(Vector<MatchingRule>&) const;
static bool is_inherited_property(CSS::PropertyID);