mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 01:17:36 +00:00
LibWeb: Add support for range deletion.
This commit is contained in:
parent
bbcc5a9332
commit
43dc47a494
8 changed files with 107 additions and 6 deletions
|
@ -39,6 +39,24 @@ Position::~Position()
|
|||
{
|
||||
}
|
||||
|
||||
Range Range::normalized() const
|
||||
{
|
||||
if (!is_valid())
|
||||
return {};
|
||||
|
||||
if (m_start.node() == m_end.node()) {
|
||||
if (m_start.offset() <= m_end.offset())
|
||||
return *this;
|
||||
|
||||
return { m_end, m_start };
|
||||
}
|
||||
|
||||
if (m_start.node()->is_before(*m_end.node()))
|
||||
return *this;
|
||||
|
||||
return { m_end, m_start };
|
||||
}
|
||||
|
||||
const LogStream& operator<<(const LogStream& stream, const Position& position)
|
||||
{
|
||||
if (!position.node())
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue