mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-12-05 01:10:24 +00:00
LibWeb: Implement SVGLengthList
This commit is contained in:
committed by
Andreas Kling
parent
832e953c67
commit
797e6dd4eb
Notes:
github-actions[bot]
2025-11-20 22:16:40 +00:00
Author: https://github.com/gmta Commit: https://github.com/LadybirdBrowser/ladybird/commit/797e6dd4eba Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/6878
@@ -940,6 +940,7 @@ set(SOURCES
|
||||
SVG/SVGGraphicsElement.cpp
|
||||
SVG/SVGImageElement.cpp
|
||||
SVG/SVGLength.cpp
|
||||
SVG/SVGLengthList.cpp
|
||||
SVG/SVGLinearGradientElement.cpp
|
||||
SVG/SVGLineElement.cpp
|
||||
SVG/SVGList.cpp
|
||||
|
||||
@@ -1125,6 +1125,7 @@ class SVGGeometryElement;
|
||||
class SVGGraphicsElement;
|
||||
class SVGImageElement;
|
||||
class SVGLength;
|
||||
class SVGLengthList;
|
||||
class SVGLineElement;
|
||||
class SVGMaskElement;
|
||||
class SVGMetadataElement;
|
||||
@@ -1137,6 +1138,7 @@ class SVGRectElement;
|
||||
class SVGScriptElement;
|
||||
class SVGSVGElement;
|
||||
class SVGTitleElement;
|
||||
class SVGTransformList;
|
||||
class SVGViewElement;
|
||||
|
||||
}
|
||||
|
||||
49
Libraries/LibWeb/SVG/SVGLengthList.cpp
Normal file
49
Libraries/LibWeb/SVG/SVGLengthList.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/SVGLengthListPrototype.h>
|
||||
#include <LibWeb/SVG/SVGLengthList.h>
|
||||
|
||||
namespace Web::SVG {
|
||||
|
||||
GC_DEFINE_ALLOCATOR(SVGLengthList);
|
||||
|
||||
GC::Ref<SVGLengthList> SVGLengthList::create(JS::Realm& realm, Vector<GC::Ref<SVGLength>> items, ReadOnlyList read_only)
|
||||
{
|
||||
return realm.create<SVGLengthList>(realm, move(items), read_only);
|
||||
}
|
||||
|
||||
GC::Ref<SVGLengthList> SVGLengthList::create(JS::Realm& realm, ReadOnlyList read_only)
|
||||
{
|
||||
return realm.create<SVGLengthList>(realm, read_only);
|
||||
}
|
||||
|
||||
SVGLengthList::SVGLengthList(JS::Realm& realm, Vector<GC::Ref<SVGLength>> items, ReadOnlyList read_only)
|
||||
: Bindings::PlatformObject(realm)
|
||||
, SVGList(realm, move(items), read_only)
|
||||
{
|
||||
}
|
||||
|
||||
SVGLengthList::SVGLengthList(JS::Realm& realm, ReadOnlyList read_only)
|
||||
: Bindings::PlatformObject(realm)
|
||||
, SVGList(realm, read_only)
|
||||
{
|
||||
}
|
||||
|
||||
void SVGLengthList::initialize(JS::Realm& realm)
|
||||
{
|
||||
WEB_SET_PROTOTYPE_FOR_INTERFACE(SVGLengthList);
|
||||
Base::initialize(realm);
|
||||
}
|
||||
|
||||
void SVGLengthList::visit_edges(Visitor& visitor)
|
||||
{
|
||||
Base::visit_edges(visitor);
|
||||
SVGList::visit_edges(visitor);
|
||||
}
|
||||
|
||||
}
|
||||
34
Libraries/LibWeb/SVG/SVGLengthList.h
Normal file
34
Libraries/LibWeb/SVG/SVGLengthList.h
Normal file
@@ -0,0 +1,34 @@
|
||||
/*
|
||||
* Copyright (c) 2025, Jelle Raaijmakers <jelle@ladybird.org>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <LibWeb/SVG/SVGLength.h>
|
||||
#include <LibWeb/SVG/SVGList.h>
|
||||
|
||||
namespace Web::SVG {
|
||||
|
||||
// https://svgwg.org/svg2-draft/types.html#InterfaceSVGLengthList
|
||||
class SVGLengthList final
|
||||
: public Bindings::PlatformObject
|
||||
, public SVGList<GC::Ref<SVGLength>> {
|
||||
WEB_PLATFORM_OBJECT(SVGLengthList, Bindings::PlatformObject);
|
||||
GC_DECLARE_ALLOCATOR(SVGLengthList);
|
||||
|
||||
public:
|
||||
[[nodiscard]] static GC::Ref<SVGLengthList> create(JS::Realm& realm, Vector<GC::Ref<SVGLength>>, ReadOnlyList);
|
||||
[[nodiscard]] static GC::Ref<SVGLengthList> create(JS::Realm& realm, ReadOnlyList);
|
||||
virtual ~SVGLengthList() override = default;
|
||||
|
||||
private:
|
||||
SVGLengthList(JS::Realm&, Vector<GC::Ref<SVGLength>>, ReadOnlyList);
|
||||
SVGLengthList(JS::Realm&, ReadOnlyList);
|
||||
|
||||
virtual void initialize(JS::Realm&) override;
|
||||
virtual void visit_edges(Visitor&) override;
|
||||
};
|
||||
|
||||
}
|
||||
18
Libraries/LibWeb/SVG/SVGLengthList.idl
Normal file
18
Libraries/LibWeb/SVG/SVGLengthList.idl
Normal file
@@ -0,0 +1,18 @@
|
||||
#import <SVG/SVGLength.idl>
|
||||
|
||||
// https://svgwg.org/svg2-draft/types.html#InterfaceSVGLengthList
|
||||
[Exposed=Window]
|
||||
interface SVGLengthList {
|
||||
|
||||
readonly attribute unsigned long length;
|
||||
readonly attribute unsigned long numberOfItems;
|
||||
|
||||
undefined clear();
|
||||
SVGLength initialize(SVGLength newItem);
|
||||
getter SVGLength getItem(unsigned long index);
|
||||
SVGLength insertItemBefore(SVGLength newItem, unsigned long index);
|
||||
SVGLength replaceItem(SVGLength newItem, unsigned long index);
|
||||
SVGLength removeItem(unsigned long index);
|
||||
SVGLength appendItem(SVGLength newItem);
|
||||
setter undefined (unsigned long index, SVGLength newItem);
|
||||
};
|
||||
@@ -4,6 +4,7 @@
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#include <LibWeb/SVG/SVGLength.h>
|
||||
#include <LibWeb/SVG/SVGList.h>
|
||||
#include <LibWeb/SVG/SVGNumber.h>
|
||||
#include <LibWeb/SVG/SVGTransform.h>
|
||||
@@ -204,6 +205,7 @@ WebIDL::ExceptionOr<T> SVGList<T>::append_item(T new_item)
|
||||
return new_item;
|
||||
}
|
||||
|
||||
template class SVGList<GC::Ref<SVGLength>>;
|
||||
template class SVGList<GC::Ref<SVGNumber>>;
|
||||
template class SVGList<GC::Ref<SVGTransform>>;
|
||||
|
||||
|
||||
@@ -8,7 +8,6 @@
|
||||
#include <LibWeb/Bindings/Intrinsics.h>
|
||||
#include <LibWeb/Bindings/SVGTransformListPrototype.h>
|
||||
#include <LibWeb/SVG/SVGTransformList.h>
|
||||
#include <LibWeb/WebIDL/ExceptionOr.h>
|
||||
|
||||
namespace Web::SVG {
|
||||
|
||||
|
||||
@@ -407,6 +407,7 @@ libweb_js_bindings(SVG/SVGFEOffsetElement)
|
||||
libweb_js_bindings(SVG/SVGFilterElement)
|
||||
libweb_js_bindings(SVG/SVGForeignObjectElement)
|
||||
libweb_js_bindings(SVG/SVGLength)
|
||||
libweb_js_bindings(SVG/SVGLengthList)
|
||||
libweb_js_bindings(SVG/SVGLineElement)
|
||||
libweb_js_bindings(SVG/SVGLinearGradientElement)
|
||||
libweb_js_bindings(SVG/SVGMaskElement)
|
||||
|
||||
@@ -122,6 +122,7 @@ static bool is_platform_object(Type const& type)
|
||||
"ServiceWorkerContainer"sv,
|
||||
"ServiceWorkerRegistration"sv,
|
||||
"SVGAnimationElement"sv,
|
||||
"SVGLength"sv,
|
||||
"SVGNumber"sv,
|
||||
"SVGTransform"sv,
|
||||
"ShadowRoot"sv,
|
||||
|
||||
@@ -401,6 +401,7 @@ SVGGradientElement
|
||||
SVGGraphicsElement
|
||||
SVGImageElement
|
||||
SVGLength
|
||||
SVGLengthList
|
||||
SVGLineElement
|
||||
SVGLinearGradientElement
|
||||
SVGMaskElement
|
||||
|
||||
@@ -2,8 +2,8 @@ Harness status: OK
|
||||
|
||||
Found 1781 tests
|
||||
|
||||
1005 Pass
|
||||
776 Fail
|
||||
1020 Pass
|
||||
761 Fail
|
||||
Pass idl_test setup
|
||||
Pass idl_test validation
|
||||
Pass Partial interface Document: original interface defined
|
||||
@@ -219,21 +219,21 @@ Fail SVGNumberList interface: objects.text.rotate.baseVal must inherit property
|
||||
Fail SVGNumberList interface: calling removeItem(unsigned long) on objects.text.rotate.baseVal with too few arguments must throw TypeError
|
||||
Fail SVGNumberList interface: objects.text.rotate.baseVal must inherit property "appendItem(SVGNumber)" with the proper type
|
||||
Fail SVGNumberList interface: calling appendItem(SVGNumber) on objects.text.rotate.baseVal with too few arguments must throw TypeError
|
||||
Fail SVGLengthList interface: existence and properties of interface object
|
||||
Fail SVGLengthList interface object length
|
||||
Fail SVGLengthList interface object name
|
||||
Fail SVGLengthList interface: existence and properties of interface prototype object
|
||||
Fail SVGLengthList interface: existence and properties of interface prototype object's "constructor" property
|
||||
Fail SVGLengthList interface: existence and properties of interface prototype object's @@unscopables property
|
||||
Fail SVGLengthList interface: attribute length
|
||||
Fail SVGLengthList interface: attribute numberOfItems
|
||||
Fail SVGLengthList interface: operation clear()
|
||||
Fail SVGLengthList interface: operation initialize(SVGLength)
|
||||
Fail SVGLengthList interface: operation getItem(unsigned long)
|
||||
Fail SVGLengthList interface: operation insertItemBefore(SVGLength, unsigned long)
|
||||
Fail SVGLengthList interface: operation replaceItem(SVGLength, unsigned long)
|
||||
Fail SVGLengthList interface: operation removeItem(unsigned long)
|
||||
Fail SVGLengthList interface: operation appendItem(SVGLength)
|
||||
Pass SVGLengthList interface: existence and properties of interface object
|
||||
Pass SVGLengthList interface object length
|
||||
Pass SVGLengthList interface object name
|
||||
Pass SVGLengthList interface: existence and properties of interface prototype object
|
||||
Pass SVGLengthList interface: existence and properties of interface prototype object's "constructor" property
|
||||
Pass SVGLengthList interface: existence and properties of interface prototype object's @@unscopables property
|
||||
Pass SVGLengthList interface: attribute length
|
||||
Pass SVGLengthList interface: attribute numberOfItems
|
||||
Pass SVGLengthList interface: operation clear()
|
||||
Pass SVGLengthList interface: operation initialize(SVGLength)
|
||||
Pass SVGLengthList interface: operation getItem(unsigned long)
|
||||
Pass SVGLengthList interface: operation insertItemBefore(SVGLength, unsigned long)
|
||||
Pass SVGLengthList interface: operation replaceItem(SVGLength, unsigned long)
|
||||
Pass SVGLengthList interface: operation removeItem(unsigned long)
|
||||
Pass SVGLengthList interface: operation appendItem(SVGLength)
|
||||
Fail SVGStringList interface: existence and properties of interface object
|
||||
Fail SVGStringList interface object length
|
||||
Fail SVGStringList interface object name
|
||||
|
||||
Reference in New Issue
Block a user