Luce packages
LuceLuce BaseLuciaOS

dymokomi/luce-browser-engine

Source of release 0.6.0

0.6.0 / src / web / svg / svg_uri_reference.lucb

#==============================================================================================
#
#   svg_uri_reference - SVG::SVGURIReferenceMixin: the href IDL attribute
#
#   DESCRIPTION:
#       Port of LibWeb/SVG/SVGURIReference.h (lines 1-55, a header-only template)
#       (https://svgwg.org/svg2-draft/types.html#InterfaceSVGURIReference). The template
#       parameter supports_xlink_href is a parameter, and `as<SVGElement>(*this)` is the
#       element the caller passes (the mixin sits at a class-specific offset).
#
#==============================================================================================

## Ported from Libraries/LibWeb/SVG/SVGURIReference.h:26 Web::SVG::SVGURIReferenceMixin::href.
pub func svg_svguri_reference_mixin_href(this: SvgSvguriReferenceMixin*, element: SvgElement*, supports_xlink_href: SvgSupportsXLinkHref) -> SvgAnimatedString*:
    # The href IDL attribute represents the value of the ‘href’ attribute, and, on elements that are defined to support
    # it, the deprecated ‘xlink:href’ attribute. On getting href, an SVGAnimatedString object is returned that:
    #    - reflects the ‘href’ attribute, and
    #    - if the element is defined to support the deprecated ‘xlink:href’ attribute, additionally reflects that
    #      deprecated attribute.
    if this.m_href_animated_string == none:
        var reflected_attribute: DomQualifiedName = ---
        dom_qualified_name_construct(&reflected_attribute, svg_attribute_names_href, none, none)
        var deprecated_reflected_attribute: DomQualifiedName? = none
        if supports_xlink_href == SvgSupportsXLinkHref.yes:
            var xlink_href: DomQualifiedName = ---
            dom_qualified_name_construct(&xlink_href, svg_attribute_names_href, ak.fly_string_from_str("xlink"), namespace_x_link)
            deprecated_reflected_attribute = xlink_href
        this.m_href_animated_string = svg_animated_string_create(dom_element_realm(element.dom_element()), element, reflected_attribute, deprecated_reflected_attribute)
    return this.m_href_animated_string else trap("VERIFY: m_href_animated_string")

## Ported from Libraries/LibWeb/SVG/SVGURIReference.h:46 Web::SVG::SVGURIReferenceMixin::visit_edges.
pub func svg_svguri_reference_mixin_visit_edges(this: SvgSvguriReferenceMixin*, visitor: gc.CellVisitor*):
    gc.cell_visitor_visit_t(visitor, this.m_href_animated_string)