mirror of
https://github.com/fergalmoran/ladybird.git
synced 2026-01-03 23:25:20 +00:00
LibWeb: Skip node trees outside of range in insertParagraph
Instead of recursively iterating all descendants of the common ancestor of the new line range that are not contained by that range, skip the entire node tree as soon as we determine they're not.
This commit is contained in:
committed by
Jelle Raaijmakers
parent
d48831e893
commit
d5143db081
@@ -639,8 +639,9 @@ bool command_insert_paragraph_action(DOM::Document& document, String const&)
|
||||
Vector<GC::Ref<DOM::Node>> contained_nodes;
|
||||
auto common_ancestor = new_line_range->common_ancestor_container();
|
||||
common_ancestor->for_each_in_subtree([&](GC::Ref<DOM::Node> child_node) {
|
||||
if (new_line_range->contains_node(child_node))
|
||||
contained_nodes.append(child_node);
|
||||
if (!new_line_range->contains_node(child_node))
|
||||
return TraversalDecision::SkipChildrenAndContinue;
|
||||
contained_nodes.append(child_node);
|
||||
return TraversalDecision::Continue;
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user