mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-10 10:09:14 +00:00
LibWeb/CSS: Stop assuming CSSNestedDeclarations's parent is CSSStyleRule
This will no longer be true once we implement at-rules nested inside style rules, for example: ```css .foo { color: yellow; @media (min-width: 800px) { color: orange; } } ```
This commit is contained in:
parent
0b23dddb4b
commit
ce947ff983
Notes:
github-actions[bot]
2024-11-07 14:12:42 +00:00
Author: https://github.com/AtkinsSJ
Commit: ce947ff983
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/2202
3 changed files with 31 additions and 3 deletions
|
@ -111,7 +111,7 @@ SelectorList const& MatchingRule::absolutized_selectors() const
|
|||
if (rule->type() == CSSRule::Type::Style)
|
||||
return static_cast<CSSStyleRule const&>(*rule).absolutized_selectors();
|
||||
if (rule->type() == CSSRule::Type::NestedDeclarations)
|
||||
return static_cast<CSSStyleRule const&>(*rule->parent_rule()).absolutized_selectors();
|
||||
return static_cast<CSSNestedDeclarations const&>(*rule).parent_style_rule().absolutized_selectors();
|
||||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
|
||||
|
@ -120,7 +120,7 @@ FlyString const& MatchingRule::qualified_layer_name() const
|
|||
if (rule->type() == CSSRule::Type::Style)
|
||||
return static_cast<CSSStyleRule const&>(*rule).qualified_layer_name();
|
||||
if (rule->type() == CSSRule::Type::NestedDeclarations)
|
||||
return static_cast<CSSStyleRule const&>(*rule->parent_rule()).qualified_layer_name();
|
||||
return static_cast<CSSNestedDeclarations const&>(*rule).parent_style_rule().qualified_layer_name();
|
||||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
|
||||
|
@ -2462,7 +2462,7 @@ NonnullOwnPtr<StyleComputer::RuleCache> StyleComputer::make_rule_cache_for_casca
|
|||
if (rule.type() == CSSRule::Type::Style)
|
||||
return static_cast<CSSStyleRule const&>(rule).absolutized_selectors();
|
||||
if (rule.type() == CSSRule::Type::NestedDeclarations)
|
||||
return static_cast<CSSStyleRule const&>(*rule.parent_rule()).absolutized_selectors();
|
||||
return static_cast<CSSNestedDeclarations const&>(rule).parent_style_rule().absolutized_selectors();
|
||||
VERIFY_NOT_REACHED();
|
||||
}();
|
||||
for (CSS::Selector const& selector : absolutized_selectors) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue