From 46ce50f74eb453178661a7e2a405b69b6fc51234 Mon Sep 17 00:00:00 2001 From: Luke Wilde Date: Mon, 31 Jan 2022 18:05:54 +0000 Subject: LibWeb: Make Range.setStart and Range.setEnd spec compliant These functions are way more involved than simply setting their respective boundary points :^) --- Userland/Libraries/LibWeb/DOM/Range.h | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) (limited to 'Userland/Libraries/LibWeb/DOM/Range.h') 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 set_start(Node& node, u32 offset); + ExceptionOr set_end(Node& node, u32 offset); NonnullRefPtr inverted() const; NonnullRefPtr 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 set_start_or_end(Node& node, u32 offset, StartOrEnd start_or_end); }; } -- cgit v1.2.3