LibWeb: Implement SVGAnimatedLengthList

This commit is contained in:
Jelle Raaijmakers
2025-11-19 13:15:01 +01:00
committed by Andreas Kling
parent 797e6dd4eb
commit 527a293047
Notes: github-actions[bot] 2025-11-20 22:16:33 +00:00
8 changed files with 98 additions and 10 deletions

View File

@@ -901,6 +901,7 @@ set(SOURCES
SVG/SVGAElement.cpp
SVG/SVGAnimatedEnumeration.cpp
SVG/SVGAnimatedLength.cpp
SVG/SVGAnimatedLengthList.cpp
SVG/SVGAnimatedNumber.cpp
SVG/SVGAnimatedNumberList.cpp
SVG/SVGAnimatedRect.cpp

View File

@@ -1094,6 +1094,7 @@ namespace Web::SVG {
class Path;
class SVGAnimatedEnumeration;
class SVGAnimatedLength;
class SVGAnimatedLengthList;
class SVGAnimatedNumber;
class SVGAnimatedNumberList;
class SVGAnimatedRect;

View File

@@ -0,0 +1,38 @@
/*
* Copyright (c) 2025, Jelle Raaijmakers <jelle@ladybird.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#include <LibWeb/Bindings/Intrinsics.h>
#include <LibWeb/Bindings/SVGAnimatedLengthListPrototype.h>
#include <LibWeb/SVG/SVGAnimatedLengthList.h>
namespace Web::SVG {
GC_DEFINE_ALLOCATOR(SVGAnimatedLengthList);
GC::Ref<SVGAnimatedLengthList> SVGAnimatedLengthList::create(JS::Realm& realm, GC::Ref<SVGLengthList> base_val)
{
return realm.create<SVGAnimatedLengthList>(realm, base_val);
}
SVGAnimatedLengthList::SVGAnimatedLengthList(JS::Realm& realm, GC::Ref<SVGLengthList> base_val)
: PlatformObject(realm)
, m_base_val(base_val)
{
}
void SVGAnimatedLengthList::initialize(JS::Realm& realm)
{
WEB_SET_PROTOTYPE_FOR_INTERFACE(SVGAnimatedLengthList);
Base::initialize(realm);
}
void SVGAnimatedLengthList::visit_edges(Visitor& visitor)
{
Base::visit_edges(visitor);
visitor.visit(m_base_val);
}
}

View File

@@ -0,0 +1,38 @@
/*
* Copyright (c) 2025, Jelle Raaijmakers <jelle@ladybird.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#include <LibWeb/Bindings/PlatformObject.h>
#include <LibWeb/SVG/SVGLengthList.h>
namespace Web::SVG {
// https://svgwg.org/svg2-draft/types.html#InterfaceSVGAnimatedLengthList
class SVGAnimatedLengthList final : public Bindings::PlatformObject {
WEB_PLATFORM_OBJECT(SVGAnimatedLengthList, Bindings::PlatformObject);
GC_DECLARE_ALLOCATOR(SVGAnimatedLengthList);
public:
[[nodiscard]] static GC::Ref<SVGAnimatedLengthList> create(JS::Realm&, GC::Ref<SVGLengthList>);
virtual ~SVGAnimatedLengthList() override = default;
// https://svgwg.org/svg2-draft/types.html#__svg__SVGAnimatedLengthList__baseVal
GC::Ref<SVGLengthList> base_val() const { return m_base_val; }
// https://svgwg.org/svg2-draft/types.html#__svg__SVGAnimatedLengthList__animVal
GC::Ref<SVGLengthList> anim_val() const { return m_base_val; }
private:
SVGAnimatedLengthList(JS::Realm&, GC::Ref<SVGLengthList>);
virtual void initialize(JS::Realm&) override;
virtual void visit_edges(Visitor&) override;
GC::Ref<SVGLengthList> m_base_val;
};
}

View File

@@ -0,0 +1,8 @@
#import <SVG/SVGLengthList.idl>
// https://svgwg.org/svg2-draft/types.html#InterfaceSVGAnimatedLengthList
[Exposed=Window]
interface SVGAnimatedLengthList {
[SameObject] readonly attribute SVGLengthList baseVal;
[SameObject] readonly attribute SVGLengthList animVal;
};

View File

@@ -371,6 +371,7 @@ libweb_js_bindings(TrustedTypes/TrustedTypePolicyFactory)
libweb_js_bindings(SVG/SVGAElement)
libweb_js_bindings(SVG/SVGAnimatedEnumeration)
libweb_js_bindings(SVG/SVGAnimatedLength)
libweb_js_bindings(SVG/SVGAnimatedLengthList)
libweb_js_bindings(SVG/SVGAnimatedNumber)
libweb_js_bindings(SVG/SVGAnimatedNumberList)
libweb_js_bindings(SVG/SVGAnimatedRect)

View File

@@ -365,6 +365,7 @@ Response
SVGAElement
SVGAnimatedEnumeration
SVGAnimatedLength
SVGAnimatedLengthList
SVGAnimatedNumber
SVGAnimatedNumberList
SVGAnimatedRect

View File

@@ -2,8 +2,8 @@ Harness status: OK
Found 1781 tests
1020 Pass
761 Fail
1028 Pass
753 Fail
Pass idl_test setup
Pass idl_test validation
Pass Partial interface Document: original interface defined
@@ -374,14 +374,14 @@ Fail SVGAnimatedNumberList must be primary interface of objects.text.rotate
Fail Stringification of objects.text.rotate
Fail SVGAnimatedNumberList interface: objects.text.rotate must inherit property "baseVal" with the proper type
Fail SVGAnimatedNumberList interface: objects.text.rotate must inherit property "animVal" with the proper type
Fail SVGAnimatedLengthList interface: existence and properties of interface object
Fail SVGAnimatedLengthList interface object length
Fail SVGAnimatedLengthList interface object name
Fail SVGAnimatedLengthList interface: existence and properties of interface prototype object
Fail SVGAnimatedLengthList interface: existence and properties of interface prototype object's "constructor" property
Fail SVGAnimatedLengthList interface: existence and properties of interface prototype object's @@unscopables property
Fail SVGAnimatedLengthList interface: attribute baseVal
Fail SVGAnimatedLengthList interface: attribute animVal
Pass SVGAnimatedLengthList interface: existence and properties of interface object
Pass SVGAnimatedLengthList interface object length
Pass SVGAnimatedLengthList interface object name
Pass SVGAnimatedLengthList interface: existence and properties of interface prototype object
Pass SVGAnimatedLengthList interface: existence and properties of interface prototype object's "constructor" property
Pass SVGAnimatedLengthList interface: existence and properties of interface prototype object's @@unscopables property
Pass SVGAnimatedLengthList interface: attribute baseVal
Pass SVGAnimatedLengthList interface: attribute animVal
Fail SVGAnimatedLengthList must be primary interface of objects.text.x
Fail Stringification of objects.text.x
Fail SVGAnimatedLengthList interface: objects.text.x must inherit property "baseVal" with the proper type