mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-10 10:09:14 +00:00
LibWeb: Simplify Selection::cursor_position()
No functional changes.
This commit is contained in:
parent
2d6da6e112
commit
cea9012b5b
Notes:
github-actions[bot]
2025-06-13 13:10:18 +00:00
Author: https://github.com/gmta
Commit: cea9012b5b
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/5067
Reviewed-by: https://github.com/tcl3
Reviewed-by: https://github.com/trflynn89
1 changed files with 2 additions and 6 deletions
|
@ -485,16 +485,12 @@ void Selection::set_range(GC::Ptr<DOM::Range> range)
|
||||||
|
|
||||||
GC::Ptr<DOM::Position> Selection::cursor_position() const
|
GC::Ptr<DOM::Position> Selection::cursor_position() const
|
||||||
{
|
{
|
||||||
if (!m_range)
|
if (!m_range || !is_collapsed())
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
||||||
if (is_collapsed()) {
|
|
||||||
return DOM::Position::create(m_document->realm(), *m_range->start_container(), m_range->start_offset());
|
return DOM::Position::create(m_document->realm(), *m_range->start_container(), m_range->start_offset());
|
||||||
}
|
}
|
||||||
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
void Selection::move_offset_to_next_character(bool collapse_selection)
|
void Selection::move_offset_to_next_character(bool collapse_selection)
|
||||||
{
|
{
|
||||||
auto anchor_node = this->anchor_node();
|
auto anchor_node = this->anchor_node();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue