mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 08:37:45 +00:00
LibWeb: Add convenient Selection::range() accessor
This is a lot smoother than calling the throwsy get_range_at() API, especially since we know there at most 1 range in the selection.
This commit is contained in:
parent
36866730ce
commit
3cabd17f9b
2 changed files with 8 additions and 0 deletions
|
@ -429,4 +429,9 @@ DeprecatedString Selection::to_deprecated_string() const
|
||||||
return m_range->to_deprecated_string();
|
return m_range->to_deprecated_string();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
JS::GCPtr<DOM::Range> Selection::range() const
|
||||||
|
{
|
||||||
|
return m_range;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -50,6 +50,9 @@ public:
|
||||||
|
|
||||||
DeprecatedString to_deprecated_string() const;
|
DeprecatedString to_deprecated_string() const;
|
||||||
|
|
||||||
|
// Non-standard convenience accessor for the selection's range.
|
||||||
|
JS::GCPtr<DOM::Range> range() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Selection(JS::NonnullGCPtr<JS::Realm>, JS::NonnullGCPtr<DOM::Document>);
|
Selection(JS::NonnullGCPtr<JS::Realm>, JS::NonnullGCPtr<DOM::Document>);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue