diff --git a/Libraries/LibWeb/DOM/Element.cpp b/Libraries/LibWeb/DOM/Element.cpp index 15f96b626fb..cee6a5a7129 100644 --- a/Libraries/LibWeb/DOM/Element.cpp +++ b/Libraries/LibWeb/DOM/Element.cpp @@ -1089,9 +1089,9 @@ void Element::inserted() document().element_with_name_was_added({}, *this); } -void Element::removed_from(Node* node) +void Element::removed_from(Node* old_parent, Node& old_root) { - Base::removed_from(node); + Base::removed_from(old_parent, old_root); if (m_id.has_value()) document().element_with_id_was_removed({}, *this); diff --git a/Libraries/LibWeb/DOM/Element.h b/Libraries/LibWeb/DOM/Element.h index cf1e31aba2b..71c9778f85b 100644 --- a/Libraries/LibWeb/DOM/Element.h +++ b/Libraries/LibWeb/DOM/Element.h @@ -403,7 +403,7 @@ protected: virtual void initialize(JS::Realm&) override; virtual void inserted() override; - virtual void removed_from(Node*) override; + virtual void removed_from(Node* old_parent, Node& old_root) override; virtual void children_changed() override; virtual i32 default_tab_index_value() const; diff --git a/Libraries/LibWeb/DOM/Node.cpp b/Libraries/LibWeb/DOM/Node.cpp index 5796ac3b88b..224772e9728 100644 --- a/Libraries/LibWeb/DOM/Node.cpp +++ b/Libraries/LibWeb/DOM/Node.cpp @@ -906,9 +906,11 @@ void Node::remove(bool suppress_observers) if (auto assigned_slot = assigned_slot_for_node(*this)) assign_slottables(*assigned_slot); + auto& parent_root = parent->root(); + // 13. If parent’s root is a shadow root, and parent is a slot whose assigned nodes is the empty list, then run // signal a slot change for parent. - if (parent->root().is_shadow_root() && is(parent)) { + if (parent_root.is_shadow_root() && is(parent)) { auto& slot = static_cast(*parent); if (slot.assigned_nodes_internal().is_empty()) @@ -925,14 +927,14 @@ void Node::remove(bool suppress_observers) if (has_descendent_slot) { // 1. Run assign slottables for a tree with parent’s root. - assign_slottables_for_a_tree(parent->root()); + assign_slottables_for_a_tree(parent_root); // 2. Run assign slottables for a tree with node. assign_slottables_for_a_tree(*this); } // 15. Run the removing steps with node and parent. - removed_from(parent); + removed_from(parent, parent_root); // 16. Let isParentConnected be parent’s connected. bool is_parent_connected = parent->is_connected(); @@ -953,7 +955,7 @@ void Node::remove(bool suppress_observers) // 18. For each shadow-including descendant descendant of node, in shadow-including tree order, then: for_each_shadow_including_descendant([&](Node& descendant) { // 1. Run the removing steps with descendant - descendant.removed_from(nullptr); + descendant.removed_from(nullptr, parent_root); // 2. If descendant is custom and isParentConnected is true, then enqueue a custom element callback reaction with descendant, // callback name "disconnectedCallback", and an empty argument list. @@ -1433,7 +1435,7 @@ void Node::inserted() set_needs_style_update(true); } -void Node::removed_from(Node*) +void Node::removed_from(Node*, Node&) { m_layout_node = nullptr; m_paintable = nullptr; diff --git a/Libraries/LibWeb/DOM/Node.h b/Libraries/LibWeb/DOM/Node.h index 27c57cae837..eab753f2672 100644 --- a/Libraries/LibWeb/DOM/Node.h +++ b/Libraries/LibWeb/DOM/Node.h @@ -261,7 +261,7 @@ public: virtual void inserted(); virtual void post_connection(); - virtual void removed_from(Node*); + virtual void removed_from(Node* old_parent, Node& old_root); virtual void children_changed() { } virtual void adopted_from(Document&) { } virtual WebIDL::ExceptionOr cloned(Node&, bool) const { return {}; } diff --git a/Libraries/LibWeb/HTML/FormAssociatedElement.h b/Libraries/LibWeb/HTML/FormAssociatedElement.h index 7fee0ca378d..7173e10d46d 100644 --- a/Libraries/LibWeb/HTML/FormAssociatedElement.h +++ b/Libraries/LibWeb/HTML/FormAssociatedElement.h @@ -38,11 +38,11 @@ private: form_associated_element_was_inserted(); \ } \ \ - virtual void removed_from(DOM::Node* node) override \ + virtual void removed_from(DOM::Node* old_parent, DOM::Node& old_root) override \ { \ - ElementBaseClass::removed_from(node); \ + ElementBaseClass::removed_from(old_parent, old_root); \ form_node_was_removed(); \ - form_associated_element_was_removed(node); \ + form_associated_element_was_removed(old_parent); \ } \ \ virtual void attribute_changed(FlyString const& name, Optional const& old_value, Optional const& value, Optional const& namespace_) override \ diff --git a/Libraries/LibWeb/HTML/HTMLBaseElement.cpp b/Libraries/LibWeb/HTML/HTMLBaseElement.cpp index 9b153fa730e..d484629f4ce 100644 --- a/Libraries/LibWeb/HTML/HTMLBaseElement.cpp +++ b/Libraries/LibWeb/HTML/HTMLBaseElement.cpp @@ -40,9 +40,9 @@ void HTMLBaseElement::inserted() set_the_frozen_base_url(); } -void HTMLBaseElement::removed_from(Node* parent) +void HTMLBaseElement::removed_from(Node* old_parent, Node& old_root) { - HTMLElement::removed_from(parent); + HTMLElement::removed_from(old_parent, old_root); document().update_base_element({}); } diff --git a/Libraries/LibWeb/HTML/HTMLBaseElement.h b/Libraries/LibWeb/HTML/HTMLBaseElement.h index 3350a75174e..1c953433c81 100644 --- a/Libraries/LibWeb/HTML/HTMLBaseElement.h +++ b/Libraries/LibWeb/HTML/HTMLBaseElement.h @@ -23,7 +23,7 @@ public: URL::URL const& frozen_base_url() const { return m_frozen_base_url; } virtual void inserted() override; - virtual void removed_from(Node*) override; + virtual void removed_from(Node* old_parent, Node& old_root) override; virtual void attribute_changed(FlyString const& name, Optional const& old_value, Optional const& value, Optional const& namespace_) override; private: diff --git a/Libraries/LibWeb/HTML/HTMLDetailsElement.cpp b/Libraries/LibWeb/HTML/HTMLDetailsElement.cpp index 7227d623032..6b6ac1688cc 100644 --- a/Libraries/LibWeb/HTML/HTMLDetailsElement.cpp +++ b/Libraries/LibWeb/HTML/HTMLDetailsElement.cpp @@ -52,8 +52,9 @@ void HTMLDetailsElement::inserted() update_shadow_tree_slots(); } -void HTMLDetailsElement::removed_from(DOM::Node*) +void HTMLDetailsElement::removed_from(DOM::Node* old_parent, DOM::Node& old_root) { + Base::removed_from(old_parent, old_root); set_shadow_root(nullptr); } diff --git a/Libraries/LibWeb/HTML/HTMLDetailsElement.h b/Libraries/LibWeb/HTML/HTMLDetailsElement.h index 8dd57f2e580..89d9d7d90a5 100644 --- a/Libraries/LibWeb/HTML/HTMLDetailsElement.h +++ b/Libraries/LibWeb/HTML/HTMLDetailsElement.h @@ -32,7 +32,7 @@ private: virtual void visit_edges(Cell::Visitor&) override; virtual void inserted() override; - virtual void removed_from(DOM::Node*) override; + virtual void removed_from(DOM::Node* old_parent, DOM::Node& old_root) override; virtual void children_changed() override; virtual void attribute_changed(FlyString const& local_name, Optional const& old_value, Optional const& value, Optional const& namespace_) override; diff --git a/Libraries/LibWeb/HTML/HTMLDialogElement.cpp b/Libraries/LibWeb/HTML/HTMLDialogElement.cpp index 79476d61a62..902d6338a03 100644 --- a/Libraries/LibWeb/HTML/HTMLDialogElement.cpp +++ b/Libraries/LibWeb/HTML/HTMLDialogElement.cpp @@ -41,9 +41,9 @@ void HTMLDialogElement::visit_edges(JS::Cell::Visitor& visitor) visitor.visit(m_close_watcher); } -void HTMLDialogElement::removed_from(Node* old_parent) +void HTMLDialogElement::removed_from(Node* old_parent, Node& old_root) { - HTMLElement::removed_from(old_parent); + HTMLElement::removed_from(old_parent, old_root); // 1. If removedNode's close watcher is not null, then: if (m_close_watcher) { diff --git a/Libraries/LibWeb/HTML/HTMLDialogElement.h b/Libraries/LibWeb/HTML/HTMLDialogElement.h index 3d910ee4949..6c21c2e2e8a 100644 --- a/Libraries/LibWeb/HTML/HTMLDialogElement.h +++ b/Libraries/LibWeb/HTML/HTMLDialogElement.h @@ -20,7 +20,7 @@ class HTMLDialogElement final : public HTMLElement { public: virtual ~HTMLDialogElement() override; - virtual void removed_from(Node*) override; + virtual void removed_from(Node* old_parent, Node& old_root) override; String return_value() const; void set_return_value(String); diff --git a/Libraries/LibWeb/HTML/HTMLElement.cpp b/Libraries/LibWeb/HTML/HTMLElement.cpp index d819ee27309..45ebe83fc5a 100644 --- a/Libraries/LibWeb/HTML/HTMLElement.cpp +++ b/Libraries/LibWeb/HTML/HTMLElement.cpp @@ -1286,9 +1286,9 @@ void HTMLElement::did_lose_focus() document().editing_host_manager()->set_active_contenteditable_element(nullptr); } -void HTMLElement::removed_from(Node* old_parent) +void HTMLElement::removed_from(Node* old_parent, Node& old_root) { - Element::removed_from(old_parent); + Element::removed_from(old_parent, old_root); // If removedNode's popover attribute is not in the no popover state, then run the hide popover algorithm given removedNode, false, false, and false. if (popover().has_value()) diff --git a/Libraries/LibWeb/HTML/HTMLElement.h b/Libraries/LibWeb/HTML/HTMLElement.h index 2f7699e60a7..5091d203968 100644 --- a/Libraries/LibWeb/HTML/HTMLElement.h +++ b/Libraries/LibWeb/HTML/HTMLElement.h @@ -116,7 +116,7 @@ public: WebIDL::ExceptionOr set_popover(Optional value); Optional popover() const; - virtual void removed_from(Node*) override; + virtual void removed_from(Node* old_parent, Node& old_root) override; enum class PopoverVisibilityState { Hidden, diff --git a/Libraries/LibWeb/HTML/HTMLFrameElement.cpp b/Libraries/LibWeb/HTML/HTMLFrameElement.cpp index 5896b8fc6ac..c8cbd0d3d31 100644 --- a/Libraries/LibWeb/HTML/HTMLFrameElement.cpp +++ b/Libraries/LibWeb/HTML/HTMLFrameElement.cpp @@ -56,9 +56,9 @@ void HTMLFrameElement::inserted() } // https://html.spec.whatwg.org/multipage/obsolete.html#frames:html-element-removing-steps -void HTMLFrameElement::removed_from(DOM::Node* node) +void HTMLFrameElement::removed_from(DOM::Node* old_parent, DOM::Node& old_root) { - Base::removed_from(node); + Base::removed_from(old_parent, old_root); // The frame HTML element removing steps, given removedNode, are to destroy a child navigable given removedNode. destroy_the_child_navigable(); diff --git a/Libraries/LibWeb/HTML/HTMLFrameElement.h b/Libraries/LibWeb/HTML/HTMLFrameElement.h index a8f8b5d2790..0708e0a9e2a 100644 --- a/Libraries/LibWeb/HTML/HTMLFrameElement.h +++ b/Libraries/LibWeb/HTML/HTMLFrameElement.h @@ -25,7 +25,7 @@ private: // ^DOM::Element virtual void inserted() override; - virtual void removed_from(Node*) override; + virtual void removed_from(Node* old_parent, Node& old_root) override; virtual void attribute_changed(FlyString const& name, Optional const& old_value, Optional const& value, Optional const& namespace_) override; virtual i32 default_tab_index_value() const override; virtual void adjust_computed_style(CSS::ComputedProperties&) override; diff --git a/Libraries/LibWeb/HTML/HTMLIFrameElement.cpp b/Libraries/LibWeb/HTML/HTMLIFrameElement.cpp index 7876298efd3..7ebb0f6804c 100644 --- a/Libraries/LibWeb/HTML/HTMLIFrameElement.cpp +++ b/Libraries/LibWeb/HTML/HTMLIFrameElement.cpp @@ -173,9 +173,9 @@ void HTMLIFrameElement::process_the_iframe_attributes(bool initial_insertion) } // https://html.spec.whatwg.org/multipage/iframe-embed-object.html#the-iframe-element:the-iframe-element-7 -void HTMLIFrameElement::removed_from(DOM::Node* node) +void HTMLIFrameElement::removed_from(DOM::Node* old_parent, DOM::Node& old_root) { - HTMLElement::removed_from(node); + HTMLElement::removed_from(old_parent, old_root); // When an iframe element is removed from a document, the user agent must destroy the nested navigable of the element. destroy_the_child_navigable(); diff --git a/Libraries/LibWeb/HTML/HTMLIFrameElement.h b/Libraries/LibWeb/HTML/HTMLIFrameElement.h index 2df8ac4ffdf..d13cc854366 100644 --- a/Libraries/LibWeb/HTML/HTMLIFrameElement.h +++ b/Libraries/LibWeb/HTML/HTMLIFrameElement.h @@ -45,7 +45,7 @@ private: // ^DOM::Element virtual void post_connection() override; - virtual void removed_from(Node*) override; + virtual void removed_from(Node* old_parent, Node& old_root) override; virtual void attribute_changed(FlyString const& name, Optional const& old_value, Optional const& value, Optional const& namespace_) override; virtual i32 default_tab_index_value() const override; diff --git a/Libraries/LibWeb/HTML/HTMLLinkElement.cpp b/Libraries/LibWeb/HTML/HTMLLinkElement.cpp index 7a6c6566c86..c9840ba6fc8 100644 --- a/Libraries/LibWeb/HTML/HTMLLinkElement.cpp +++ b/Libraries/LibWeb/HTML/HTMLLinkElement.cpp @@ -50,9 +50,9 @@ void HTMLLinkElement::initialize(JS::Realm& realm) WEB_SET_PROTOTYPE_FOR_INTERFACE(HTMLLinkElement); } -void HTMLLinkElement::removed_from(Node* old_parent) +void HTMLLinkElement::removed_from(Node* old_parent, Node& old_root) { - Base::removed_from(old_parent); + Base::removed_from(old_parent, old_root); if (m_loaded_style_sheet) { document_or_shadow_root_style_sheets().remove_a_css_style_sheet(*m_loaded_style_sheet); m_loaded_style_sheet = nullptr; diff --git a/Libraries/LibWeb/HTML/HTMLLinkElement.h b/Libraries/LibWeb/HTML/HTMLLinkElement.h index cd1b958137e..51230cadc4a 100644 --- a/Libraries/LibWeb/HTML/HTMLLinkElement.h +++ b/Libraries/LibWeb/HTML/HTMLLinkElement.h @@ -28,7 +28,7 @@ public: virtual ~HTMLLinkElement() override; virtual void inserted() override; - virtual void removed_from(Node* old_parent) override; + virtual void removed_from(Node* old_parent, Node& old_root) override; String rel() const { return get_attribute_value(HTML::AttributeNames::rel); } String type() const { return get_attribute_value(HTML::AttributeNames::type); } diff --git a/Libraries/LibWeb/HTML/HTMLMediaElement.cpp b/Libraries/LibWeb/HTML/HTMLMediaElement.cpp index 70fef36f5f6..badd035b165 100644 --- a/Libraries/LibWeb/HTML/HTMLMediaElement.cpp +++ b/Libraries/LibWeb/HTML/HTMLMediaElement.cpp @@ -112,9 +112,9 @@ void HTMLMediaElement::attribute_changed(FlyString const& name, Optional } // https://html.spec.whatwg.org/multipage/media.html#playing-the-media-resource:media-element-83 -void HTMLMediaElement::removed_from(DOM::Node* node) +void HTMLMediaElement::removed_from(DOM::Node* old_parent, DOM::Node& old_root) { - Base::removed_from(node); + Base::removed_from(old_parent, old_root); // When a media element is removed from a Document, the user agent must run the following steps: diff --git a/Libraries/LibWeb/HTML/HTMLMediaElement.h b/Libraries/LibWeb/HTML/HTMLMediaElement.h index fa330e09ce2..4805c7e60f7 100644 --- a/Libraries/LibWeb/HTML/HTMLMediaElement.h +++ b/Libraries/LibWeb/HTML/HTMLMediaElement.h @@ -157,7 +157,7 @@ protected: virtual void visit_edges(Cell::Visitor&) override; virtual void attribute_changed(FlyString const& name, Optional const& old_value, Optional const& value, Optional const& namespace_) override; - virtual void removed_from(DOM::Node*) override; + virtual void removed_from(DOM::Node* old_parent, DOM::Node& old_root) override; virtual void children_changed() override; // Override in subclasses to handle implementation-specific behavior when the element state changes diff --git a/Libraries/LibWeb/HTML/HTMLMetaElement.cpp b/Libraries/LibWeb/HTML/HTMLMetaElement.cpp index f7079ec41a5..ef145e6f5e6 100644 --- a/Libraries/LibWeb/HTML/HTMLMetaElement.cpp +++ b/Libraries/LibWeb/HTML/HTMLMetaElement.cpp @@ -151,9 +151,9 @@ void HTMLMetaElement::inserted() } } -void HTMLMetaElement::removed_from(Node* parent) +void HTMLMetaElement::removed_from(Node* old_parent, Node& old_root) { - Base::removed_from(parent); + Base::removed_from(old_parent, old_root); update_metadata(); } diff --git a/Libraries/LibWeb/HTML/HTMLMetaElement.h b/Libraries/LibWeb/HTML/HTMLMetaElement.h index f844bd4ceb4..f87052586d1 100644 --- a/Libraries/LibWeb/HTML/HTMLMetaElement.h +++ b/Libraries/LibWeb/HTML/HTMLMetaElement.h @@ -45,7 +45,7 @@ private: // ^DOM::Element virtual void inserted() override; - virtual void removed_from(Node*) override; + virtual void removed_from(Node* old_parent, Node& old_root) override; virtual void attribute_changed(FlyString const& local_name, Optional const& old_value, Optional const& value, Optional const& namespace_) override; }; diff --git a/Libraries/LibWeb/HTML/HTMLMeterElement.cpp b/Libraries/LibWeb/HTML/HTMLMeterElement.cpp index f789cd7743b..28c75e7da87 100644 --- a/Libraries/LibWeb/HTML/HTMLMeterElement.cpp +++ b/Libraries/LibWeb/HTML/HTMLMeterElement.cpp @@ -173,8 +173,9 @@ void HTMLMeterElement::inserted() create_shadow_tree_if_needed(); } -void HTMLMeterElement::removed_from(DOM::Node*) +void HTMLMeterElement::removed_from(DOM::Node* old_parent, DOM::Node& old_root) { + Base::removed_from(old_parent, old_root); set_shadow_root(nullptr); } diff --git a/Libraries/LibWeb/HTML/HTMLMeterElement.h b/Libraries/LibWeb/HTML/HTMLMeterElement.h index 1967f6085f8..0a80948c61b 100644 --- a/Libraries/LibWeb/HTML/HTMLMeterElement.h +++ b/Libraries/LibWeb/HTML/HTMLMeterElement.h @@ -35,7 +35,7 @@ public: // ^HTMLElement virtual void inserted() override; - virtual void removed_from(DOM::Node*) override; + virtual void removed_from(DOM::Node* old_parent, DOM::Node& old_root) override; virtual void adjust_computed_style(CSS::ComputedProperties&) override; diff --git a/Libraries/LibWeb/HTML/HTMLOptGroupElement.cpp b/Libraries/LibWeb/HTML/HTMLOptGroupElement.cpp index fd45a79dc3f..4cd4060e371 100644 --- a/Libraries/LibWeb/HTML/HTMLOptGroupElement.cpp +++ b/Libraries/LibWeb/HTML/HTMLOptGroupElement.cpp @@ -36,9 +36,9 @@ void HTMLOptGroupElement::inserted() static_cast(*parent()).update_selectedness(); } -void HTMLOptGroupElement::removed_from(Node* old_parent) +void HTMLOptGroupElement::removed_from(Node* old_parent, Node& old_root) { - Base::removed_from(old_parent); + Base::removed_from(old_parent, old_root); // The optgroup HTML element removing steps, given removedNode and oldParent, are: // 1. If oldParent is a select element and removedNode has an option child, then run oldParent's selectedness setting algorithm. diff --git a/Libraries/LibWeb/HTML/HTMLOptGroupElement.h b/Libraries/LibWeb/HTML/HTMLOptGroupElement.h index a13f207cac3..57f3cbdc577 100644 --- a/Libraries/LibWeb/HTML/HTMLOptGroupElement.h +++ b/Libraries/LibWeb/HTML/HTMLOptGroupElement.h @@ -25,7 +25,7 @@ private: HTMLOptGroupElement(DOM::Document&, DOM::QualifiedName); virtual void initialize(JS::Realm&) override; - virtual void removed_from(Node*) override; + virtual void removed_from(Node* old_parent, Node& old_root) override; virtual void inserted() override; }; diff --git a/Libraries/LibWeb/HTML/HTMLOptionElement.cpp b/Libraries/LibWeb/HTML/HTMLOptionElement.cpp index 7bdd3b973aa..0b74da36390 100644 --- a/Libraries/LibWeb/HTML/HTMLOptionElement.cpp +++ b/Libraries/LibWeb/HTML/HTMLOptionElement.cpp @@ -232,9 +232,9 @@ void HTMLOptionElement::inserted() static_cast(*parent()->parent()).update_selectedness(); } -void HTMLOptionElement::removed_from(Node* old_parent) +void HTMLOptionElement::removed_from(Node* old_parent, Node& old_root) { - Base::removed_from(old_parent); + Base::removed_from(old_parent, old_root); // The option HTML element removing steps, given removedNode and oldParent, are: // 1. If oldParent is a select element, or oldParent is an optgroup element whose parent is a select element, diff --git a/Libraries/LibWeb/HTML/HTMLOptionElement.h b/Libraries/LibWeb/HTML/HTMLOptionElement.h index 31276174a04..08f42f706ea 100644 --- a/Libraries/LibWeb/HTML/HTMLOptionElement.h +++ b/Libraries/LibWeb/HTML/HTMLOptionElement.h @@ -51,7 +51,7 @@ private: virtual void attribute_changed(FlyString const& name, Optional const& old_value, Optional const& value, Optional const& namespace_) override; virtual void inserted() override; - virtual void removed_from(Node*) override; + virtual void removed_from(Node* old_parent, Node& old_root) override; virtual void children_changed() override; void ask_for_a_reset(); diff --git a/Libraries/LibWeb/HTML/HTMLProgressElement.cpp b/Libraries/LibWeb/HTML/HTMLProgressElement.cpp index 439d09b51cd..ab8e31c958a 100644 --- a/Libraries/LibWeb/HTML/HTMLProgressElement.cpp +++ b/Libraries/LibWeb/HTML/HTMLProgressElement.cpp @@ -95,8 +95,9 @@ void HTMLProgressElement::inserted() create_shadow_tree_if_needed(); } -void HTMLProgressElement::removed_from(DOM::Node*) +void HTMLProgressElement::removed_from(DOM::Node* old_parent, DOM::Node& old_root) { + Base::removed_from(old_parent, old_root); set_shadow_root(nullptr); } diff --git a/Libraries/LibWeb/HTML/HTMLProgressElement.h b/Libraries/LibWeb/HTML/HTMLProgressElement.h index 771e22b3e1d..bf51bdbd880 100644 --- a/Libraries/LibWeb/HTML/HTMLProgressElement.h +++ b/Libraries/LibWeb/HTML/HTMLProgressElement.h @@ -29,7 +29,7 @@ public: // ^HTMLElement virtual void inserted() override; - virtual void removed_from(DOM::Node*) override; + virtual void removed_from(DOM::Node* old_parent, DOM::Node& old_root) override; virtual void adjust_computed_style(CSS::ComputedProperties&) override; diff --git a/Libraries/LibWeb/HTML/HTMLSourceElement.cpp b/Libraries/LibWeb/HTML/HTMLSourceElement.cpp index 8d3d5f1712d..721091c0a75 100644 --- a/Libraries/LibWeb/HTML/HTMLSourceElement.cpp +++ b/Libraries/LibWeb/HTML/HTMLSourceElement.cpp @@ -47,10 +47,10 @@ void HTMLSourceElement::inserted() } // https://html.spec.whatwg.org/multipage/embedded-content.html#the-source-element:the-source-element-16 -void HTMLSourceElement::removed_from(DOM::Node* old_parent) +void HTMLSourceElement::removed_from(DOM::Node* old_parent, DOM::Node& old_root) { // The source HTML element removing steps, given removedNode and oldParent, are: - Base::removed_from(old_parent); + Base::removed_from(old_parent, old_root); // FIXME: 1. If removedNode's next sibling was an img element and oldParent is a picture element, then, count this as a // relevant mutation for the img element. diff --git a/Libraries/LibWeb/HTML/HTMLSourceElement.h b/Libraries/LibWeb/HTML/HTMLSourceElement.h index 5afd800bc1f..918f069ac25 100644 --- a/Libraries/LibWeb/HTML/HTMLSourceElement.h +++ b/Libraries/LibWeb/HTML/HTMLSourceElement.h @@ -23,7 +23,7 @@ private: virtual void initialize(JS::Realm&) override; virtual void inserted() override; - virtual void removed_from(DOM::Node*) override; + virtual void removed_from(DOM::Node* old_parent, DOM::Node& old_root) override; }; } diff --git a/Libraries/LibWeb/HTML/HTMLStyleElement.cpp b/Libraries/LibWeb/HTML/HTMLStyleElement.cpp index 2fcfd6a8f02..8bb9f3fd67e 100644 --- a/Libraries/LibWeb/HTML/HTMLStyleElement.cpp +++ b/Libraries/LibWeb/HTML/HTMLStyleElement.cpp @@ -44,10 +44,10 @@ void HTMLStyleElement::inserted() Base::inserted(); } -void HTMLStyleElement::removed_from(Node* old_parent) +void HTMLStyleElement::removed_from(Node* old_parent, Node& old_root) { m_style_element_utils.update_a_style_block(*this); - Base::removed_from(old_parent); + Base::removed_from(old_parent, old_root); } // https://html.spec.whatwg.org/multipage/semantics.html#dom-style-disabled diff --git a/Libraries/LibWeb/HTML/HTMLStyleElement.h b/Libraries/LibWeb/HTML/HTMLStyleElement.h index 3946f9f4e53..e5bb976e3b9 100644 --- a/Libraries/LibWeb/HTML/HTMLStyleElement.h +++ b/Libraries/LibWeb/HTML/HTMLStyleElement.h @@ -21,7 +21,7 @@ public: virtual void children_changed() override; virtual void inserted() override; - virtual void removed_from(Node*) override; + virtual void removed_from(Node* old_parent, Node& old_root) override; bool disabled(); void set_disabled(bool disabled); diff --git a/Libraries/LibWeb/SVG/SVGElement.cpp b/Libraries/LibWeb/SVG/SVGElement.cpp index 20c9ad57250..cae35e520a9 100644 --- a/Libraries/LibWeb/SVG/SVGElement.cpp +++ b/Libraries/LibWeb/SVG/SVGElement.cpp @@ -128,9 +128,9 @@ void SVGElement::update_use_elements_that_reference_this() }); } -void SVGElement::removed_from(Node* parent) +void SVGElement::removed_from(Node* old_parent, Node& old_root) { - Base::removed_from(parent); + Base::removed_from(old_parent, old_root); remove_from_use_element_that_reference_this(); } diff --git a/Libraries/LibWeb/SVG/SVGElement.h b/Libraries/LibWeb/SVG/SVGElement.h index 848ba011a7e..758969da1bc 100644 --- a/Libraries/LibWeb/SVG/SVGElement.h +++ b/Libraries/LibWeb/SVG/SVGElement.h @@ -38,7 +38,7 @@ protected: virtual WebIDL::ExceptionOr cloned(DOM::Node&, bool) const override; virtual void children_changed() override; virtual void inserted() override; - virtual void removed_from(Node*) override; + virtual void removed_from(Node* old_parent, Node& old_root) override; void update_use_elements_that_reference_this(); void remove_from_use_element_that_reference_this(); diff --git a/Libraries/LibWeb/SVG/SVGStyleElement.cpp b/Libraries/LibWeb/SVG/SVGStyleElement.cpp index e7d0dcacecb..21b7b76f04e 100644 --- a/Libraries/LibWeb/SVG/SVGStyleElement.cpp +++ b/Libraries/LibWeb/SVG/SVGStyleElement.cpp @@ -42,10 +42,10 @@ void SVGStyleElement::inserted() Base::inserted(); } -void SVGStyleElement::removed_from(Node* old_parent) +void SVGStyleElement::removed_from(Node* old_parent, Node& old_root) { m_style_element_utils.update_a_style_block(*this); - Base::removed_from(old_parent); + Base::removed_from(old_parent, old_root); } // https://www.w3.org/TR/cssom/#dom-linkstyle-sheet diff --git a/Libraries/LibWeb/SVG/SVGStyleElement.h b/Libraries/LibWeb/SVG/SVGStyleElement.h index 21e650dc464..c3043e89813 100644 --- a/Libraries/LibWeb/SVG/SVGStyleElement.h +++ b/Libraries/LibWeb/SVG/SVGStyleElement.h @@ -20,7 +20,7 @@ public: virtual void children_changed() override; virtual void inserted() override; - virtual void removed_from(Node*) override; + virtual void removed_from(Node* old_parent, Node& old_root) override; CSS::CSSStyleSheet* sheet(); CSS::CSSStyleSheet const* sheet() const;