From 865162b1c3a0d94b3cfa165e7f4e33f647cbb749 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Tue, 12 Oct 2021 00:20:54 +0200 Subject: [PATCH] LibWeb: Stop the style/layout update timers after updating style/layout If we had a scheduled update of either of these kind, make sure to cancel it after performing an update. Otherwise we might do a redundant second update with the same results. This could happen if something schedules an async layout, and before it can happen, something requires a sync layout, which we do right away. --- Userland/Libraries/LibWeb/DOM/Document.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Userland/Libraries/LibWeb/DOM/Document.cpp b/Userland/Libraries/LibWeb/DOM/Document.cpp index 1e20c5b3e2..6be5e0638e 100644 --- a/Userland/Libraries/LibWeb/DOM/Document.cpp +++ b/Userland/Libraries/LibWeb/DOM/Document.cpp @@ -448,6 +448,7 @@ void Document::update_layout() } m_needs_layout = false; + m_layout_update_timer->stop(); } static void update_style_recursively(DOM::Node& node) @@ -474,6 +475,7 @@ void Document::update_style() if (!needs_style_update() && !child_needs_style_update()) return; update_style_recursively(*this); + m_style_update_timer->stop(); set_needs_layout(); }