mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 04:57:44 +00:00
LibWeb: Recurse into shadow trees when updating style
The style update mechanism was happily ignoring shadow subtrees. Fix this by checking if an element has a shadow root, and recursing into it if needed.
This commit is contained in:
parent
5d941ddf3a
commit
32dd4bf1b9
1 changed files with 6 additions and 0 deletions
|
@ -602,6 +602,12 @@ static void update_style_recursively(DOM::Node& node)
|
|||
node.set_needs_style_update(false);
|
||||
|
||||
if (node.child_needs_style_update()) {
|
||||
if (node.is_element()) {
|
||||
if (auto* shadow_root = static_cast<DOM::Element&>(node).shadow_root()) {
|
||||
if (shadow_root->needs_style_update() || shadow_root->child_needs_style_update())
|
||||
update_style_recursively(*shadow_root);
|
||||
}
|
||||
}
|
||||
node.for_each_child([&](auto& child) {
|
||||
if (child.needs_style_update() || child.child_needs_style_update())
|
||||
update_style_recursively(child);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue