mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 08:37:45 +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:
parent
76ac1b2496
commit
865162b1c3
1 changed files with 2 additions and 0 deletions
|
@ -448,6 +448,7 @@ void Document::update_layout()
|
||||||
}
|
}
|
||||||
|
|
||||||
m_needs_layout = false;
|
m_needs_layout = false;
|
||||||
|
m_layout_update_timer->stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
static void update_style_recursively(DOM::Node& node)
|
static void update_style_recursively(DOM::Node& node)
|
||||||
|
@ -474,6 +475,7 @@ void Document::update_style()
|
||||||
if (!needs_style_update() && !child_needs_style_update())
|
if (!needs_style_update() && !child_needs_style_update())
|
||||||
return;
|
return;
|
||||||
update_style_recursively(*this);
|
update_style_recursively(*this);
|
||||||
|
m_style_update_timer->stop();
|
||||||
set_needs_layout();
|
set_needs_layout();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue