LibWeb: Add SVGAnimatedNumberList

This commit is contained in:
Jelle Raaijmakers 2025-11-05 16:13:56 +01:00 committed by Jelle Raaijmakers
parent c5e7276c2f
commit c0630c700f
Notes: github-actions[bot] 2025-11-09 00:24:11 +00:00
8 changed files with 100 additions and 11 deletions

View file

@ -900,6 +900,7 @@ set(SOURCES
SVG/SVGAnimatedEnumeration.cpp
SVG/SVGAnimatedLength.cpp
SVG/SVGAnimatedNumber.cpp
SVG/SVGAnimatedNumberList.cpp
SVG/SVGAnimatedRect.cpp
SVG/SVGAnimatedString.cpp
SVG/SVGAnimatedTransformList.cpp

View file

@ -1092,8 +1092,10 @@ namespace Web::SVG {
class Path;
class SVGAnimatedEnumeration;
class SVGAnimatedLength;
class SVGAnimationElement;
class SVGAnimatedNumber;
class SVGAnimatedNumberList;
class SVGAnimatedRect;
class SVGAnimationElement;
class SVGCircleElement;
class SVGClipPathElement;
class SVGDecodedImageData;

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/SVGAnimatedNumberListPrototype.h>
#include <LibWeb/SVG/SVGAnimatedNumberList.h>
namespace Web::SVG {
GC_DEFINE_ALLOCATOR(SVGAnimatedNumberList);
GC::Ref<SVGAnimatedNumberList> SVGAnimatedNumberList::create(JS::Realm& realm, GC::Ref<SVGNumberList> base_val)
{
return realm.create<SVGAnimatedNumberList>(realm, base_val);
}
SVGAnimatedNumberList::SVGAnimatedNumberList(JS::Realm& realm, GC::Ref<SVGNumberList> base_val)
: PlatformObject(realm)
, m_base_val(base_val)
{
}
void SVGAnimatedNumberList::initialize(JS::Realm& realm)
{
WEB_SET_PROTOTYPE_FOR_INTERFACE(SVGAnimatedNumberList);
Base::initialize(realm);
}
void SVGAnimatedNumberList::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/SVGNumberList.h>
namespace Web::SVG {
// https://svgwg.org/svg2-draft/types.html#InterfaceSVGAnimatedNumber
class SVGAnimatedNumberList final : public Bindings::PlatformObject {
WEB_PLATFORM_OBJECT(SVGAnimatedNumberList, Bindings::PlatformObject);
GC_DECLARE_ALLOCATOR(SVGAnimatedNumberList);
public:
[[nodiscard]] static GC::Ref<SVGAnimatedNumberList> create(JS::Realm&, GC::Ref<SVGNumberList>);
virtual ~SVGAnimatedNumberList() override = default;
// https://www.w3.org/TR/SVG2/types.html#__svg__SVGAnimatedLengthList__baseVal
GC::Ref<SVGNumberList> base_val() const { return m_base_val; }
// https://www.w3.org/TR/SVG2/types.html#__svg__SVGAnimatedLengthList__animVal
GC::Ref<SVGNumberList> anim_val() const { return m_base_val; }
private:
SVGAnimatedNumberList(JS::Realm&, GC::Ref<SVGNumberList>);
virtual void initialize(JS::Realm&) override;
virtual void visit_edges(Visitor&) override;
GC::Ref<SVGNumberList> m_base_val;
};
}

View file

@ -0,0 +1,8 @@
#import <SVG/SVGNumberList.idl>
// https://www.w3.org/TR/SVG2/types.html#InterfaceSVGAnimatedNumberList
[Exposed=Window]
interface SVGAnimatedNumberList {
[SameObject] readonly attribute SVGNumberList baseVal;
[SameObject] readonly attribute SVGNumberList animVal;
};

View file

@ -372,6 +372,7 @@ libweb_js_bindings(SVG/SVGAElement)
libweb_js_bindings(SVG/SVGAnimatedEnumeration)
libweb_js_bindings(SVG/SVGAnimatedLength)
libweb_js_bindings(SVG/SVGAnimatedNumber)
libweb_js_bindings(SVG/SVGAnimatedNumberList)
libweb_js_bindings(SVG/SVGAnimatedRect)
libweb_js_bindings(SVG/SVGAnimatedString)
libweb_js_bindings(SVG/SVGAnimatedTransformList)

View file

@ -365,6 +365,7 @@ SVGAElement
SVGAnimatedEnumeration
SVGAnimatedLength
SVGAnimatedNumber
SVGAnimatedNumberList
SVGAnimatedRect
SVGAnimatedString
SVGAnimatedTransformList

View file

@ -2,8 +2,8 @@ Harness status: OK
Found 1781 tests
997 Pass
784 Fail
1005 Pass
776 Fail
Pass idl_test setup
Pass idl_test validation
Pass Partial interface Document: original interface defined
@ -362,14 +362,14 @@ Pass SVGAnimatedRect must be primary interface of objects.svg.viewBox
Pass Stringification of objects.svg.viewBox
Fail SVGAnimatedRect interface: objects.svg.viewBox must inherit property "baseVal" with the proper type
Fail SVGAnimatedRect interface: objects.svg.viewBox must inherit property "animVal" with the proper type
Fail SVGAnimatedNumberList interface: existence and properties of interface object
Fail SVGAnimatedNumberList interface object length
Fail SVGAnimatedNumberList interface object name
Fail SVGAnimatedNumberList interface: existence and properties of interface prototype object
Fail SVGAnimatedNumberList interface: existence and properties of interface prototype object's "constructor" property
Fail SVGAnimatedNumberList interface: existence and properties of interface prototype object's @@unscopables property
Fail SVGAnimatedNumberList interface: attribute baseVal
Fail SVGAnimatedNumberList interface: attribute animVal
Pass SVGAnimatedNumberList interface: existence and properties of interface object
Pass SVGAnimatedNumberList interface object length
Pass SVGAnimatedNumberList interface object name
Pass SVGAnimatedNumberList interface: existence and properties of interface prototype object
Pass SVGAnimatedNumberList interface: existence and properties of interface prototype object's "constructor" property
Pass SVGAnimatedNumberList interface: existence and properties of interface prototype object's @@unscopables property
Pass SVGAnimatedNumberList interface: attribute baseVal
Pass SVGAnimatedNumberList interface: attribute animVal
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