LibWeb: Add SVGFEFunc{A,B,G,R}Element

This commit is contained in:
Jelle Raaijmakers 2025-11-05 17:05:26 +01:00 committed by Jelle Raaijmakers
parent db321cb74f
commit 70e98e72a8
Notes: github-actions[bot] 2025-11-09 00:23:49 +00:00
18 changed files with 268 additions and 0 deletions

View file

@ -918,6 +918,10 @@ set(SOURCES
SVG/SVGFEComponentTransferElement.cpp
SVG/SVGFECompositeElement.cpp
SVG/SVGFEFloodElement.cpp
SVG/SVGFEFuncAElement.cpp
SVG/SVGFEFuncBElement.cpp
SVG/SVGFEFuncGElement.cpp
SVG/SVGFEFuncRElement.cpp
SVG/SVGFEGaussianBlurElement.cpp
SVG/SVGFEImageElement.cpp
SVG/SVGFEMergeElement.cpp

View file

@ -98,6 +98,10 @@
#include <LibWeb/SVG/SVGFEComponentTransferElement.h>
#include <LibWeb/SVG/SVGFECompositeElement.h>
#include <LibWeb/SVG/SVGFEFloodElement.h>
#include <LibWeb/SVG/SVGFEFuncAElement.h>
#include <LibWeb/SVG/SVGFEFuncBElement.h>
#include <LibWeb/SVG/SVGFEFuncGElement.h>
#include <LibWeb/SVG/SVGFEFuncRElement.h>
#include <LibWeb/SVG/SVGFEGaussianBlurElement.h>
#include <LibWeb/SVG/SVGFEImageElement.h>
#include <LibWeb/SVG/SVGFEMergeElement.h>
@ -484,6 +488,14 @@ static GC::Ref<SVG::SVGElement> create_svg_element(JS::Realm& realm, Document& d
return realm.create<SVG::SVGFECompositeElement>(document, move(qualified_name));
if (local_name == SVG::TagNames::feFlood)
return realm.create<SVG::SVGFEFloodElement>(document, move(qualified_name));
if (local_name == SVG::TagNames::feFuncA)
return realm.create<SVG::SVGFEFuncAElement>(document, move(qualified_name));
if (local_name == SVG::TagNames::feFuncB)
return realm.create<SVG::SVGFEFuncBElement>(document, move(qualified_name));
if (local_name == SVG::TagNames::feFuncG)
return realm.create<SVG::SVGFEFuncGElement>(document, move(qualified_name));
if (local_name == SVG::TagNames::feFuncR)
return realm.create<SVG::SVGFEFuncRElement>(document, move(qualified_name));
if (local_name == SVG::TagNames::feGaussianBlur)
return realm.create<SVG::SVGFEGaussianBlurElement>(document, move(qualified_name));
if (local_name == SVG::TagNames::feImage)

View file

@ -1109,6 +1109,10 @@ class SVGFEColorMatrixElement;
class SVGFEComponentTransferElement;
class SVGFECompositeElement;
class SVGFEFloodElement;
class SVGFEFuncAElement;
class SVGFEFuncBElement;
class SVGFEFuncGElement;
class SVGFEFuncRElement;
class SVGFEGaussianBlurElement;
class SVGFEImageElement;
class SVGFilterElement;

View file

@ -0,0 +1,25 @@
/*
* Copyright (c) 2025, Jelle Raaijmakers <jelle@ladybird.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#include <LibWeb/Bindings/SVGFEFuncAElementPrototype.h>
#include <LibWeb/SVG/SVGFEFuncAElement.h>
namespace Web::SVG {
GC_DEFINE_ALLOCATOR(SVGFEFuncAElement);
SVGFEFuncAElement::SVGFEFuncAElement(DOM::Document& document, DOM::QualifiedName qualified_name)
: SVGComponentTransferFunctionElement(document, qualified_name)
{
}
void SVGFEFuncAElement::initialize(JS::Realm& realm)
{
WEB_SET_PROTOTYPE_FOR_INTERFACE(SVGFEFuncAElement);
Base::initialize(realm);
}
}

View file

@ -0,0 +1,28 @@
/*
* Copyright (c) 2025, Jelle Raaijmakers <jelle@ladybird.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#include <LibWeb/SVG/SVGComponentTransferFunctionElement.h>
#include <LibWeb/WebIDL/ExceptionOr.h>
namespace Web::SVG {
// https://www.w3.org/TR/filter-effects-1/#InterfaceSVGFEFuncAElement
class SVGFEFuncAElement final : public SVGComponentTransferFunctionElement {
WEB_PLATFORM_OBJECT(SVGFEFuncAElement, SVGComponentTransferFunctionElement);
GC_DECLARE_ALLOCATOR(SVGFEFuncAElement);
public:
virtual ~SVGFEFuncAElement() override = default;
private:
SVGFEFuncAElement(DOM::Document&, DOM::QualifiedName);
virtual void initialize(JS::Realm&) override;
};
}

View file

@ -0,0 +1,6 @@
#import <SVG/SVGComponentTransferFunctionElement.idl>
// https://www.w3.org/TR/filter-effects-1/#InterfaceSVGFEFuncAElement
[Exposed=Window]
interface SVGFEFuncAElement : SVGComponentTransferFunctionElement {
};

View file

@ -0,0 +1,25 @@
/*
* Copyright (c) 2025, Jelle Raaijmakers <jelle@ladybird.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#include <LibWeb/Bindings/SVGFEFuncBElementPrototype.h>
#include <LibWeb/SVG/SVGFEFuncBElement.h>
namespace Web::SVG {
GC_DEFINE_ALLOCATOR(SVGFEFuncBElement);
SVGFEFuncBElement::SVGFEFuncBElement(DOM::Document& document, DOM::QualifiedName qualified_name)
: SVGComponentTransferFunctionElement(document, qualified_name)
{
}
void SVGFEFuncBElement::initialize(JS::Realm& realm)
{
WEB_SET_PROTOTYPE_FOR_INTERFACE(SVGFEFuncBElement);
Base::initialize(realm);
}
}

View file

@ -0,0 +1,28 @@
/*
* Copyright (c) 2025, Jelle Raaijmakers <jelle@ladybird.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#include <LibWeb/SVG/SVGComponentTransferFunctionElement.h>
#include <LibWeb/WebIDL/ExceptionOr.h>
namespace Web::SVG {
// https://www.w3.org/TR/filter-effects-1/#InterfaceSVGFEFuncBElement
class SVGFEFuncBElement final : public SVGComponentTransferFunctionElement {
WEB_PLATFORM_OBJECT(SVGFEFuncBElement, SVGComponentTransferFunctionElement);
GC_DECLARE_ALLOCATOR(SVGFEFuncBElement);
public:
virtual ~SVGFEFuncBElement() override = default;
private:
SVGFEFuncBElement(DOM::Document&, DOM::QualifiedName);
virtual void initialize(JS::Realm&) override;
};
}

View file

@ -0,0 +1,6 @@
#import <SVG/SVGComponentTransferFunctionElement.idl>
// https://www.w3.org/TR/filter-effects-1/#InterfaceSVGFEFuncBElement
[Exposed=Window]
interface SVGFEFuncBElement : SVGComponentTransferFunctionElement {
};

View file

@ -0,0 +1,25 @@
/*
* Copyright (c) 2025, Jelle Raaijmakers <jelle@ladybird.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#include <LibWeb/Bindings/SVGFEFuncGElementPrototype.h>
#include <LibWeb/SVG/SVGFEFuncGElement.h>
namespace Web::SVG {
GC_DEFINE_ALLOCATOR(SVGFEFuncGElement);
SVGFEFuncGElement::SVGFEFuncGElement(DOM::Document& document, DOM::QualifiedName qualified_name)
: SVGComponentTransferFunctionElement(document, qualified_name)
{
}
void SVGFEFuncGElement::initialize(JS::Realm& realm)
{
WEB_SET_PROTOTYPE_FOR_INTERFACE(SVGFEFuncGElement);
Base::initialize(realm);
}
}

View file

@ -0,0 +1,28 @@
/*
* Copyright (c) 2025, Jelle Raaijmakers <jelle@ladybird.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#include <LibWeb/SVG/SVGComponentTransferFunctionElement.h>
#include <LibWeb/WebIDL/ExceptionOr.h>
namespace Web::SVG {
// https://www.w3.org/TR/filter-effects-1/#InterfaceSVGFEFuncGElement
class SVGFEFuncGElement final : public SVGComponentTransferFunctionElement {
WEB_PLATFORM_OBJECT(SVGFEFuncGElement, SVGComponentTransferFunctionElement);
GC_DECLARE_ALLOCATOR(SVGFEFuncGElement);
public:
virtual ~SVGFEFuncGElement() override = default;
private:
SVGFEFuncGElement(DOM::Document&, DOM::QualifiedName);
virtual void initialize(JS::Realm&) override;
};
}

View file

@ -0,0 +1,6 @@
#import <SVG/SVGComponentTransferFunctionElement.idl>
// https://www.w3.org/TR/filter-effects-1/#InterfaceSVGFEFuncGElement
[Exposed=Window]
interface SVGFEFuncGElement : SVGComponentTransferFunctionElement {
};

View file

@ -0,0 +1,25 @@
/*
* Copyright (c) 2025, Jelle Raaijmakers <jelle@ladybird.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#include <LibWeb/Bindings/SVGFEFuncRElementPrototype.h>
#include <LibWeb/SVG/SVGFEFuncRElement.h>
namespace Web::SVG {
GC_DEFINE_ALLOCATOR(SVGFEFuncRElement);
SVGFEFuncRElement::SVGFEFuncRElement(DOM::Document& document, DOM::QualifiedName qualified_name)
: SVGComponentTransferFunctionElement(document, qualified_name)
{
}
void SVGFEFuncRElement::initialize(JS::Realm& realm)
{
WEB_SET_PROTOTYPE_FOR_INTERFACE(SVGFEFuncRElement);
Base::initialize(realm);
}
}

View file

@ -0,0 +1,28 @@
/*
* Copyright (c) 2025, Jelle Raaijmakers <jelle@ladybird.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#include <LibWeb/SVG/SVGComponentTransferFunctionElement.h>
#include <LibWeb/WebIDL/ExceptionOr.h>
namespace Web::SVG {
// https://www.w3.org/TR/filter-effects-1/#InterfaceSVGFEFuncRElement
class SVGFEFuncRElement final : public SVGComponentTransferFunctionElement {
WEB_PLATFORM_OBJECT(SVGFEFuncRElement, SVGComponentTransferFunctionElement);
GC_DECLARE_ALLOCATOR(SVGFEFuncRElement);
public:
virtual ~SVGFEFuncRElement() override = default;
private:
SVGFEFuncRElement(DOM::Document&, DOM::QualifiedName);
virtual void initialize(JS::Realm&) override;
};
}

View file

@ -0,0 +1,6 @@
#import <SVG/SVGComponentTransferFunctionElement.idl>
// https://www.w3.org/TR/filter-effects-1/#InterfaceSVGFEFuncRElement
[Exposed=Window]
interface SVGFEFuncRElement : SVGComponentTransferFunctionElement {
};

View file

@ -22,6 +22,10 @@ namespace Web::SVG::TagNames {
__ENUMERATE_SVG_TAG(feComponentTransfer) \
__ENUMERATE_SVG_TAG(feComposite) \
__ENUMERATE_SVG_TAG(feFlood) \
__ENUMERATE_SVG_TAG(feFuncA) \
__ENUMERATE_SVG_TAG(feFuncB) \
__ENUMERATE_SVG_TAG(feFuncG) \
__ENUMERATE_SVG_TAG(feFuncR) \
__ENUMERATE_SVG_TAG(feGaussianBlur) \
__ENUMERATE_SVG_TAG(feImage) \
__ENUMERATE_SVG_TAG(feMerge) \

View file

@ -394,6 +394,10 @@ libweb_js_bindings(SVG/SVGFEColorMatrixElement)
libweb_js_bindings(SVG/SVGFEComponentTransferElement)
libweb_js_bindings(SVG/SVGFECompositeElement)
libweb_js_bindings(SVG/SVGFEFloodElement)
libweb_js_bindings(SVG/SVGFEFuncAElement)
libweb_js_bindings(SVG/SVGFEFuncBElement)
libweb_js_bindings(SVG/SVGFEFuncGElement)
libweb_js_bindings(SVG/SVGFEFuncRElement)
libweb_js_bindings(SVG/SVGFEGaussianBlurElement)
libweb_js_bindings(SVG/SVGFEImageElement)
libweb_js_bindings(SVG/SVGFEMergeElement)

View file

@ -382,6 +382,10 @@ SVGFEColorMatrixElement
SVGFEComponentTransferElement
SVGFECompositeElement
SVGFEFloodElement
SVGFEFuncAElement
SVGFEFuncBElement
SVGFEFuncGElement
SVGFEFuncRElement
SVGFEGaussianBlurElement
SVGFEImageElement
SVGFEMergeElement