mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-31 05:09:12 +00:00
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:
parent
cf7f07b822
commit
e11a7b668f
Notes:
github-actions[bot]
2024-08-05 09:28:00 +00:00
Author: https://github.com/shannonbooth
Commit: e11a7b668f
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/873
Reviewed-by: https://github.com/tcl3
2 changed files with 4 additions and 4 deletions
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue