Luce packages
LuceLuce BaseLuciaOS

dymokomi/luce-browser-engine

Source of release 0.6.0

0.6.0 / src / web / svg / svgfe_drop_shadow_element.lucb

#==============================================================================================
#
#   svgfe_drop_shadow_element - SVG::SVGFEDropShadowElement
#
#   DESCRIPTION:
#       Port of LibWeb/SVG/SVGFEDropShadowElement.cpp (lines 1-123) with the inline members of SVGFEDropShadowElement.h.
#       (https://drafts.fxtf.org/filter-effects/#feDropShadowElement): the flood color and
#       opacity, in, dx, dy and the two stdDeviation components.
#
#==============================================================================================

## Ported from Libraries/LibWeb/SVG/SVGFEDropShadowElement.cpp:15 Web::SVG::SVGFEDropShadowElement::SVGFEDropShadowElement.
pub func svg_svgfe_drop_shadow_element_construct(this: SvgSvgfeDropShadowElement*, document: DomDocument*, qualified_name: DomQualifiedName):
    svg_element_construct(this.svg_element(), document, qualified_name)
    # The vptrs of the mixin bases move to SVGFEDropShadowElement's tables.
    let element = this.svg_element()
    element.element.slottable_mixin.vtable = &svg_svgfe_drop_shadow_element_slottable_mixin_vtable
    element.element.aria_mixin.vtable = &svg_svgfe_drop_shadow_element_aria_mixin_vtable
    element.element.animatable.vtable = &svg_svgfe_drop_shadow_element_animatable_vtable
    element.global_event_handlers.vtable = &svg_svgfe_drop_shadow_element_global_event_handlers_vtable

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

## Ported from Libraries/LibWeb/SVG/SVGFEDropShadowElement.cpp:26 Web::SVG::SVGFEDropShadowElement::visit_edges (override).
pub func svg_svgfe_drop_shadow_element_visit_edges_impl(base: gc.Cell*, visitor: gc.CellVisitor*):
    let this = (SvgSvgfeDropShadowElement*)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_dx)
    gc.cell_visitor_visit_t(visitor, this.m_dy)
    gc.cell_visitor_visit_t(visitor, this.m_std_deviation_x)
    gc.cell_visitor_visit_t(visitor, this.m_std_deviation_y)

## `computed_properties()->color(property, CSS::ColorResolutionContext::for_element({ *this }))` after
## `VERIFY(computed_properties())`.
func svg_element_computed_color(element: SvgElement*, property: css_data.PropertyId) -> gfx.Color:
    let computed_properties = dom_element_computed_properties(element.dom_element()) else trap("VERIFY: computed_properties()")
    var abstract_element: DomAbstractElement = ---
    dom_abstract_element_construct(&abstract_element, element.dom_element())
    return css_computed_properties_color(computed_properties, property, css_color_resolution_context_for_element(abstract_element))

## Ported from Libraries/LibWeb/SVG/SVGFEDropShadowElement.cpp:38 Web::SVG::SVGFEDropShadowElement::flood_color.
# https://www.w3.org/TR/filter-effects-1/#FloodColorProperty
pub func svg_svgfe_drop_shadow_element_flood_color(this: SvgSvgfeDropShadowElement*) -> gfx.Color:
    return svg_element_computed_color(this.svg_element(), css_data.PropertyId.flood_color)

## Ported from Libraries/LibWeb/SVG/SVGFEDropShadowElement.cpp:45 Web::SVG::SVGFEDropShadowElement::flood_opacity.
# https://www.w3.org/TR/filter-effects-1/#FloodOpacityProperty
pub func svg_svgfe_drop_shadow_element_flood_opacity(this: SvgSvgfeDropShadowElement*) -> f32:
    let computed_properties = dom_element_computed_properties(this.dom_element()) else trap("VERIFY: computed_properties()")
    return css_computed_properties_flood_opacity(computed_properties)

## Ported from Libraries/LibWeb/SVG/SVGFEDropShadowElement.cpp:52 Web::SVG::SVGFEDropShadowElement::in1.
# https://drafts.csswg.org/filter-effects-1/#dom-svgfedropshadowelement-in1
pub func svg_svgfe_drop_shadow_element_in1(this: SvgSvgfeDropShadowElement*) -> SvgAnimatedString*:
    # Corresponds to attribute in on the given feDropShadow element.
    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/SVGFEDropShadowElement.cpp:62 Web::SVG::SVGFEDropShadowElement::dx.
