Skip to content

Commit

Permalink
LibWeb/SVG: Implement SVGTransformList.length
Browse files Browse the repository at this point in the history
  • Loading branch information
jamierocks authored and awesomekling committed Jun 2, 2024
1 parent ad9457b commit 4a1d02e
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
7 changes: 7 additions & 0 deletions Userland/Libraries/LibWeb/SVG/SVGTransformList.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down
2 changes: 2 additions & 0 deletions Userland/Libraries/LibWeb/SVG/SVGTransformList.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ class SVGTransformList final : public Bindings::PlatformObject {
[[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);
Expand Down
2 changes: 1 addition & 1 deletion Userland/Libraries/LibWeb/SVG/SVGTransformList.idl
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down

0 comments on commit 4a1d02e

Please sign in to comment.