mirror of
https://github.com/fergalmoran/ladybird.git
synced 2026-01-04 07:36:50 +00:00
LibWeb/CSS: Process style properties from CSSNestedDeclarations rules
These are created when a style rule has properties listed after another
rule. For example:
```css
.test {
--a: 1;
--b: 1;
--c: 1;
.thing {
/* ... */
}
/* These are after a rule (.thing) so they're wrapped in a
CSSNestedDeclarations: */
--d: 1;
--e: 1;
--f: 1;
}
```
They're treated like a nested style rule with the exact same selectors
as their containing style rule.
This commit is contained in:
committed by
Andreas Kling
parent
53f99e51f8
commit
e4245dc39e
@@ -300,11 +300,11 @@ void CSSStyleSheet::for_each_effective_rule(TraversalOrder order, Function<void(
|
||||
m_rules->for_each_effective_rule(order, callback);
|
||||
}
|
||||
|
||||
void CSSStyleSheet::for_each_effective_style_rule(Function<void(CSSStyleRule const&)> const& callback) const
|
||||
void CSSStyleSheet::for_each_effective_style_producing_rule(Function<void(CSSRule const&)> const& callback) const
|
||||
{
|
||||
for_each_effective_rule(TraversalOrder::Preorder, [&](CSSRule const& rule) {
|
||||
if (rule.type() == CSSRule::Type::Style)
|
||||
callback(static_cast<CSSStyleRule const&>(rule));
|
||||
if (rule.type() == CSSRule::Type::Style || rule.type() == CSSRule::Type::NestedDeclarations)
|
||||
callback(rule);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user