# https://drafts.csswg.org/filter-effects-1/#dom-svgfedropshadowelement-dx
# https://drafts.csswg.org/filter-effects-1/#element-attrdef-fedropshadow-dx
pub func svg_svgfe_drop_shadow_element_dx(this: SvgSvgfeDropShadowElement*) -> SvgAnimatedNumber*:
    # Corresponds to attribute dx on the given feDropShadow element.
    # The initial value for dx is 2.
    if this.m_dx == none:
        this.m_dx = svg_animated_number_for_attribute(this.svg_element(), svg_attribute_names_dx, 2.0)

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

## Ported from Libraries/LibWeb/SVG/SVGFEDropShadowElement.cpp:73 Web::SVG::SVGFEDropShadowElement::dy.
# https://drafts.csswg.org/filter-effects-1/#dom-svgfedropshadowelement-dy
# https://drafts.csswg.org/filter-effects-1/#element-attrdef-fedropshadow-dy
pub func svg_svgfe_drop_shadow_element_dy(this: SvgSvgfeDropShadowElement*) -> SvgAnimatedNumber*:
    # Corresponds to attribute dy on the given feDropShadow element.
    # The initial value for dy is 2.
    if this.m_dy == none:
        this.m_dy = svg_animated_number_for_attribute(this.svg_element(), svg_attribute_names_dy, 2.0)

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

## Ported from Libraries/LibWeb/SVG/SVGFEDropShadowElement.cpp:84 Web::SVG::SVGFEDropShadowElement::std_deviation_x.
# https://drafts.csswg.org/filter-effects-1/#dom-svgfedropshadowelement-stddeviationx
# https://drafts.csswg.org/filter-effects-1/#element-attrdef-fedropshadow-stddeviation
pub func svg_svgfe_drop_shadow_element_std_deviation_x(this: SvgSvgfeDropShadowElement*) -> SvgAnimatedNumber*:
    # Corresponds to attribute stdDeviation on the given feDropShadow element. Contains the X component of attribute stdDeviation.
    # The initial value for stdDeviation is 2.
    if this.m_std_deviation_x == none:
        this.m_std_deviation_x = svg_animated_number_for_attribute(this.svg_element(), svg_attribute_names_std_deviation, 2.0, SvgAnimatedNumberSupportsSecondValue.yes, SvgAnimatedNumberValueRepresented.first)

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

## Ported from Libraries/LibWeb/SVG/SVGFEDropShadowElement.cpp:97 Web::SVG::SVGFEDropShadowElement::std_deviation_y.
# https://drafts.csswg.org/filter-effects-1/#dom-svgfedropshadowelement-stddeviationy
# https://drafts.csswg.org/filter-effects-1/#element-attrdef-fedropshadow-stddeviation
pub func svg_svgfe_drop_shadow_element_std_deviation_y(this: SvgSvgfeDropShadowElement*) -> SvgAnimatedNumber*:
    # Corresponds to attribute stdDeviation on the given feDropShadow element. Contains the Y component of attribute stdDeviation.
    # The initial value for stdDeviation is 2.
    if this.m_std_deviation_y == none:
        this.m_std_deviation_y = svg_animated_number_for_attribute(this.svg_element(), svg_attribute_names_std_deviation, 2.0, SvgAnimatedNumberSupportsSecondValue.yes, SvgAnimatedNumberValueRepresented.second)

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

## Ported from Libraries/LibWeb/SVG/SVGFEDropShadowElement.cpp:108 Web::SVG::SVGFEDropShadowElement::set_std_deviation.
# https://drafts.csswg.org/filter-effects-1/#dom-svgfedropshadowelement-setstddeviation
pub func svg_svgfe_drop_shadow_element_set_std_deviation(this: SvgSvgfeDropShadowElement*, std_deviation_x: f32, std_deviation_y: f32):
    # Sets the values for attribute stdDeviation.
    #
    # stdDeviationX
    #     The X component of attribute stdDeviation.
    #
    # stdDeviationY
    #     The Y component of attribute stdDeviation.
    # MUST(String::formatted("{} {}", std_deviation_x, std_deviation_y)): AK's float formatting.
    var builder = ak.string_builder_new()
    ak.format_f32(&builder, std_deviation_x)
    ak.string_builder_append(&builder, " ")
    ak.format_f32(&builder, std_deviation_y)
    let value = ak.string_builder_to_string(&builder) else trap("MUST: String::formatted")
    dom_element_set_attribute_value(this.dom_element(), svg_attribute_names_std_deviation, value)