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

LibWeb: Don't update style/layout in template contents owner documents

These helper documents don't actually get rendered, so computing style
and doing layout for them is a complete waste of work.
This commit is contained in:
Andreas Kling 2022-10-29 13:16:32 +02:00
parent 64d5d633cf
commit ba6a9318c3

View file

@ -809,6 +809,10 @@ void Document::update_layout()
if (!m_needs_layout && m_layout_root)
return;
// NOTE: If this is a document hosting <template> contents, layout is unnecessary.
if (m_created_for_appropriate_template_contents)
return;
if (!browsing_context())
return;
@ -886,6 +890,11 @@ void Document::update_style()
return;
if (!needs_full_style_update() && !needs_style_update() && !child_needs_style_update())
return;
// NOTE: If this is a document hosting <template> contents, style update is unnecessary.
if (m_created_for_appropriate_template_contents)
return;
evaluate_media_rules();
if (update_style_recursively(*this))
invalidate_layout();