diff --git a/Libraries/LibWeb/SVG/SVGFilterPrimitiveStandardAttributes.h b/Libraries/LibWeb/SVG/SVGFilterPrimitiveStandardAttributes.h new file mode 100644 index 00000000000..9dd7f1f70d4 --- /dev/null +++ b/Libraries/LibWeb/SVG/SVGFilterPrimitiveStandardAttributes.h @@ -0,0 +1,59 @@ +/* + * Copyright (c) 2025, Lucien Fiorini + * + * SPDX-License-Identifier: BSD-2-Clause + */ + +#pragma once + +#include +#include + +namespace Web::SVG { + +template +class SVGFilterPrimitiveStandardAttributes { +public: + virtual ~SVGFilterPrimitiveStandardAttributes() = default; + + GC::Ref x() + { + return this_svg_element()->svg_animated_length_for_property(CSS::PropertyID::X); + } + + GC::Ref y() + { + return this_svg_element()->svg_animated_length_for_property(CSS::PropertyID::Y); + } + + GC::Ref width() + { + return this_svg_element()->svg_animated_length_for_property(CSS::PropertyID::Width); + } + + GC::Ref height() + { + return this_svg_element()->svg_animated_length_for_property(CSS::PropertyID::Height); + } + + GC::Ref result() + { + if (!m_result_animated_string) + m_result_animated_string = SVGAnimatedString::create(this_svg_element()->realm(), *this_svg_element(), AttributeNames::result); + + return *m_result_animated_string; + } + +protected: + void visit_edges(JS::Cell::Visitor& visitor) + { + visitor.visit(m_result_animated_string); + } + +private: + SVGElement* this_svg_element() { return static_cast(this); } + + GC::Ptr m_result_animated_string; +}; + +} diff --git a/Libraries/LibWeb/SVG/SVGFilterPrimitiveStandardAttributes.idl b/Libraries/LibWeb/SVG/SVGFilterPrimitiveStandardAttributes.idl new file mode 100644 index 00000000000..a8d2d93c200 --- /dev/null +++ b/Libraries/LibWeb/SVG/SVGFilterPrimitiveStandardAttributes.idl @@ -0,0 +1,11 @@ +#import +#import + +// https://www.w3.org/TR/filter-effects-1/#InterfaceSVGFilterPrimitiveStandardAttributes +interface mixin SVGFilterPrimitiveStandardAttributes { + [SameObject] readonly attribute SVGAnimatedLength x; + [SameObject] readonly attribute SVGAnimatedLength y; + [SameObject] readonly attribute SVGAnimatedLength width; + [SameObject] readonly attribute SVGAnimatedLength height; + [SameObject] readonly attribute SVGAnimatedString result; +};