summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibWeb/DOM/Range.h
diff options
context:
space:
mode:
authorLuke Wilde <lukew@serenityos.org>2022-01-31 18:05:54 +0000
committerAndreas Kling <kling@serenityos.org>2022-02-26 12:53:32 +0100
commit46ce50f74eb453178661a7e2a405b69b6fc51234 (patch)
tree184366edfe2306ed9842c72b74e7281db400f71a /Userland/Libraries/LibWeb/DOM/Range.h
parentaf3c8668987f9eec1403915231656d07ec816c2a (diff)
downloadserenity-46ce50f74eb453178661a7e2a405b69b6fc51234.zip
LibWeb: Make Range.setStart and Range.setEnd spec compliant
These functions are way more involved than simply setting their respective boundary points :^)
Diffstat (limited to 'Userland/Libraries/LibWeb/DOM/Range.h')
-rw-r--r--Userland/Libraries/LibWeb/DOM/Range.h23
1 files changed, 12 insertions, 11 deletions
diff --git a/Userland/Libraries/LibWeb/DOM/Range.h b/Userland/Libraries/LibWeb/DOM/Range.h
index 66c3c17091..06fed39b5d 100644
--- a/Userland/Libraries/LibWeb/DOM/Range.h
+++ b/Userland/Libraries/LibWeb/DOM/Range.h
@@ -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);
};
}