Luce packages
LuceLuce BaseLuciaOS

dymokomi/luce-browser-engine

Source of release 0.6.1

0.6.1 / src / web / svg / svgfe_blend_element.lucb

#==============================================================================================
#
#   svgfe_blend_element - SVG::SVGFEBlendElement
#
#   DESCRIPTION:
#       Port of LibWeb/SVG/SVGFEBlendElement.cpp (lines 1-82) with the inline members of SVGFEBlendElement.h.
#       (https://drafts.fxtf.org/filter-effects/#feBlendElement): in, in2 and the blend mode
#       (a mix-blend-mode keyword).
#
#==============================================================================================

## Ported from Libraries/LibWeb/SVG/SVGFEBlendElement.cpp:19 Web::SVG::SVGFEBlendElement::SVGFEBlendElement.
pub func svg_svgfe_blend_element_construct(this: SvgSvgfeBlendElement*, document: DomDocument*, qualified_name: DomQualifiedName):
    svg_element_construct(this.svg_element(), document, qualified_name)
    # The vptrs of the mixin bases move to SVGFEBlendElement's tables.
    let element = this.svg_element()
    element.element.slottable_mixin.vtable = &svg_svgfe_blend_element_slottable_mixin_vtable
    element.element.aria_mixin.vtable = &svg_svgfe_blend_element_aria_mixin_vtable
    element.element.animatable.vtable = &svg_svgfe_blend_element_animatable_vtable
    element.global_event_handlers.vtable = &svg_svgfe_blend_element_global_event_handlers_vtable

## Ported from Libraries/LibWeb/SVG/SVGFEBlendElement.cpp:24 Web::SVG::SVGFEBlendElement::initialize (override).
pub func svg_svgfe_blend_element_initialize_impl(base: JsCell*, realm: Realm*):
    web_set_prototype_for_interface(base, realm, BindInterfaceName.svgfe_blend_element)
    svg_element_initialize_impl(base, realm)

## Ported from Libraries/LibWeb/SVG/SVGFEBlendElement.cpp:30 Web::SVG::SVGFEBlendElement::visit_edges (override).
pub func svg_svgfe_blend_element_visit_edges_impl(base: gc.Cell*, visitor: gc.CellVisitor*):
    let this = (SvgSvgfeBlendElement*)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)

## attribute_changed's `parse_mix_blend_mode` lambda: a mix-blend-mode keyword, or none.
func svg_parse_mix_blend_mode(value: ak.String?) -> css_data.MixBlendMode?:
    let string = value else return none
    let keyword = css_data.keyword_from_string(ak.string_bytes_as_string_view(&string)) else return none
    return css_data.keyword_to_mix_blend_mode(keyword)

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

    if ak.fly_string_eq_fly_string(&name, &svg_attribute_names_mode):
        this.m_mode = svg_parse_mix_blend_mode(new_value)

## Ported from Libraries/LibWeb/SVG/SVGFEBlendElement.cpp:56 Web::SVG::SVGFEBlendElement::in1.
pub func svg_svgfe_blend_element_in1(this: SvgSvgfeBlendElement*) -> 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/SVGFEBlendElement.cpp:64 Web::SVG::SVGFEBlendElement::in2.
pub func svg_svgfe_blend_element_in2(this: SvgSvgfeBlendElement*) -> 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/SVGFEBlendElement.cpp:72 Web::SVG::SVGFEBlendElement::mode.
pub func svg_svgfe_blend_element_mode(this: SvgSvgfeBlendElement*) -> gfx.CompositingAndBlendingOperator:
    return paint_mix_blend_mode_to_compositing_and_blending_operator(this.m_mode else css_data.MixBlendMode.normal)

## Ported from Libraries/LibWeb/SVG/SVGFEBlendElement.cpp:77 Web::SVG::SVGFEBlendElement::mode_for_bindings.
pub func svg_svgfe_blend_element_mode_for_bindings(this: SvgSvgfeBlendElement*) -> SvgAnimatedEnumeration*:
    return svg_animated_enumeration_create(dom_element_realm(this.dom_element()), (u16)svg_svgfe_blend_element_mode(this))