mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-02 15:46:33 +00:00
LibWeb/SVG: Add FilterPrimitiveStandardAttributes
This commit is contained in:
parent
6fb75b5ba9
commit
de271b16fc
Notes:
github-actions[bot]
2025-07-09 17:08:49 +00:00
Author: https://github.com/ananas-dev
Commit: de271b16fc
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/5028
Reviewed-by: https://github.com/gmta ✅
2 changed files with 70 additions and 0 deletions
59
Libraries/LibWeb/SVG/SVGFilterPrimitiveStandardAttributes.h
Normal file
59
Libraries/LibWeb/SVG/SVGFilterPrimitiveStandardAttributes.h
Normal file
|
@ -0,0 +1,59 @@
|
|||
/*
|
||||
* Copyright (c) 2025, Lucien Fiorini <lucienfiorini@gmail.com>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <LibWeb/SVG/AttributeNames.h>
|
||||
#include <LibWeb/SVG/SVGElement.h>
|
||||
|
||||
namespace Web::SVG {
|
||||
|
||||
template<typename IncludingClass>
|
||||
class SVGFilterPrimitiveStandardAttributes {
|
||||
public:
|
||||
virtual ~SVGFilterPrimitiveStandardAttributes() = default;
|
||||
|
||||
GC::Ref<SVGAnimatedLength> x()
|
||||
{
|
||||
return this_svg_element()->svg_animated_length_for_property(CSS::PropertyID::X);
|
||||
}
|
||||
|
||||
GC::Ref<SVGAnimatedLength> y()
|
||||
{
|
||||
return this_svg_element()->svg_animated_length_for_property(CSS::PropertyID::Y);
|
||||
}
|
||||
|
||||
GC::Ref<SVGAnimatedLength> width()
|
||||
{
|
||||
return this_svg_element()->svg_animated_length_for_property(CSS::PropertyID::Width);
|
||||
}
|
||||
|
||||
GC::Ref<SVGAnimatedLength> height()
|
||||
{
|
||||
return this_svg_element()->svg_animated_length_for_property(CSS::PropertyID::Height);
|
||||
}
|
||||
|
||||
GC::Ref<SVGAnimatedString> 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<IncludingClass*>(this); }
|
||||
|
||||
GC::Ptr<SVGAnimatedString> m_result_animated_string;
|
||||
};
|
||||
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
#import <SVG/SVGAnimatedLength.idl>
|
||||
#import <SVG/SVGAnimatedString.idl>
|
||||
|
||||
// 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;
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue