mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 10:58:12 +00:00
LibWeb: Make document-level style invalidation fast
Add a flag to DOM::Document that means the whole document needs a style update. This saves us the trouble of traversing the entire DOM to mark all nodes as needing a style update.
This commit is contained in:
parent
f87edd4c14
commit
0b861e0c9d
3 changed files with 18 additions and 4 deletions
|
@ -176,6 +176,13 @@ void Node::set_node_value(const String& value)
|
|||
|
||||
void Node::invalidate_style()
|
||||
{
|
||||
if (is_document()) {
|
||||
auto& document = static_cast<DOM::Document&>(*this);
|
||||
document.set_needs_full_style_update(true);
|
||||
document.schedule_style_update();
|
||||
return;
|
||||
}
|
||||
|
||||
for_each_in_inclusive_subtree([&](Node& node) {
|
||||
node.m_needs_style_update = true;
|
||||
if (node.has_children())
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue