LibWeb: Don't schedule style/layout updates in detached documents

There's no need to do any kind of style or layout work in documents that
aren't attached to a browsing context.
This commit is contained in:
Andreas Kling 2024-04-14 09:58:01 +02:00
commit 2fbcaadef0
Notes: sideshowbarker 2024-07-17 22:41:14 +09:00

View file

@ -699,12 +699,18 @@ void Document::set_origin(HTML::Origin const& origin)
void Document::schedule_style_update()
{
if (!browsing_context())
return;
// NOTE: Update of the style is a step in HTML event loop processing.
HTML::main_thread_event_loop().schedule();
}
void Document::schedule_layout_update()
{
if (!browsing_context())
return;
// NOTE: Update of the layout is a step in HTML event loop processing.
HTML::main_thread_event_loop().schedule();
}