mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-29 20:29:18 +00:00
LibWeb: Make normalize_sublists_in_node() take a Node instead of Element
This prevents some unnecessary casting to DOM::Element.
This commit is contained in:
parent
d08febcf67
commit
83f48a07d4
Notes:
github-actions[bot]
2025-01-10 22:39:00 +00:00
Author: https://github.com/gmta
Commit: 83f48a07d4
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/3216
3 changed files with 7 additions and 7 deletions
|
@ -153,16 +153,16 @@ bool command_delete_action(DOM::Document& document, String const&)
|
|||
if (offset == 0 && node->index() == 0
|
||||
&& node_element.local_name().is_one_of(HTML::TagNames::li, HTML::TagNames::dt, HTML::TagNames::dd)) {
|
||||
// 1. Let items be a list of all lis that are ancestors of node.
|
||||
Vector<GC::Ref<DOM::Element>> items;
|
||||
Vector<GC::Ref<DOM::Node>> items;
|
||||
node->for_each_ancestor([&items](GC::Ref<DOM::Node> ancestor) {
|
||||
if (is<HTML::HTMLLIElement>(*ancestor))
|
||||
items.append(static_cast<DOM::Element&>(*ancestor));
|
||||
items.append(ancestor);
|
||||
return IterationDecision::Continue;
|
||||
});
|
||||
|
||||
// 2. Normalize sublists of each item in items.
|
||||
for (auto item : items)
|
||||
normalize_sublists_in_node(*item);
|
||||
normalize_sublists_in_node(item);
|
||||
|
||||
// 3. Record the values of the one-node list consisting of node, and let values be the
|
||||
// result.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue