LibWeb/SVG: Implement SVGTransformList.length

This commit is contained in:
Jamie Mansfield 2024-06-02 12:46:15 +01:00 committed by Andreas Kling
parent ad9457b725
commit 4a1d02e7d8
Notes: sideshowbarker 2024-07-17 03:03:15 +09:00
3 changed files with 10 additions and 1 deletions

View File

@ -23,6 +23,13 @@ SVGTransformList::~SVGTransformList() = default;
SVGTransformList::SVGTransformList(JS::Realm& realm)
: PlatformObject(realm) {};
// https://svgwg.org/svg2-draft/single-page.html#types-__svg__SVGNameList__length
WebIDL::UnsignedLong SVGTransformList::length()
{
// The length and numberOfItems IDL attributes represents the length of the list, and on getting simply return the length of the list.
return m_transforms.size();
}
// https://svgwg.org/svg2-draft/single-page.html#types-__svg__SVGNameList__getItem
WebIDL::ExceptionOr<JS::NonnullGCPtr<SVGTransform>> SVGTransformList::get_item(WebIDL::UnsignedLong index)
{

View File

@ -22,6 +22,8 @@ public:
[[nodiscard]] static JS::NonnullGCPtr<SVGTransformList> create(JS::Realm& realm);
virtual ~SVGTransformList() override;
WebIDL::UnsignedLong length();
WebIDL::ExceptionOr<JS::NonnullGCPtr<SVGTransform>> get_item(WebIDL::UnsignedLong index);
JS::NonnullGCPtr<SVGTransform> append_item(JS::NonnullGCPtr<SVGTransform> new_item);

View File

@ -3,7 +3,7 @@
// https://svgwg.org/svg2-draft/single-page.html#coords-InterfaceSVGTransformList
[Exposed=Window]
interface SVGTransformList {
[FIXME] readonly attribute unsigned long length;
readonly attribute unsigned long length;
[FIXME] readonly attribute unsigned long numberOfItems;
[FIXME] undefined clear();