diff --git a/Userland/Libraries/LibWeb/DOM/Document.cpp b/Userland/Libraries/LibWeb/DOM/Document.cpp index 2320a1ef2b1d..6eb875b2a4c6 100644 --- a/Userland/Libraries/LibWeb/DOM/Document.cpp +++ b/Userland/Libraries/LibWeb/DOM/Document.cpp @@ -5137,10 +5137,8 @@ Vector> Document::find_matching_text(String const& query, for (; i < text_block.positions.size() - 1 && match_index.value() > text_block.positions[i + 1].start_offset; ++i) match_start_position = &text_block.positions[i + 1]; - auto range = create_range(); auto start_position = match_index.value() - match_start_position->start_offset; auto& start_dom_node = match_start_position->dom_node; - (void)range->set_start(start_dom_node, start_position); auto* match_end_position = match_start_position; for (; i < text_block.positions.size() - 1 && (match_index.value() + query.bytes_as_string_view().length() > text_block.positions[i + 1].start_offset); ++i) @@ -5148,9 +5146,8 @@ Vector> Document::find_matching_text(String const& query, auto& end_dom_node = match_end_position->dom_node; auto end_position = match_index.value() + query.bytes_as_string_view().length() - match_end_position->start_offset; - (void)range->set_end(end_dom_node, end_position); - matches.append(range); + matches.append(Range::create(start_dom_node, start_position, end_dom_node, end_position)); match_start_position = match_end_position; offset = match_index.value() + query.bytes_as_string_view().length() + 1; if (offset >= text.bytes_as_string_view().length())