LibWeb: Remove range-count filter from selection change handlers

The implementation of setBaseAndExtent will create a new range.
This commit is contained in:
Timothy Flynn 2024-08-27 10:22:35 -04:00 committed by Andreas Kling
parent fd289deb44
commit 96ad310643
Notes: github-actions[bot] 2024-08-31 13:52:19 +00:00
2 changed files with 4 additions and 10 deletions

View file

@ -2366,10 +2366,7 @@ void HTMLInputElement::selection_was_changed(size_t selection_start, size_t sele
{
document().set_cursor_position(DOM::Position::create(realm(), *m_text_node, selection_end));
auto selection = document().get_selection();
if (!selection || selection->range_count() == 0)
return;
if (auto selection = document().get_selection())
MUST(selection->set_base_and_extent(*m_text_node, selection_start, *m_text_node, selection_end));
}

View file

@ -464,10 +464,7 @@ void HTMLTextAreaElement::selection_was_changed(size_t selection_start, size_t s
{
document().set_cursor_position(DOM::Position::create(realm(), *m_text_node, selection_end));
auto selection = document().get_selection();
if (!selection || selection->range_count() == 0)
return;
if (auto selection = document().get_selection())
MUST(selection->set_base_and_extent(*m_text_node, selection_start, *m_text_node, selection_end));
}