mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-04-26 01:35:08 +02:00
Previously, the LibWeb bindings generator would output multiple per interface files like Prototype/Constructor/Namespace/GlobalMixin depending on the contents of that IDL file. This complicates the build system as it means that it does not know what files will be generated without knowledge of the contents of that IDL file. Instead, for each IDL file only generate a single Bindings/<IDLFile>.h and Bindings/<IDLFile>.cpp.
70 lines
2.4 KiB
C++
70 lines
2.4 KiB
C++
/*
|
|
* Copyright (c) 2025, Pavel Shliak <shlyakpavel@gmail.com>
|
|
*
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
*/
|
|
|
|
#include <LibWeb/Bindings/SVGFEColorMatrixElement.h>
|
|
#include <LibWeb/SVG/SVGAnimatedEnumeration.h>
|
|
#include <LibWeb/SVG/SVGAnimatedString.h>
|
|
#include <LibWeb/SVG/SVGFEColorMatrixElement.h>
|
|
|
|
namespace Web::SVG {
|
|
|
|
GC_DEFINE_ALLOCATOR(SVGFEColorMatrixElement);
|
|
|
|
SVGFEColorMatrixElement::SVGFEColorMatrixElement(DOM::Document& document, DOM::QualifiedName qualified_name)
|
|
: SVGElement(document, qualified_name)
|
|
{
|
|
}
|
|
|
|
void SVGFEColorMatrixElement::initialize(JS::Realm& realm)
|
|
{
|
|
WEB_SET_PROTOTYPE_FOR_INTERFACE(SVGFEColorMatrixElement);
|
|
Base::initialize(realm);
|
|
}
|
|
|
|
void SVGFEColorMatrixElement::visit_edges(Cell::Visitor& visitor)
|
|
{
|
|
Base::visit_edges(visitor);
|
|
SVGFilterPrimitiveStandardAttributes::visit_edges(visitor);
|
|
visitor.visit(m_in1);
|
|
visitor.visit(m_values);
|
|
}
|
|
|
|
GC::Ref<SVGAnimatedString> SVGFEColorMatrixElement::in1()
|
|
{
|
|
if (!m_in1)
|
|
m_in1 = SVGAnimatedString::create(realm(), *this, DOM::QualifiedName { AttributeNames::in, OptionalNone {}, OptionalNone {} });
|
|
return *m_in1;
|
|
}
|
|
|
|
GC::Ref<SVGAnimatedEnumeration> SVGFEColorMatrixElement::type() const
|
|
{
|
|
// https://www.w3.org/TR/filter-effects-1/#InterfaceSVGFEColorMatrixElement
|
|
// Map the 'type' attribute to the IDL enumeration values.
|
|
// Defaults to MATRIX when omitted.
|
|
auto type_attribute = attribute(AttributeNames::type).value_or(String {});
|
|
|
|
u16 enum_value = SVGFEColorMatrixElement::SVG_FECOLORMATRIX_TYPE_UNKNOWN;
|
|
if (type_attribute.is_empty() || type_attribute.equals_ignoring_ascii_case("matrix"sv))
|
|
enum_value = SVGFEColorMatrixElement::SVG_FECOLORMATRIX_TYPE_MATRIX;
|
|
else if (type_attribute.equals_ignoring_ascii_case("saturate"sv))
|
|
enum_value = SVGFEColorMatrixElement::SVG_FECOLORMATRIX_TYPE_SATURATE;
|
|
else if (type_attribute.equals_ignoring_ascii_case("hueRotate"sv))
|
|
enum_value = SVGFEColorMatrixElement::SVG_FECOLORMATRIX_TYPE_HUEROTATE;
|
|
else if (type_attribute.equals_ignoring_ascii_case("luminanceToAlpha"sv))
|
|
enum_value = SVGFEColorMatrixElement::SVG_FECOLORMATRIX_TYPE_LUMINANCETOALPHA;
|
|
|
|
return SVGAnimatedEnumeration::create(realm(), enum_value);
|
|
}
|
|
|
|
GC::Ref<SVGAnimatedString> SVGFEColorMatrixElement::values()
|
|
{
|
|
if (!m_values)
|
|
m_values = SVGAnimatedString::create(realm(), *this, DOM::QualifiedName { AttributeNames::values, OptionalNone {}, OptionalNone {} });
|
|
return *m_values;
|
|
}
|
|
|
|
}
|