浏览代码

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.
Andreas Kling 3 年之前
父节点
当前提交
865162b1c3
共有 1 个文件被更改,包括 2 次插入0 次删除
  1. 2 0
      Userland/Libraries/LibWeb/DOM/Document.cpp

+ 2 - 0
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();
 }