mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 19:27:45 +00:00
LibWeb: Make Range's boundary point comparison a public function
We'll need this in the Selection API implementation as well.
This commit is contained in:
parent
33c6559561
commit
317ab7a04b
2 changed files with 10 additions and 7 deletions
|
@ -78,14 +78,8 @@ Node const& Range::root() const
|
||||||
return m_start_container->root();
|
return m_start_container->root();
|
||||||
}
|
}
|
||||||
|
|
||||||
enum class RelativeBoundaryPointPosition {
|
|
||||||
Equal,
|
|
||||||
Before,
|
|
||||||
After,
|
|
||||||
};
|
|
||||||
|
|
||||||
// https://dom.spec.whatwg.org/#concept-range-bp-position
|
// https://dom.spec.whatwg.org/#concept-range-bp-position
|
||||||
static RelativeBoundaryPointPosition position_of_boundary_point_relative_to_other_boundary_point(Node const& node_a, u32 offset_a, Node const& node_b, u32 offset_b)
|
RelativeBoundaryPointPosition position_of_boundary_point_relative_to_other_boundary_point(Node const& node_a, u32 offset_a, Node const& node_b, u32 offset_b)
|
||||||
{
|
{
|
||||||
// 1. Assert: nodeA and nodeB have the same root.
|
// 1. Assert: nodeA and nodeB have the same root.
|
||||||
VERIFY(&node_a.root() == &node_b.root());
|
VERIFY(&node_a.root() == &node_b.root());
|
||||||
|
|
|
@ -12,6 +12,15 @@
|
||||||
|
|
||||||
namespace Web::DOM {
|
namespace Web::DOM {
|
||||||
|
|
||||||
|
enum class RelativeBoundaryPointPosition {
|
||||||
|
Equal,
|
||||||
|
Before,
|
||||||
|
After,
|
||||||
|
};
|
||||||
|
|
||||||
|
// https://dom.spec.whatwg.org/#concept-range-bp-position
|
||||||
|
RelativeBoundaryPointPosition position_of_boundary_point_relative_to_other_boundary_point(Node const& node_a, u32 offset_a, Node const& node_b, u32 offset_b);
|
||||||
|
|
||||||
class Range final : public AbstractRange {
|
class Range final : public AbstractRange {
|
||||||
WEB_PLATFORM_OBJECT(Range, AbstractRange);
|
WEB_PLATFORM_OBJECT(Range, AbstractRange);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue