mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-08 09:09:43 +00:00
LibWeb: Remove range-count filter from selection change handlers
The implementation of setBaseAndExtent will create a new range.
This commit is contained in:
parent
fd289deb44
commit
96ad310643
Notes:
github-actions[bot]
2024-08-31 13:52:19 +00:00
Author: https://github.com/trflynn89
Commit: 96ad310643
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/1205
2 changed files with 4 additions and 10 deletions
|
@ -2366,11 +2366,8 @@ 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));
|
document().set_cursor_position(DOM::Position::create(realm(), *m_text_node, selection_end));
|
||||||
|
|
||||||
auto selection = document().get_selection();
|
if (auto selection = document().get_selection())
|
||||||
if (!selection || selection->range_count() == 0)
|
MUST(selection->set_base_and_extent(*m_text_node, selection_start, *m_text_node, selection_end));
|
||||||
return;
|
|
||||||
|
|
||||||
MUST(selection->set_base_and_extent(*m_text_node, selection_start, *m_text_node, selection_end));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -464,11 +464,8 @@ 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));
|
document().set_cursor_position(DOM::Position::create(realm(), *m_text_node, selection_end));
|
||||||
|
|
||||||
auto selection = document().get_selection();
|
if (auto selection = document().get_selection())
|
||||||
if (!selection || selection->range_count() == 0)
|
MUST(selection->set_base_and_extent(*m_text_node, selection_start, *m_text_node, selection_end));
|
||||||
return;
|
|
||||||
|
|
||||||
MUST(selection->set_base_and_extent(*m_text_node, selection_start, *m_text_node, selection_end));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue