mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-08 09:09:43 +00:00
LibWeb: Allow partial update of SVG subtrees in layout tree
We were incorrectly always appending to the nearest ancestor in the partial update case, even when the node was eligible for replacement.
This commit is contained in:
parent
026fc6c1ca
commit
7ae46bf8b7
Notes:
github-actions[bot]
2025-01-20 23:09:17 +00:00
Author: https://github.com/awesomekling
Commit: 7ae46bf8b7
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/3327
3 changed files with 31 additions and 5 deletions
|
@ -402,17 +402,20 @@ void TreeBuilder::update_layout_tree(DOM::Node& dom_node, TreeBuilder::Context&
|
|||
|
||||
if (dom_node.is_document()) {
|
||||
m_layout_root = layout_node;
|
||||
} else if (layout_node->is_svg_box()) {
|
||||
m_ancestor_stack.last()->append_child(*layout_node);
|
||||
} else if (should_create_layout_node) {
|
||||
// Decide whether to replace an existing node (partial tree update) or insert a new one appropriately.
|
||||
if (must_create_subtree == MustCreateSubtree::No
|
||||
bool const may_replace_existing_layout_node = must_create_subtree == MustCreateSubtree::No
|
||||
&& old_layout_node
|
||||
&& old_layout_node->parent()
|
||||
&& old_layout_node != layout_node) {
|
||||
&& old_layout_node != layout_node;
|
||||
if (may_replace_existing_layout_node) {
|
||||
old_layout_node->parent()->replace_child(*layout_node, *old_layout_node);
|
||||
} else {
|
||||
insert_node_into_inline_or_block_ancestor(*layout_node, display, AppendOrPrepend::Append);
|
||||
if (layout_node->is_svg_box()) {
|
||||
m_ancestor_stack.last()->append_child(*layout_node);
|
||||
} else {
|
||||
insert_node_into_inline_or_block_ancestor(*layout_node, display, AppendOrPrepend::Append);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue