/* * Copyright (c) 2025, Jelle Raaijmakers * * SPDX-License-Identifier: BSD-2-Clause */ #pragma once #include #include #include #include namespace Web::SVG { // https://www.w3.org/TR/SVG2/types.html#ReadOnlyList enum class ReadOnlyList : u8 { Yes, No, }; // https://www.w3.org/TR/SVG2/types.html#TermListInterface template class SVGList { public: // https://www.w3.org/TR/SVG2/types.html#__svg__SVGNameList__length WebIDL::UnsignedLong length() const; WebIDL::UnsignedLong number_of_items() const { return length(); } WebIDL::ExceptionOr clear(); WebIDL::ExceptionOr initialize_(T); WebIDL::ExceptionOr get_item(WebIDL::UnsignedLong); WebIDL::ExceptionOr insert_item_before(T, WebIDL::UnsignedLong); WebIDL::ExceptionOr replace_item(T, WebIDL::UnsignedLong); WebIDL::ExceptionOr remove_item(WebIDL::UnsignedLong); WebIDL::ExceptionOr append_item(T); ReadonlySpan items() { return m_items; } protected: SVGList(JS::Realm&, Vector, ReadOnlyList); SVGList(JS::Realm&, ReadOnlyList); void visit_edges(GC::Cell::Visitor& visitor); ReadOnlyList read_only() const { return m_read_only; } private: GC::Ref m_realm; Vector m_items; // https://www.w3.org/TR/SVG2/types.html#ReadOnlyList ReadOnlyList m_read_only; }; }