mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-07 00:29:15 +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:
parent
d48831e893
commit
d5143db081
Notes:
github-actions[bot]
2024-12-10 13:55:47 +00:00
Author: https://github.com/gmta
Commit: d5143db081
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/2844
1 changed files with 3 additions and 2 deletions
|
@ -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;
|
||||
});
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue