From 180a58b3d298bcd539c85840a6cfd4ad8406e678 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Fri, 7 Mar 2025 21:31:03 +0100 Subject: [PATCH] LibWeb: Don't drop entire layout tree on update This was completely unnecessary, and we can just let the internal DOM tree changes trigger partial layout updates instead. Noticed we were repeatedly dropping layout trees on ChatGPT and this was one of the culprits. --- Libraries/LibWeb/DOM/Document.h | 3 +-- Libraries/LibWeb/HTML/HTMLInputElement.cpp | 2 -- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/Libraries/LibWeb/DOM/Document.h b/Libraries/LibWeb/DOM/Document.h index 7bbe231cf76..1712f306d07 100644 --- a/Libraries/LibWeb/DOM/Document.h +++ b/Libraries/LibWeb/DOM/Document.h @@ -78,8 +78,7 @@ enum class SetNeedsLayoutReason { X(KeyframeEffect) \ X(MediaQueryChangedMatchState) \ X(SVGGraphicsElementTransformAttributeChange) \ - X(ShadowRootSetInnerHTML) \ - X(UpdateFileInputShadowTree) + X(ShadowRootSetInnerHTML) enum class InvalidateLayoutTreeReason { #define ENUMERATE_INVALIDATE_LAYOUT_TREE_REASON(e) e, diff --git a/Libraries/LibWeb/HTML/HTMLInputElement.cpp b/Libraries/LibWeb/HTML/HTMLInputElement.cpp index c9784955c22..734839a3dff 100644 --- a/Libraries/LibWeb/HTML/HTMLInputElement.cpp +++ b/Libraries/LibWeb/HTML/HTMLInputElement.cpp @@ -1128,8 +1128,6 @@ void HTMLInputElement::update_file_input_shadow_tree() } else { m_file_label->set_text_content(MUST(String::formatted("No {} selected.", files_label))); } - - document().invalidate_layout_tree(DOM::InvalidateLayoutTreeReason::UpdateFileInputShadowTree); } void HTMLInputElement::create_range_input_shadow_tree()