From 04bec7a4f53ecd13673d6ea1acdb172abadc4b2c Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Sat, 5 Feb 2022 15:19:16 +0100 Subject: [PATCH] LibWeb: Remove CSS::StyleInvalidator in favor of dirtying + lazy update Style updates are lazy since late last year, so the StyleInvalidator is actually hurting us more than it's helping by running the entire CSS selector machine on the whole DOM for every attribute change. Instead, simply mark the entire DOM dirty and let the lazy style update mechanism run *once* on next event loop iteration. --- Base/res/html/misc/attr-invalidate-style.html | 29 ++++++++++ Base/res/html/misc/welcome.html | 1 + Userland/Libraries/LibWeb/CMakeLists.txt | 1 - .../Libraries/LibWeb/CSS/StyleInvalidator.cpp | 55 ------------------- .../Libraries/LibWeb/CSS/StyleInvalidator.h | 26 --------- Userland/Libraries/LibWeb/DOM/Element.cpp | 11 ++-- 6 files changed, 37 insertions(+), 86 deletions(-) create mode 100644 Base/res/html/misc/attr-invalidate-style.html delete mode 100644 Userland/Libraries/LibWeb/CSS/StyleInvalidator.cpp delete mode 100644 Userland/Libraries/LibWeb/CSS/StyleInvalidator.h diff --git a/Base/res/html/misc/attr-invalidate-style.html b/Base/res/html/misc/attr-invalidate-style.html new file mode 100644 index 0000000000..eed7e51c0f --- /dev/null +++ b/Base/res/html/misc/attr-invalidate-style.html @@ -0,0 +1,29 @@ + + + + + +
RED
+
GREEN
+
+
BLUE
+ + + diff --git a/Base/res/html/misc/welcome.html b/Base/res/html/misc/welcome.html index b23ef984fa..cb581f2e86 100644 --- a/Base/res/html/misc/welcome.html +++ b/Base/res/html/misc/welcome.html @@ -76,6 +76,7 @@

CSS