mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-12-08 06:09:58 +00:00
LibWeb: Add SVGNumberList
This commit is contained in:
parent
9991205403
commit
c5e7276c2f
Notes:
github-actions[bot]
2025-11-09 00:24:17 +00:00
Author: https://github.com/gmta
Commit: c5e7276c2f
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/6709
9 changed files with 126 additions and 17 deletions
|
|
@ -936,6 +936,7 @@ set(SOURCES
|
||||||
SVG/SVGMaskElement.cpp
|
SVG/SVGMaskElement.cpp
|
||||||
SVG/SVGMetadataElement.cpp
|
SVG/SVGMetadataElement.cpp
|
||||||
SVG/SVGNumber.cpp
|
SVG/SVGNumber.cpp
|
||||||
|
SVG/SVGNumberList.cpp
|
||||||
SVG/SVGPathElement.cpp
|
SVG/SVGPathElement.cpp
|
||||||
SVG/SVGPolygonElement.cpp
|
SVG/SVGPolygonElement.cpp
|
||||||
SVG/SVGPolylineElement.cpp
|
SVG/SVGPolylineElement.cpp
|
||||||
|
|
|
||||||
|
|
@ -1118,6 +1118,7 @@ class SVGLineElement;
|
||||||
class SVGMaskElement;
|
class SVGMaskElement;
|
||||||
class SVGMetadataElement;
|
class SVGMetadataElement;
|
||||||
class SVGNumber;
|
class SVGNumber;
|
||||||
|
class SVGNumberList;
|
||||||
class SVGPathElement;
|
class SVGPathElement;
|
||||||
class SVGPolygonElement;
|
class SVGPolygonElement;
|
||||||
class SVGPolylineElement;
|
class SVGPolylineElement;
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <LibWeb/SVG/SVGList.h>
|
#include <LibWeb/SVG/SVGList.h>
|
||||||
|
#include <LibWeb/SVG/SVGNumber.h>
|
||||||
#include <LibWeb/SVG/SVGTransform.h>
|
#include <LibWeb/SVG/SVGTransform.h>
|
||||||
|
|
||||||
namespace Web::SVG {
|
namespace Web::SVG {
|
||||||
|
|
@ -203,6 +204,7 @@ WebIDL::ExceptionOr<T> SVGList<T>::append_item(T new_item)
|
||||||
return new_item;
|
return new_item;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template class SVGList<GC::Ref<SVGNumber>>;
|
||||||
template class SVGList<GC::Ref<SVGTransform>>;
|
template class SVGList<GC::Ref<SVGTransform>>;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
49
Libraries/LibWeb/SVG/SVGNumberList.cpp
Normal file
49
Libraries/LibWeb/SVG/SVGNumberList.cpp
Normal file
|
|
@ -0,0 +1,49 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2025, Jelle Raaijmakers <jelle@ladybird.org>
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: BSD-2-Clause
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <LibWeb/Bindings/Intrinsics.h>
|
||||||
|
#include <LibWeb/Bindings/SVGNumberListPrototype.h>
|
||||||
|
#include <LibWeb/SVG/SVGNumberList.h>
|
||||||
|
|
||||||
|
namespace Web::SVG {
|
||||||
|
|
||||||
|
GC_DEFINE_ALLOCATOR(SVGNumberList);
|
||||||
|
|
||||||
|
GC::Ref<SVGNumberList> SVGNumberList::create(JS::Realm& realm, Vector<GC::Ref<SVGNumber>> items, ReadOnlyList read_only)
|
||||||
|
{
|
||||||
|
return realm.create<SVGNumberList>(realm, move(items), read_only);
|
||||||
|
}
|
||||||
|
|
||||||
|
GC::Ref<SVGNumberList> SVGNumberList::create(JS::Realm& realm, ReadOnlyList read_only)
|
||||||
|
{
|
||||||
|
return realm.create<SVGNumberList>(realm, read_only);
|
||||||
|
}
|
||||||
|
|
||||||
|
SVGNumberList::SVGNumberList(JS::Realm& realm, Vector<GC::Ref<SVGNumber>> items, ReadOnlyList read_only)
|
||||||
|
: Bindings::PlatformObject(realm)
|
||||||
|
, SVGList(realm, move(items), read_only)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
SVGNumberList::SVGNumberList(JS::Realm& realm, ReadOnlyList read_only)
|
||||||
|
: Bindings::PlatformObject(realm)
|
||||||
|
, SVGList(realm, read_only)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void SVGNumberList::initialize(JS::Realm& realm)
|
||||||
|
{
|
||||||
|
WEB_SET_PROTOTYPE_FOR_INTERFACE(SVGNumberList);
|
||||||
|
Base::initialize(realm);
|
||||||
|
}
|
||||||
|
|
||||||
|
void SVGNumberList::visit_edges(Visitor& visitor)
|
||||||
|
{
|
||||||
|
Base::visit_edges(visitor);
|
||||||
|
SVGList::visit_edges(visitor);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
35
Libraries/LibWeb/SVG/SVGNumberList.h
Normal file
35
Libraries/LibWeb/SVG/SVGNumberList.h
Normal file
|
|
@ -0,0 +1,35 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2025, Jelle Raaijmakers <jelle@ladybird.org>
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: BSD-2-Clause
|
||||||
|
*/
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <LibWeb/Bindings/PlatformObject.h>
|
||||||
|
#include <LibWeb/SVG/SVGList.h>
|
||||||
|
#include <LibWeb/WebIDL/ExceptionOr.h>
|
||||||
|
|
||||||
|
namespace Web::SVG {
|
||||||
|
|
||||||
|
// https://www.w3.org/TR/SVG2/types.html#InterfaceSVGNumberList
|
||||||
|
class SVGNumberList final
|
||||||
|
: public Bindings::PlatformObject
|
||||||
|
, public SVGList<GC::Ref<SVGNumber>> {
|
||||||
|
WEB_PLATFORM_OBJECT(SVGNumberList, Bindings::PlatformObject);
|
||||||
|
GC_DECLARE_ALLOCATOR(SVGNumberList);
|
||||||
|
|
||||||
|
public:
|
||||||
|
[[nodiscard]] static GC::Ref<SVGNumberList> create(JS::Realm&, Vector<GC::Ref<SVGNumber>>, ReadOnlyList);
|
||||||
|
[[nodiscard]] static GC::Ref<SVGNumberList> create(JS::Realm&, ReadOnlyList);
|
||||||
|
virtual ~SVGNumberList() override = default;
|
||||||
|
|
||||||
|
private:
|
||||||
|
SVGNumberList(JS::Realm&, Vector<GC::Ref<SVGNumber>>, ReadOnlyList);
|
||||||
|
SVGNumberList(JS::Realm&, ReadOnlyList);
|
||||||
|
|
||||||
|
virtual void initialize(JS::Realm&) override;
|
||||||
|
virtual void visit_edges(Visitor&) override;
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
19
Libraries/LibWeb/SVG/SVGNumberList.idl
Normal file
19
Libraries/LibWeb/SVG/SVGNumberList.idl
Normal file
|
|
@ -0,0 +1,19 @@
|
||||||
|
#import <SVG/SVGNumber.idl>
|
||||||
|
|
||||||
|
// https://www.w3.org/TR/SVG2/types.html#InterfaceSVGNumberList
|
||||||
|
[Exposed=Window]
|
||||||
|
interface SVGNumberList {
|
||||||
|
|
||||||
|
readonly attribute unsigned long length;
|
||||||
|
readonly attribute unsigned long numberOfItems;
|
||||||
|
|
||||||
|
// AD-HOC: 'undefined' instead of 'void'
|
||||||
|
undefined clear();
|
||||||
|
SVGNumber initialize(SVGNumber newItem);
|
||||||
|
getter SVGNumber getItem(unsigned long index);
|
||||||
|
SVGNumber insertItemBefore(SVGNumber newItem, unsigned long index);
|
||||||
|
SVGNumber replaceItem(SVGNumber newItem, unsigned long index);
|
||||||
|
SVGNumber removeItem(unsigned long index);
|
||||||
|
SVGNumber appendItem(SVGNumber newItem);
|
||||||
|
setter void (unsigned long index, SVGNumber newItem);
|
||||||
|
};
|
||||||
|
|
@ -404,6 +404,7 @@ libweb_js_bindings(SVG/SVGLinearGradientElement)
|
||||||
libweb_js_bindings(SVG/SVGMaskElement)
|
libweb_js_bindings(SVG/SVGMaskElement)
|
||||||
libweb_js_bindings(SVG/SVGMetadataElement)
|
libweb_js_bindings(SVG/SVGMetadataElement)
|
||||||
libweb_js_bindings(SVG/SVGNumber)
|
libweb_js_bindings(SVG/SVGNumber)
|
||||||
|
libweb_js_bindings(SVG/SVGNumberList)
|
||||||
libweb_js_bindings(SVG/SVGPathElement)
|
libweb_js_bindings(SVG/SVGPathElement)
|
||||||
libweb_js_bindings(SVG/SVGPolygonElement)
|
libweb_js_bindings(SVG/SVGPolygonElement)
|
||||||
libweb_js_bindings(SVG/SVGPolylineElement)
|
libweb_js_bindings(SVG/SVGPolylineElement)
|
||||||
|
|
|
||||||
|
|
@ -398,6 +398,7 @@ SVGMaskElement
|
||||||
SVGMatrix
|
SVGMatrix
|
||||||
SVGMetadataElement
|
SVGMetadataElement
|
||||||
SVGNumber
|
SVGNumber
|
||||||
|
SVGNumberList
|
||||||
SVGPathElement
|
SVGPathElement
|
||||||
SVGPoint
|
SVGPoint
|
||||||
SVGPolygonElement
|
SVGPolygonElement
|
||||||
|
|
|
||||||
|
|
@ -2,8 +2,8 @@ Harness status: OK
|
||||||
|
|
||||||
Found 1781 tests
|
Found 1781 tests
|
||||||
|
|
||||||
982 Pass
|
997 Pass
|
||||||
799 Fail
|
784 Fail
|
||||||
Pass idl_test setup
|
Pass idl_test setup
|
||||||
Pass idl_test validation
|
Pass idl_test validation
|
||||||
Pass Partial interface Document: original interface defined
|
Pass Partial interface Document: original interface defined
|
||||||
|
|
@ -187,21 +187,21 @@ Fail SVGAngle interface: objects.svg.createSVGAngle() must inherit property "new
|
||||||
Fail SVGAngle interface: calling newValueSpecifiedUnits(unsigned short, float) on objects.svg.createSVGAngle() with too few arguments must throw TypeError
|
Fail SVGAngle interface: calling newValueSpecifiedUnits(unsigned short, float) on objects.svg.createSVGAngle() with too few arguments must throw TypeError
|
||||||
Fail SVGAngle interface: objects.svg.createSVGAngle() must inherit property "convertToSpecifiedUnits(unsigned short)" with the proper type
|
Fail SVGAngle interface: objects.svg.createSVGAngle() must inherit property "convertToSpecifiedUnits(unsigned short)" with the proper type
|
||||||
Fail SVGAngle interface: calling convertToSpecifiedUnits(unsigned short) on objects.svg.createSVGAngle() with too few arguments must throw TypeError
|
Fail SVGAngle interface: calling convertToSpecifiedUnits(unsigned short) on objects.svg.createSVGAngle() with too few arguments must throw TypeError
|
||||||
Fail SVGNumberList interface: existence and properties of interface object
|
Pass SVGNumberList interface: existence and properties of interface object
|
||||||
Fail SVGNumberList interface object length
|
Pass SVGNumberList interface object length
|
||||||
Fail SVGNumberList interface object name
|
Pass SVGNumberList interface object name
|
||||||
Fail SVGNumberList interface: existence and properties of interface prototype object
|
Pass SVGNumberList interface: existence and properties of interface prototype object
|
||||||
Fail SVGNumberList interface: existence and properties of interface prototype object's "constructor" property
|
Pass SVGNumberList interface: existence and properties of interface prototype object's "constructor" property
|
||||||
Fail SVGNumberList interface: existence and properties of interface prototype object's @@unscopables property
|
Pass SVGNumberList interface: existence and properties of interface prototype object's @@unscopables property
|
||||||
Fail SVGNumberList interface: attribute length
|
Pass SVGNumberList interface: attribute length
|
||||||
Fail SVGNumberList interface: attribute numberOfItems
|
Pass SVGNumberList interface: attribute numberOfItems
|
||||||
Fail SVGNumberList interface: operation clear()
|
Pass SVGNumberList interface: operation clear()
|
||||||
Fail SVGNumberList interface: operation initialize(SVGNumber)
|
Pass SVGNumberList interface: operation initialize(SVGNumber)
|
||||||
Fail SVGNumberList interface: operation getItem(unsigned long)
|
Pass SVGNumberList interface: operation getItem(unsigned long)
|
||||||
Fail SVGNumberList interface: operation insertItemBefore(SVGNumber, unsigned long)
|
Pass SVGNumberList interface: operation insertItemBefore(SVGNumber, unsigned long)
|
||||||
Fail SVGNumberList interface: operation replaceItem(SVGNumber, unsigned long)
|
Pass SVGNumberList interface: operation replaceItem(SVGNumber, unsigned long)
|
||||||
Fail SVGNumberList interface: operation removeItem(unsigned long)
|
Pass SVGNumberList interface: operation removeItem(unsigned long)
|
||||||
Fail SVGNumberList interface: operation appendItem(SVGNumber)
|
Pass SVGNumberList interface: operation appendItem(SVGNumber)
|
||||||
Fail SVGNumberList must be primary interface of objects.text.rotate.baseVal
|
Fail SVGNumberList must be primary interface of objects.text.rotate.baseVal
|
||||||
Fail Stringification of objects.text.rotate.baseVal
|
Fail Stringification of objects.text.rotate.baseVal
|
||||||
Fail SVGNumberList interface: objects.text.rotate.baseVal must inherit property "length" with the proper type
|
Fail SVGNumberList interface: objects.text.rotate.baseVal must inherit property "length" with the proper type
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue