From aa8f17aea4d1aa1950a66969fc8b5c431fbc1b7c Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Thu, 19 Sep 2024 07:40:45 +0200 Subject: [PATCH] LibWeb: Rename invalidate_layout() => invalidate_layout_tree() I believe this is slightly less confusing, since what the function does is trigger a full layout tree *rebuild*, not just a relayout. --- Userland/Libraries/LibWeb/Animations/KeyframeEffect.cpp | 2 +- Userland/Libraries/LibWeb/DOM/Document.cpp | 6 +++--- Userland/Libraries/LibWeb/DOM/Document.h | 2 +- Userland/Libraries/LibWeb/DOM/Element.cpp | 2 +- Userland/Libraries/LibWeb/DOM/Node.cpp | 6 +++--- Userland/Libraries/LibWeb/DOM/ShadowRoot.cpp | 2 +- Userland/Libraries/LibWeb/HTML/HTMLInputElement.cpp | 4 ++-- Userland/Libraries/LibWeb/HTML/HTMLObjectElement.cpp | 2 +- Userland/Libraries/LibWeb/SVG/SVGGraphicsElement.cpp | 2 +- 9 files changed, 14 insertions(+), 14 deletions(-) diff --git a/Userland/Libraries/LibWeb/Animations/KeyframeEffect.cpp b/Userland/Libraries/LibWeb/Animations/KeyframeEffect.cpp index 2b19378f5de..afcd4de35f7 100644 --- a/Userland/Libraries/LibWeb/Animations/KeyframeEffect.cpp +++ b/Userland/Libraries/LibWeb/Animations/KeyframeEffect.cpp @@ -1000,7 +1000,7 @@ void KeyframeEffect::update_style_properties() if (invalidation.relayout) document.set_needs_layout(); if (invalidation.rebuild_layout_tree) - document.invalidate_layout(); + document.invalidate_layout_tree(); if (invalidation.repaint) document.set_needs_to_resolve_paint_only_properties(); if (invalidation.rebuild_stacking_context_tree) diff --git a/Userland/Libraries/LibWeb/DOM/Document.cpp b/Userland/Libraries/LibWeb/DOM/Document.cpp index 86ec9b1e261..ff1d94488b3 100644 --- a/Userland/Libraries/LibWeb/DOM/Document.cpp +++ b/Userland/Libraries/LibWeb/DOM/Document.cpp @@ -1049,7 +1049,7 @@ void Document::set_needs_layout() schedule_layout_update(); } -void Document::invalidate_layout() +void Document::invalidate_layout_tree() { tear_down_layout_tree(); schedule_layout_update(); @@ -1282,7 +1282,7 @@ void Document::update_style() invalidate_display_list(); } if (invalidation.rebuild_layout_tree) { - invalidate_layout(); + invalidate_layout_tree(); } else { if (invalidation.relayout) set_needs_layout(); @@ -2739,7 +2739,7 @@ void Document::evaluate_media_rules() if (any_media_queries_changed_match_state) { style_computer().invalidate_rule_cache(); invalidate_style(StyleInvalidationReason::MediaQueryChangedMatchState); - invalidate_layout(); + invalidate_layout_tree(); } } diff --git a/Userland/Libraries/LibWeb/DOM/Document.h b/Userland/Libraries/LibWeb/DOM/Document.h index 9d1f1c72cad..39b181a0d83 100644 --- a/Userland/Libraries/LibWeb/DOM/Document.h +++ b/Userland/Libraries/LibWeb/DOM/Document.h @@ -243,7 +243,7 @@ public: void set_needs_layout(); - void invalidate_layout(); + void invalidate_layout_tree(); void invalidate_stacking_context_tree(); virtual bool is_child_allowed(Node const&) const override; diff --git a/Userland/Libraries/LibWeb/DOM/Element.cpp b/Userland/Libraries/LibWeb/DOM/Element.cpp index 9e191066205..e1214498d97 100644 --- a/Userland/Libraries/LibWeb/DOM/Element.cpp +++ b/Userland/Libraries/LibWeb/DOM/Element.cpp @@ -826,7 +826,7 @@ WebIDL::ExceptionOr Element::set_inner_html(StringView value) if (context->is_connected()) { // NOTE: Since the DOM has changed, we have to rebuild the layout tree. - context->document().invalidate_layout(); + context->document().invalidate_layout_tree(); } } diff --git a/Userland/Libraries/LibWeb/DOM/Node.cpp b/Userland/Libraries/LibWeb/DOM/Node.cpp index 6a5c5d839e2..bc4b1c3ed3e 100644 --- a/Userland/Libraries/LibWeb/DOM/Node.cpp +++ b/Userland/Libraries/LibWeb/DOM/Node.cpp @@ -208,7 +208,7 @@ void Node::set_text_content(Optional const& maybe_content) if (is_connected()) { document().invalidate_style(StyleInvalidationReason::NodeSetTextContent); - document().invalidate_layout(); + document().invalidate_layout_tree(); } document().bump_dom_tree_version(); @@ -656,7 +656,7 @@ void Node::insert_before(JS::NonnullGCPtr node, JS::GCPtr child, boo if (is_connected()) { // FIXME: This will need to become smarter when we implement the :has() selector. invalidate_style(StyleInvalidationReason::NodeInsertBefore); - document().invalidate_layout(); + document().invalidate_layout_tree(); } document().bump_dom_tree_version(); @@ -855,7 +855,7 @@ void Node::remove(bool suppress_observers) // Since the tree structure has changed, we need to invalidate both style and layout. // In the future, we should find a way to only invalidate the parts that actually need it. document().invalidate_style(StyleInvalidationReason::NodeRemove); - document().invalidate_layout(); + document().invalidate_layout_tree(); } document().bump_dom_tree_version(); diff --git a/Userland/Libraries/LibWeb/DOM/ShadowRoot.cpp b/Userland/Libraries/LibWeb/DOM/ShadowRoot.cpp index ebc4a8c5028..0c9061fdc8f 100644 --- a/Userland/Libraries/LibWeb/DOM/ShadowRoot.cpp +++ b/Userland/Libraries/LibWeb/DOM/ShadowRoot.cpp @@ -88,7 +88,7 @@ WebIDL::ExceptionOr ShadowRoot::set_inner_html(StringView value) if (this->is_connected()) { // NOTE: Since the DOM has changed, we have to rebuild the layout tree. - this->document().invalidate_layout(); + this->document().invalidate_layout_tree(); } } diff --git a/Userland/Libraries/LibWeb/HTML/HTMLInputElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLInputElement.cpp index 643ce9b7068..97d3087bcc5 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLInputElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLInputElement.cpp @@ -987,7 +987,7 @@ void HTMLInputElement::update_file_input_shadow_tree() m_file_label->set_text_content(MUST(String::formatted("No {} selected.", files_label))); } - document().invalidate_layout(); + document().invalidate_layout_tree(); } void HTMLInputElement::create_range_input_shadow_tree() @@ -1315,7 +1315,7 @@ WebIDL::ExceptionOr HTMLInputElement::handle_src_attribute(String const& v }); m_load_event_delayer.clear(); - document().invalidate_layout(); + document().invalidate_layout_tree(); }, [this, &realm]() { // 2. Otherwise, if the fetching process fails without a response from the remote server, or completes but the diff --git a/Userland/Libraries/LibWeb/HTML/HTMLObjectElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLObjectElement.cpp index 6d9b9c4948c..352d9fbe998 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLObjectElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLObjectElement.cpp @@ -363,7 +363,7 @@ void HTMLObjectElement::update_layout_and_child_objects(Representation represent m_representation = representation; invalidate_style(DOM::StyleInvalidationReason::HTMLObjectElementUpdateLayoutAndChildObjects); - document().invalidate_layout(); + document().invalidate_layout_tree(); } // https://html.spec.whatwg.org/multipage/interaction.html#dom-tabindex diff --git a/Userland/Libraries/LibWeb/SVG/SVGGraphicsElement.cpp b/Userland/Libraries/LibWeb/SVG/SVGGraphicsElement.cpp index a42bbff3d66..1ddd7114320 100644 --- a/Userland/Libraries/LibWeb/SVG/SVGGraphicsElement.cpp +++ b/Userland/Libraries/LibWeb/SVG/SVGGraphicsElement.cpp @@ -45,7 +45,7 @@ void SVGGraphicsElement::attribute_changed(FlyString const& name, Optional