/* * Copyright (c) 2020, the SerenityOS developers. * Copyright (c) 2022, Luke Wilde * * SPDX-License-Identifier: BSD-2-Clause */ #pragma once #include namespace Web::DOM { class Range final : public AbstractRange { public: using WrapperType = Bindings::RangeWrapper; virtual ~Range() override; static NonnullRefPtr create(Document&); static NonnullRefPtr create(Window&); static NonnullRefPtr create(Node& start_container, u32 start_offset, Node& end_container, u32 end_offset); static NonnullRefPtr create_with_global_object(Bindings::WindowObject&); // 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; } NonnullRefPtr inverted() const; NonnullRefPtr normalized() const; NonnullRefPtr clone_range() const; NonnullRefPtr common_ancestor_container() const; private: explicit Range(Document&); Range(Node& start_container, u32 start_offset, Node& end_container, u32 end_offset); }; }