Luce packages
LuceLuce BaseLuciaOS

dymokomi/luce-browser-engine

Source of release 0.6.0

0.6.0 / src / web / svg / svgfe_composite_element.lucb

#==============================================================================================
#
#   svgfe_composite_element - SVG::SVGFECompositeElement
#
#   DESCRIPTION:
#       Port of LibWeb/SVG/SVGFECompositeElement.cpp (lines 1-133) with the inline members of SVGFECompositeElement.h.
#       (https://drafts.fxtf.org/filter-effects/#feCompositeElement): in, in2, k1-k4 and the
#       compositing operator.
#
#==============================================================================================

## Ported from Libraries/LibWeb/SVG/SVGFECompositeElement.cpp:15 Web::SVG::SVGFECompositeElement::SVGFECompositeElement.
pub func svg_svgfe_composite_element_construct(this: SvgSvgfeCompositeElement*, document: DomDocument*, qualified_name: DomQualifiedName):
    svg_element_construct(this.svg_element(), document, qualified_name)
    # The vptrs of the mixin bases move to SVGFECompositeElement's tables.
    let element = this.svg_element()
    element.element.slottable_mixin.vtable = &svg_svgfe_composite_element_slottable_mixin_vtable
    element.element.aria_mixin.vtable = &svg_svgfe_composite_element_aria_mixin_vtable
    element.element.animatable.vtable = &svg_svgfe_composite_element_animatable_vtable
    element.global_event_handlers.vtable = &svg_svgfe_composite_element_global_event_handlers_vtable

## Ported from Libraries/LibWeb/SVG/SVGFECompositeElement.cpp:20 Web::SVG::SVGFECompositeElement::initialize (override).
pub func svg_svgfe_composite_element_initialize_impl(base: JsCell*, realm: Realm*):
    web_set_prototype_for_interface(base, realm, BindInterfaceName.svgfe_composite_element)
    svg_element_initialize_impl(base, realm)

## Ported from Libraries/LibWeb/SVG/SVGFECompositeElement.cpp:26 Web::SVG::SVGFECompositeElement::visit_edges (override).
pub func svg_svgfe_composite_element_visit_edges_impl(base: gc.Cell*, visitor: gc.CellVisitor*):
    let this = (SvgSvgfeCompositeElement*)base
    svg_element_visit_edges_impl(base, visitor)
    svg_filter_primitive_standard_attributes_visit_edges(&this.svg_filter_primitive_standard_attributes, visitor)
    gc.cell_visitor_visit_t(visitor, this.m_in1)
    gc.cell_visitor_visit_t(visitor, this.m_in2)
    gc.cell_visitor_visit_t(visitor, this.m_k1)
    gc.cell_visitor_visit_t(visitor, this.m_k2)
    gc.cell_visitor_visit_t(visitor, this.m_k3)
    gc.cell_visitor_visit_t(visitor, this.m_k4)

## Ported from Libraries/LibWeb/SVG/SVGFECompositeElement.cpp:38 Web::SVG::string_to_compositing_operator.
func svg_string_to_compositing_operator(string: ak.StringView) -> SvgSvgfeCompositeElementCompositingOperator:
    if ak.string_view_equals(&string, "over"):
        return SvgSvgfeCompositeElementCompositingOperator.over
    if ak.string_view_equals(&string, "in"):
        return SvgSvgfeCompositeElementCompositingOperator.in_
    if ak.string_view_equals(&string, "out"):
        return SvgSvgfeCompositeElementCompositingOperator.out
    if ak.string_view_equals(&string, "atop"):
        return SvgSvgfeCompositeElementCompositingOperator.atop
    if ak.string_view_equals(&string, "xor"):
        return SvgSvgfeCompositeElementCompositingOperator.xor
    if ak.string_view_equals(&string, "arithmetic"):
        return SvgSvgfeCompositeElementCompositingOperator.arithmetic
    return SvgSvgfeCompositeElementCompositingOperator.unknown

## attribute_changed's `parse_compositing_operator` lambda.
func svg_parse_compositing_operator(value: ak.String?) -> SvgSvgfeCompositeElementCompositingOperator?:
    let string = value else return none
    return svg_string_to_compositing_operator(ak.string_bytes_as_string_view(&string))

## Ported from Libraries/LibWeb/SVG/SVGFECompositeElement.cpp:55 Web::SVG::SVGFECompositeElement::attribute_changed (override).
pub func svg_svgfe_composite_element_attribute_changed_impl(base: DomElement*, name: ak.FlyString, old_value: ak.String?, new_value: ak.String?, namespace_: ak.FlyString?):
    let this = (SvgSvgfeCompositeElement*)base
    svg_element_attribute_changed_impl(base, name, old_value, new_value, namespace_)

    if ak.fly_string_eq_fly_string(&name, &svg_attribute_names_operator):
        this.m_operator = svg_parse_compositing_operator(new_value)

