1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 15:17:36 +00:00

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.
This commit is contained in:
Andreas Kling 2021-10-12 00:20:54 +02:00
parent 76ac1b2496
commit 865162b1c3

View file

@ -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();
}