mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 19:38:12 +00:00
LibWeb: Sort matched style rules by specificity, document order
If two rules have equal specificity, they should be applied in the order in which we encountered them.
This commit is contained in:
parent
fa5e8be31c
commit
384b5f15c9
2 changed files with 31 additions and 10 deletions
|
@ -38,6 +38,13 @@ class ParentNode;
|
|||
class StyleRule;
|
||||
class StyleSheet;
|
||||
|
||||
struct MatchingRule {
|
||||
RefPtr<StyleRule> rule;
|
||||
size_t style_sheet_index { 0 };
|
||||
size_t rule_index { 0 };
|
||||
size_t selector_index { 0 };
|
||||
};
|
||||
|
||||
class StyleResolver {
|
||||
public:
|
||||
explicit StyleResolver(Document&);
|
||||
|
@ -48,7 +55,7 @@ public:
|
|||
|
||||
NonnullRefPtr<StyleProperties> resolve_style(const Element&, const StyleProperties* parent_style) const;
|
||||
|
||||
NonnullRefPtrVector<StyleRule> collect_matching_rules(const Element&) const;
|
||||
Vector<MatchingRule> collect_matching_rules(const Element&) const;
|
||||
|
||||
static bool is_inherited_property(CSS::PropertyID);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue