1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 06:47:35 +00:00

LibWeb: Make Range.setStart and Range.setEnd spec compliant

These functions are way more involved than simply setting their
respective boundary points :^)
This commit is contained in:
Luke Wilde 2022-01-31 18:05:54 +00:00 committed by Andreas Kling
parent af3c866898
commit 46ce50f74e
6 changed files with 185 additions and 11 deletions

View file

@ -24,17 +24,8 @@ public:
// FIXME: There are a ton of methods missing here.
void set_start(Node& container, unsigned offset)
{
m_start_container = container;
m_start_offset = offset;
}
void set_end(Node& container, unsigned offset)
{
m_end_container = container;
m_end_offset = offset;
}
ExceptionOr<void> set_start(Node& node, u32 offset);
ExceptionOr<void> set_end(Node& node, u32 offset);
NonnullRefPtr<Range> inverted() const;
NonnullRefPtr<Range> normalized() const;
@ -46,6 +37,16 @@ private:
explicit Range(Document&);
Range(Node& start_container, u32 start_offset, Node& end_container, u32 end_offset);
Node& root();
Node const& root() const;
enum class StartOrEnd {
Start,
End,
};
ExceptionOr<void> set_start_or_end(Node& node, u32 offset, StartOrEnd start_or_end);
};
}