From c7489e7665a129637d2f8e7bd6e936e15dbafab3 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Sat, 29 Oct 2022 13:07:49 +0200 Subject: [PATCH] LibWeb: Don't invalidate style for entire document on Node insertion Like for attribute changes, we now only invalidate the insertion parent and all of its descendants. Again, this is very aggressive, but also way less than doing the entire document. Once we implement the CSS :has() selector, we'll need to become more sophisticated about invalidation. --- Userland/Libraries/LibWeb/DOM/Node.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Userland/Libraries/LibWeb/DOM/Node.cpp b/Userland/Libraries/LibWeb/DOM/Node.cpp index e6ce9a49f9..32442ad081 100644 --- a/Userland/Libraries/LibWeb/DOM/Node.cpp +++ b/Userland/Libraries/LibWeb/DOM/Node.cpp @@ -458,7 +458,8 @@ void Node::insert_before(JS::NonnullGCPtr node, JS::GCPtr child, boo // 9. Run the children changed steps for parent. children_changed(); - document().invalidate_style(); + // FIXME: This will need to become smarter when we implement the :has() selector. + invalidate_style(); } // https://dom.spec.whatwg.org/#concept-node-pre-insert