Luce packages
LuceLuce BaseLuciaOS

dymokomi/luce-browser-engine

Source of release 0.6.1

0.6.1 / src / web / svg / svg_animated_rect.lucb

#==============================================================================================
#
#   svg_animated_rect - SVG::SVGAnimatedRect: the reflected viewBox of an element
#
#   DESCRIPTION:
#       Port of LibWeb/SVG/SVGAnimatedRect.cpp (lines 1-73): two DOMRects, the base and the
#       animated value, nulled while the viewBox attribute is absent or invalid
#       (https://svgwg.org/svg2-draft/types.html#InterfaceSVGAnimatedRect). Gfx::DoubleRect is
#       geometry's GeometryDoubleRect.
#
#==============================================================================================

## Ported from Libraries/LibWeb/SVG/SVGAnimatedRect.cpp:16 Web::SVG::SVGAnimatedRect::SVGAnimatedRect.
pub func svg_animated_rect_construct(this: SvgAnimatedRect*, realm: Realm*):
    bind_platform_object_construct_realm(this.bind_platform_object(), realm)
    svg_animated_rect_init_fields(this)

## Ported from Libraries/LibWeb/SVG/SVGAnimatedRect.cpp:23 Web::SVG::SVGAnimatedRect::initialize (override).
pub func svg_animated_rect_initialize_impl(base: JsCell*, realm: Realm*):
    let this = (SvgAnimatedRect*)base
    web_set_prototype_for_interface(base, realm, BindInterfaceName.svg_animated_rect)
    js_cell_initialize_impl(base, realm)
    this.m_base_val = geometry_dom_rect_create(realm, gfx.FloatRect())
    this.m_anim_val = geometry_dom_rect_create(realm, gfx.FloatRect())

## Ported from Libraries/LibWeb/SVG/SVGAnimatedRect.cpp:31 Web::SVG::SVGAnimatedRect::visit_edges (override).
pub func svg_animated_rect_visit_edges_impl(base: gc.Cell*, visitor: gc.CellVisitor*):
    let this = (SvgAnimatedRect*)base
    bind_platform_object_visit_edges_impl(base, visitor)
    gc.cell_visitor_visit_t(visitor, this.m_base_val)
    gc.cell_visitor_visit_t(visitor, this.m_anim_val)

## Ported from Libraries/LibWeb/SVG/SVGAnimatedRect.cpp:38 Web::SVG::SVGAnimatedRect::base_val.
pub func svg_animated_rect_base_val(this: SvgAnimatedRect*) -> GeometryDomRect*?:
    if this.m_nulled:
        return none
    return this.m_base_val

## Ported from Libraries/LibWeb/SVG/SVGAnimatedRect.cpp:45 Web::SVG::SVGAnimatedRect::anim_val.
pub func svg_animated_rect_anim_val(this: SvgAnimatedRect*) -> GeometryDomRect*?:
    if this.m_nulled:
        return none
    return this.m_anim_val

## Ported from Libraries/LibWeb/SVG/SVGAnimatedRect.cpp:52 Web::SVG::SVGAnimatedRect::set_nulled.
pub func svg_animated_rect_set_nulled(this: SvgAnimatedRect*, nulled: bool):
    this.m_nulled = nulled

## Ported from Libraries/LibWeb/SVG/SVGAnimatedRect.cpp:57 Web::SVG::SVGAnimatedRect::set_base_val.
pub func svg_animated_rect_set_base_val(this: SvgAnimatedRect*, rect: GeometryDoubleRect):
    let base_val = this.m_base_val else trap("SVGAnimatedRect::set_base_val before initialize")
    geometry_dom_rect_set_x(base_val, rect.m_x)
    geometry_dom_rect_set_y(base_val, rect.m_y)
    geometry_dom_rect_set_width(base_val, rect.m_width)
    geometry_dom_rect_set_height(base_val, rect.m_height)

## Ported from Libraries/LibWeb/SVG/SVGAnimatedRect.cpp:65 Web::SVG::SVGAnimatedRect::set_anim_val.
pub func svg_animated_rect_set_anim_val(this: SvgAnimatedRect*, rect: GeometryDoubleRect):
    let anim_val = this.m_anim_val else trap("SVGAnimatedRect::set_anim_val before initialize")
    geometry_dom_rect_set_x(anim_val, rect.m_x)
    geometry_dom_rect_set_y(anim_val, rect.m_y)
    geometry_dom_rect_set_width(anim_val, rect.m_width)
    geometry_dom_rect_set_height(anim_val, rect.m_height)