mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 08:27:45 +00:00
LibWeb: Make sure that root of style updates is marked clean
The recursive style update function was written a bit strangely and would only mark descendants of the style update root as not needing a style update. With this patch, all nodes in the subtree now have clean style after a style update finishes.
This commit is contained in:
parent
13361bc47d
commit
5a929f12bc
1 changed files with 13 additions and 12 deletions
|
@ -452,18 +452,19 @@ void Document::update_layout()
|
||||||
|
|
||||||
static void update_style_recursively(DOM::Node& node)
|
static void update_style_recursively(DOM::Node& node)
|
||||||
{
|
{
|
||||||
node.for_each_child([&](auto& child) {
|
if (is<Element>(node))
|
||||||
if (child.needs_style_update()) {
|
static_cast<Element&>(node).recompute_style();
|
||||||
if (is<Element>(child))
|
node.set_needs_style_update(false);
|
||||||
verify_cast<Element>(child).recompute_style();
|
|
||||||
child.set_needs_style_update(false);
|
if (node.child_needs_style_update()) {
|
||||||
}
|
node.for_each_child([&](auto& child) {
|
||||||
if (child.child_needs_style_update()) {
|
if (child.needs_style_update())
|
||||||
update_style_recursively(child);
|
update_style_recursively(child);
|
||||||
child.set_child_needs_style_update(false);
|
return IterationDecision::Continue;
|
||||||
}
|
});
|
||||||
return IterationDecision::Continue;
|
}
|
||||||
});
|
|
||||||
|
node.set_child_needs_style_update(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Document::update_style()
|
void Document::update_style()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue