LibWeb: Do not const qualify clone_element_tree_as_our_shadow_tree

We are mutating the shadow root of the element.
This commit is contained in:
Shannon Booth 2024-07-28 00:53:52 +12:00 committed by Andreas Kling
commit e11a7b668f
Notes: github-actions[bot] 2024-08-05 09:28:00 +00:00
2 changed files with 4 additions and 4 deletions

View file

@ -131,14 +131,14 @@ JS::GCPtr<DOM::Element> SVGUseElement::referenced_element()
}
// https://svgwg.org/svg2-draft/struct.html#UseShadowTree
void SVGUseElement::clone_element_tree_as_our_shadow_tree(Element* to_clone) const
void SVGUseElement::clone_element_tree_as_our_shadow_tree(Element* to_clone)
{
const_cast<DOM::ShadowRoot&>(*shadow_root()).remove_all_children();
shadow_root()->remove_all_children();
if (to_clone && is_valid_reference_element(*to_clone)) {
// The use element references another element, a copy of which is rendered in place of the use in the document.
auto cloned_reference_node = MUST(to_clone->clone_node(nullptr, true));
const_cast<DOM::ShadowRoot&>(*shadow_root()).append_child(cloned_reference_node).release_value_but_fixme_should_propagate_errors();
shadow_root()->append_child(cloned_reference_node).release_value_but_fixme_should_propagate_errors();
}
}

View file

@ -57,7 +57,7 @@ private:
JS::GCPtr<DOM::Element> referenced_element();
void clone_element_tree_as_our_shadow_tree(Element* to_clone) const;
void clone_element_tree_as_our_shadow_tree(Element* to_clone);
bool is_valid_reference_element(Element const& reference_element) const;
Optional<float> m_x;