dymokomi/luce-browser-engine
Source of release 0.6.0
0.6.0 / src / web / svg / svg_animated_enumeration.lucb
#==============================================================================================
#
# svg_animated_enumeration - SVG::SVGAnimatedEnumeration: a reflected enumeration
#
# DESCRIPTION:
# Port of LibWeb/SVG/SVGAnimatedEnumeration.cpp (lines 1-67) with the inline members of
# SVGAnimatedEnumeration.h (https://svgwg.org/svg2-draft/types.html#InterfaceSVGAnimatedEnumeration).
# The donor holds the value itself rather than reflecting the attribute (FIXMEs kept).
#
#==============================================================================================
## Ported from Libraries/LibWeb/SVG/SVGAnimatedEnumeration.cpp:16 Web::SVG::SVGAnimatedEnumeration::create.
pub func svg_animated_enumeration_create(realm: Realm*, value: u16) -> SvgAnimatedEnumeration*:
return realm_create_svg_animated_enumeration(realm, realm, value)
## Ported from Libraries/LibWeb/SVG/SVGAnimatedEnumeration.cpp:21 Web::SVG::SVGAnimatedEnumeration::SVGAnimatedEnumeration.
pub func svg_animated_enumeration_construct(this: SvgAnimatedEnumeration*, realm: Realm*, value: u16):
bind_platform_object_construct_realm(this.bind_platform_object(), realm)
this.m_value = value
## Ported from Libraries/LibWeb/SVG/SVGAnimatedEnumeration.h:22 Web::SVG::SVGAnimatedEnumeration::base_val.
pub func svg_animated_enumeration_base_val(this: SvgAnimatedEnumeration*) -> u16:
return svg_animated_enumeration_base_or_anim_value(this)
## Ported from Libraries/LibWeb/SVG/SVGAnimatedEnumeration.cpp:30 Web::SVG::SVGAnimatedEnumeration::set_base_val.
# https://svgwg.org/svg2-draft/types.html#__svg__SVGAnimatedEnumeration__baseVal
pub func svg_animated_enumeration_set_base_val(this: SvgAnimatedEnumeration*, base_val: u16) -> !:
# 1. Let value be the value being assigned to baseVal.
let value = base_val
# FIXME: 2. If value is 0 or is not the numeric type value for any value of the reflected attribute, then throw a
# TypeError.
if value == 0:
return try idl_throw_simple(IdlSimpleExceptionType.type_error, .string_view(ak.sv("invalid value for baseVal")))
# FIXME: 3. Otherwise, if the reflecting IDL attribute is orientType and value is SVG_MARKER_ORIENT_ANGLE, then set the
# reflected attribute to the string "0".
# FIXME: 4. Otherwise, value is the numeric type value for a specific, single keyword value for the reflected attribute.
# Set the reflected attribute to that value.
this.m_value = value
return
## Ported from Libraries/LibWeb/SVG/SVGAnimatedEnumeration.h:25 Web::SVG::SVGAnimatedEnumeration::anim_val.
pub func svg_animated_enumeration_anim_val(this: SvgAnimatedEnumeration*) -> u16:
return svg_animated_enumeration_base_or_anim_value(this)
## Ported from Libraries/LibWeb/SVG/SVGAnimatedEnumeration.cpp:50 Web::SVG::SVGAnimatedEnumeration::initialize (override).
pub func svg_animated_enumeration_initialize_impl(base: JsCell*, realm: Realm*):
web_set_prototype_for_interface(base, realm, BindInterfaceName.svg_animated_enumeration)
js_cell_initialize_impl(base, realm)
## Ported from Libraries/LibWeb/SVG/SVGAnimatedEnumeration.cpp:57 Web::SVG::SVGAnimatedEnumeration::base_or_anim_value.
# https://svgwg.org/svg2-draft/types.html#__svg__SVGAnimatedEnumeration__baseVal
func svg_animated_enumeration_base_or_anim_value(this: SvgAnimatedEnumeration*) -> u16:
# FIXME: 1. Let value be the value of the reflected attribute (using the attribute's initial value if it is not present or
# invalid).
# FIXME: 2. Return the numeric type value for value, according to the reflecting IDL attribute's definition.
return this.m_value