## Ported from Libraries/LibWeb/SVG/SVGFECompositeElement.cpp:70 Web::SVG::SVGFECompositeElement::in1.
pub func svg_svgfe_composite_element_in1(this: SvgSvgfeCompositeElement*) -> SvgAnimatedString*:
    if this.m_in1 == none:
        this.m_in1 = svg_animated_string_for_attribute(this.svg_element(), svg_attribute_names_in)

    return this.m_in1 else trap("VERIFY: m_in1")

## Ported from Libraries/LibWeb/SVG/SVGFECompositeElement.cpp:78 Web::SVG::SVGFECompositeElement::in2.
pub func svg_svgfe_composite_element_in2(this: SvgSvgfeCompositeElement*) -> SvgAnimatedString*:
    if this.m_in2 == none:
        this.m_in2 = svg_animated_string_for_attribute(this.svg_element(), svg_attribute_names_in2)

    return this.m_in2 else trap("VERIFY: m_in2")

## Ported from Libraries/LibWeb/SVG/SVGFECompositeElement.cpp:87 Web::SVG::SVGFECompositeElement::k1.
# https://drafts.fxtf.org/filter-effects/#element-attrdef-fecomposite-k1
pub func svg_svgfe_composite_element_k1(this: SvgSvgfeCompositeElement*) -> SvgAnimatedNumber*:
    if this.m_k1 == none:
        this.m_k1 = svg_animated_number_for_attribute(this.svg_element(), svg_attribute_names_k1, 0.0)

    return this.m_k1 else trap("VERIFY: m_k1")

## Ported from Libraries/LibWeb/SVG/SVGFECompositeElement.cpp:96 Web::SVG::SVGFECompositeElement::k2.
# https://drafts.fxtf.org/filter-effects/#element-attrdef-fecomposite-k2
pub func svg_svgfe_composite_element_k2(this: SvgSvgfeCompositeElement*) -> SvgAnimatedNumber*:
    if this.m_k2 == none:
        this.m_k2 = svg_animated_number_for_attribute(this.svg_element(), svg_attribute_names_k2, 0.0)

    return this.m_k2 else trap("VERIFY: m_k2")

## Ported from Libraries/LibWeb/SVG/SVGFECompositeElement.cpp:105 Web::SVG::SVGFECompositeElement::k3.
# https://drafts.fxtf.org/filter-effects/#element-attrdef-fecomposite-k3
pub func svg_svgfe_composite_element_k3(this: SvgSvgfeCompositeElement*) -> SvgAnimatedNumber*:
    if this.m_k3 == none:
        this.m_k3 = svg_animated_number_for_attribute(this.svg_element(), svg_attribute_names_k3, 0.0)

    return this.m_k3 else trap("VERIFY: m_k3")

## Ported from Libraries/LibWeb/SVG/SVGFECompositeElement.cpp:114 Web::SVG::SVGFECompositeElement::k4.
# https://drafts.fxtf.org/filter-effects/#element-attrdef-fecomposite-k4
pub func svg_svgfe_composite_element_k4(this: SvgSvgfeCompositeElement*) -> SvgAnimatedNumber*:
    if this.m_k4 == none:
        this.m_k4 = svg_animated_number_for_attribute(this.svg_element(), svg_attribute_names_k4, 0.0)

    return this.m_k4 else trap("VERIFY: m_k4")

## Ported from Libraries/LibWeb/SVG/SVGFECompositeElement.cpp:122 Web::SVG::SVGFECompositeElement::operator_.
pub func svg_svgfe_composite_element_to(this: SvgSvgfeCompositeElement*) -> SvgSvgfeCompositeElementCompositingOperator:
    return this.m_operator else SvgSvgfeCompositeElementCompositingOperator.over

## Ported from Libraries/LibWeb/SVG/SVGFECompositeElement.cpp:128 Web::SVG::SVGFECompositeElement::operator_for_bindings.
# https://drafts.fxtf.org/filter-effects/#element-attrdef-fecomposite-operator
pub func svg_svgfe_composite_element_to_for_bindings(this: SvgSvgfeCompositeElement*) -> SvgAnimatedEnumeration*:
    return svg_animated_enumeration_create(dom_element_realm(this.dom_element()), (u16)(this.m_operator else SvgSvgfeCompositeElementCompositingOperator.over))