@@ -1106,31 +1106,6 @@ void delete_the_selection(Selection& selection, bool block_merging, bool strip_w
11061106 restore_states_and_values (document, overrides);
11071107}
11081108
1109- // https://w3c.github.io/editing/docs/execCommand/#editing-host-of
1110- GC::Ptr<DOM::Node> editing_host_of_node (GC::Ref<DOM::Node> node)
1111- {
1112- // node itself, if node is an editing host;
1113- if (node->is_editing_host ())
1114- return node;
1115-
1116- // or the nearest ancestor of node that is an editing host, if node is editable.
1117- if (node->is_editable ()) {
1118- GC::Ptr<DOM::Node> result;
1119- node->for_each_ancestor ([&result](GC::Ref<DOM::Node> ancestor) {
1120- if (ancestor->is_editing_host ()) {
1121- result = ancestor;
1122- return IterationDecision::Break;
1123- }
1124- return IterationDecision::Continue;
1125- });
1126- VERIFY (result);
1127- return result;
1128- }
1129-
1130- // The editing host of node is null if node is neither editable nor an editing host;
1131- return {};
1132- }
1133-
11341109// https://w3c.github.io/editing/docs/execCommand/#effective-command-value
11351110Optional<Utf16String> effective_command_value (GC::Ptr<DOM::Node> node, FlyString const & command)
11361111{
@@ -1308,7 +1283,7 @@ void fix_disallowed_ancestors_of_node(GC::Ref<DOM::Node> node)
13081283 }
13091284
13101285 // 2. If "p" is not an allowed child of the editing host of node, abort these steps.
1311- if (!is_allowed_child_of_node (HTML::TagNames::p, GC::Ref { *editing_host_of_node ( node) }))
1286+ if (!is_allowed_child_of_node (HTML::TagNames::p, GC::Ref { *node-> editing_host ( ) }))
13121287 return ;
13131288
13141289 // 3. If node is not a prohibited paragraph child, abort these steps.
@@ -2145,8 +2120,8 @@ bool is_in_same_editing_host(GC::Ref<DOM::Node> node_a, GC::Ref<DOM::Node> node_
21452120{
21462121 // Two nodes are in the same editing host if the editing host of the first is non-null and the
21472122 // same as the editing host of the second.
2148- auto editing_host_a = editing_host_of_node ( node_a);
2149- auto editing_host_b = editing_host_of_node ( node_b);
2123+ auto editing_host_a = node_a-> editing_host ( );
2124+ auto editing_host_b = node_b-> editing_host ( );
21502125 return editing_host_a && editing_host_a == editing_host_b;
21512126}
21522127
0 commit comments