diff --git a/Libraries/LibWeb/CMakeLists.txt b/Libraries/LibWeb/CMakeLists.txt index 63f59568a20..3a20c0aacbc 100644 --- a/Libraries/LibWeb/CMakeLists.txt +++ b/Libraries/LibWeb/CMakeLists.txt @@ -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 diff --git a/Libraries/LibWeb/Forward.h b/Libraries/LibWeb/Forward.h index 1ccbd504dc4..9791144e2ad 100644 --- a/Libraries/LibWeb/Forward.h +++ b/Libraries/LibWeb/Forward.h @@ -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; diff --git a/Libraries/LibWeb/SVG/SVGAnimatedNumberList.cpp b/Libraries/LibWeb/SVG/SVGAnimatedNumberList.cpp new file mode 100644 index 00000000000..19b246b56dd --- /dev/null +++ b/Libraries/LibWeb/SVG/SVGAnimatedNumberList.cpp @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2025, Jelle Raaijmakers + * + * SPDX-License-Identifier: BSD-2-Clause + */ + +#include +#include +#include + +namespace Web::SVG { + +GC_DEFINE_ALLOCATOR(SVGAnimatedNumberList); + +GC::Ref SVGAnimatedNumberList::create(JS::Realm& realm, GC::Ref base_val) +{ + return realm.create(realm, base_val); +} + +SVGAnimatedNumberList::SVGAnimatedNumberList(JS::Realm& realm, GC::Ref 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); +} + +} diff --git a/Libraries/LibWeb/SVG/SVGAnimatedNumberList.h b/Libraries/LibWeb/SVG/SVGAnimatedNumberList.h new file mode 100644 index 00000000000..37544ebd2ba --- /dev/null +++ b/Libraries/LibWeb/SVG/SVGAnimatedNumberList.h @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2025, Jelle Raaijmakers + * + * SPDX-License-Identifier: BSD-2-Clause + */ + +#pragma once + +#include +#include + +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 create(JS::Realm&, GC::Ref); + virtual ~SVGAnimatedNumberList() override = default; + + // https://www.w3.org/TR/SVG2/types.html#__svg__SVGAnimatedLengthList__baseVal + GC::Ref base_val() const { return m_base_val; } + + // https://www.w3.org/TR/SVG2/types.html#__svg__SVGAnimatedLengthList__animVal + GC::Ref anim_val() const { return m_base_val; } + +private: + SVGAnimatedNumberList(JS::Realm&, GC::Ref); + + virtual void initialize(JS::Realm&) override; + virtual void visit_edges(Visitor&) override; + + GC::Ref m_base_val; +}; + +} diff --git a/Libraries/LibWeb/SVG/SVGAnimatedNumberList.idl b/Libraries/LibWeb/SVG/SVGAnimatedNumberList.idl new file mode 100644 index 00000000000..34d82376c85 --- /dev/null +++ b/Libraries/LibWeb/SVG/SVGAnimatedNumberList.idl @@ -0,0 +1,8 @@ +#import + +// https://www.w3.org/TR/SVG2/types.html#InterfaceSVGAnimatedNumberList +[Exposed=Window] +interface SVGAnimatedNumberList { + [SameObject] readonly attribute SVGNumberList baseVal; + [SameObject] readonly attribute SVGNumberList animVal; +}; diff --git a/Libraries/LibWeb/idl_files.cmake b/Libraries/LibWeb/idl_files.cmake index 1c5164b1e3b..2ca208b3a24 100644 --- a/Libraries/LibWeb/idl_files.cmake +++ b/Libraries/LibWeb/idl_files.cmake @@ -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) diff --git a/Tests/LibWeb/Text/expected/all-window-properties.txt b/Tests/LibWeb/Text/expected/all-window-properties.txt index 61a91c8ac6a..088238d5e91 100644 --- a/Tests/LibWeb/Text/expected/all-window-properties.txt +++ b/Tests/LibWeb/Text/expected/all-window-properties.txt @@ -365,6 +365,7 @@ SVGAElement SVGAnimatedEnumeration SVGAnimatedLength SVGAnimatedNumber +SVGAnimatedNumberList SVGAnimatedRect SVGAnimatedString SVGAnimatedTransformList diff --git a/Tests/LibWeb/Text/expected/wpt-import/svg/idlharness.window.txt b/Tests/LibWeb/Text/expected/wpt-import/svg/idlharness.window.txt index ee0f6e7e8e2..dad09e4660a 100644 --- a/Tests/LibWeb/Text/expected/wpt-import/svg/idlharness.window.txt +++ b/Tests/LibWeb/Text/expected/wpt-import/svg/idlharness.window.txt @@ -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