LibWeb: Factor out some class template methods into implementation files

Reduces the rebuild required for changes to the .cpp parts (or their
includes)
This commit is contained in:
Callum Law 2025-10-24 13:53:02 +13:00 committed by Sam Atkins
parent 2a68087dfc
commit 64f438857b
Notes: github-actions[bot] 2025-10-27 14:52:38 +00:00
8 changed files with 425 additions and 303 deletions

View file

@ -0,0 +1,62 @@
/*
* Copyright (c) 2025, Lucien Fiorini <lucienfiorini@gmail.com>
* Copyright (c) 2025, Callum Law <callumlaw1709@outlook.com>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#include "SVGFilterPrimitiveStandardAttributes.h"
#include <LibWeb/SVG/SVGFEBlendElement.h>
#include <LibWeb/SVG/SVGFEColorMatrixElement.h>
#include <LibWeb/SVG/SVGFECompositeElement.h>
#include <LibWeb/SVG/SVGFEFloodElement.h>
#include <LibWeb/SVG/SVGFEGaussianBlurElement.h>
#include <LibWeb/SVG/SVGFEImageElement.h>
#include <LibWeb/SVG/SVGFEMergeElement.h>
#include <LibWeb/SVG/SVGFEOffsetElement.h>
namespace Web::SVG {
template<typename IncludingClass>
GC::Ref<SVGAnimatedLength> SVGFilterPrimitiveStandardAttributes<IncludingClass>::x()
{
return this_svg_element()->svg_animated_length_for_property(CSS::PropertyID::X);
}
template<typename IncludingClass>
GC::Ref<SVGAnimatedLength> SVGFilterPrimitiveStandardAttributes<IncludingClass>::y()
{
return this_svg_element()->svg_animated_length_for_property(CSS::PropertyID::Y);
}
template<typename IncludingClass>
GC::Ref<SVGAnimatedLength> SVGFilterPrimitiveStandardAttributes<IncludingClass>::width()
{
return this_svg_element()->svg_animated_length_for_property(CSS::PropertyID::Width);
}
template<typename IncludingClass>
GC::Ref<SVGAnimatedLength> SVGFilterPrimitiveStandardAttributes<IncludingClass>::height()
{
return this_svg_element()->svg_animated_length_for_property(CSS::PropertyID::Height);
}
template<typename IncludingClass>
GC::Ref<SVGAnimatedString> SVGFilterPrimitiveStandardAttributes<IncludingClass>::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;
}
template class SVGFilterPrimitiveStandardAttributes<SVGFEBlendElement>;
template class SVGFilterPrimitiveStandardAttributes<SVGFEColorMatrixElement>;
template class SVGFilterPrimitiveStandardAttributes<SVGFECompositeElement>;
template class SVGFilterPrimitiveStandardAttributes<SVGFEFloodElement>;
template class SVGFilterPrimitiveStandardAttributes<SVGFEGaussianBlurElement>;
template class SVGFilterPrimitiveStandardAttributes<SVGFEImageElement>;
template class SVGFilterPrimitiveStandardAttributes<SVGFEMergeElement>;
template class SVGFilterPrimitiveStandardAttributes<SVGFEOffsetElement>;
}

View file

@ -16,33 +16,11 @@ 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;
}
GC::Ref<SVGAnimatedLength> x();
GC::Ref<SVGAnimatedLength> y();
GC::Ref<SVGAnimatedLength> width();
GC::Ref<SVGAnimatedLength> height();
GC::Ref<SVGAnimatedString> result();
protected:
void visit_edges(JS::Cell::Visitor& visitor)