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

LibWeb: Split CSS::StyleSheet into StyleSheet and CSSStyleSheet

This is a little convoluted but matches the CSSOM specification.
This commit is contained in:
Andreas Kling 2021-03-07 16:14:04 +01:00
parent 0af4762662
commit fefb05f6f3
17 changed files with 162 additions and 82 deletions

View file

@ -87,8 +87,10 @@ Vector<MatchingRule> StyleResolver::collect_matching_rules(const DOM::Element& e
size_t style_sheet_index = 0;
for_each_stylesheet([&](auto& sheet) {
if (!is<CSSStyleSheet>(sheet))
return;
size_t rule_index = 0;
sheet.for_each_effective_style_rule([&](auto& rule) {
static_cast<const CSSStyleSheet&>(sheet).for_each_effective_style_rule([&](auto& rule) {
size_t selector_index = 0;
for (auto& selector : rule.selectors()) {
if (SelectorEngine::matches(selector, element)) {
@ -100,7 +102,7 @@ Vector<MatchingRule> StyleResolver::collect_matching_rules(const DOM::Element& e
++rule_index;
});
++style_sheet_index;
});
});
return matching_rules;
}