mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-01 05:39:11 +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,14 +485,10 @@ void Selection::set_range(GC::Ptr<DOM::Range> range)
|
|||
|
||||
GC::Ptr<DOM::Position> Selection::cursor_position() const
|
||||
{
|
||||
if (!m_range)
|
||||
if (!m_range || !is_collapsed())
|
||||
return nullptr;
|
||||
|
||||
if (is_collapsed()) {
|
||||
return DOM::Position::create(m_document->realm(), *m_range->start_container(), m_range->start_offset());
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
return DOM::Position::create(m_document->realm(), *m_range->start_container(), m_range->start_offset());
|
||||
}
|
||||
|
||||
void Selection::move_offset_to_next_character(bool collapse_selection)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue