/* * Copyright (c) 2026-present, the Ladybird developers. * * SPDX-License-Identifier: BSD-2-Clause */ #pragma once #include #include #include #include #include namespace Web::DOM { class CaretPosition final : public Bindings::PlatformObject { WEB_PLATFORM_OBJECT(CaretPosition, Bindings::PlatformObject); GC_DECLARE_ALLOCATOR(CaretPosition); public: [[nodiscard]] static GC::Ref create(JS::Realm&, GC::Ref offset_node, WebIDL::UnsignedLong offset, Optional client_rect); virtual ~CaretPosition() override; GC::Ref offset_node() const { return m_offset_node; } WebIDL::UnsignedLong offset() const { return m_offset; } GC::Ptr get_client_rect() const; private: CaretPosition(JS::Realm&, GC::Ref offset_node, WebIDL::UnsignedLong offset, Optional client_rect); virtual void initialize(JS::Realm&) override; virtual void visit_edges(Cell::Visitor&) override; GC::Ref m_offset_node; WebIDL::UnsignedLong m_offset { 0 }; Optional m_client_rect; }; }