Luce packages
LuceLuce BaseLuciaOS

dymokomi/luce-browser-engine

Source of release 0.6.0

0.6.0 / src / web / svg / svg_text_path_element.lucb

#==============================================================================================
#
#   svg_text_path_element - SVG::SVGTextPathElement: <textPath>
#
#   DESCRIPTION:
#       Port of LibWeb/SVG/SVGTextPathElement.cpp (lines 1-48): an SVGTextContentElement with
#       an href (SVGURIReferenceMixin, xlink:href supported) naming the path or shape its text
#       follows, laid out by an SVGTextPathBox.
#
#==============================================================================================

## Ported from Libraries/LibWeb/SVG/SVGTextPathElement.cpp:17 Web::SVG::SVGTextPathElement::SVGTextPathElement.
pub func svg_text_path_element_construct(this: SvgTextPathElement*, document: DomDocument*, qualified_name: DomQualifiedName):
    svg_text_content_element_construct(this.svg_text_content_element(), document, qualified_name)
    # The vptrs of the mixin bases move to SVGTextPathElement's tables.
    let element = this.svg_element()
    element.element.slottable_mixin.vtable = &svg_text_path_element_slottable_mixin_vtable
    element.element.aria_mixin.vtable = &svg_text_path_element_aria_mixin_vtable
    element.element.animatable.vtable = &svg_text_path_element_animatable_vtable
    element.global_event_handlers.vtable = &svg_text_path_element_global_event_handlers_vtable

## Ported from Libraries/LibWeb/SVG/SVGTextPathElement.cpp:22 Web::SVG::SVGTextPathElement::path_or_shape.
pub func svg_text_path_element_path_or_shape(this: SvgTextPathElement*) -> SvgGeometryElement*?:
    let href = dom_element_get_attribute(this.dom_element(), svg_attribute_names_href) else return none
    # try_resolve_url_to<SVGGeometryElement const>(*href): the String converts to a CSS::URL.
    var url: CssUrl = ---
    css_url_construct(&url, href, CssUrlType.url, ak.Vector[CssRequestUrlModifier]())
    let element = svg_graphics_element_resolve_url_to_element(this.svg_graphics_element(), url) else return none
    return as_if_svg_geometry_element(element)

## Ported from Libraries/LibWeb/SVG/SVGTextPathElement.cpp:30 Web::SVG::SVGTextPathElement::initialize (override).
pub func svg_text_path_element_initialize_impl(base: JsCell*, realm: Realm*):
    web_set_prototype_for_interface(base, realm, BindInterfaceName.svg_text_path_element)
    svg_text_content_element_initialize_impl(base, realm)

## Ported from Libraries/LibWeb/SVG/SVGTextPathElement.cpp:36 Web::SVG::SVGTextPathElement::visit_edges (override).
pub func svg_text_path_element_visit_edges_impl(base: gc.Cell*, visitor: gc.CellVisitor*):
    let this = (SvgTextPathElement*)base
    svg_element_visit_edges_impl(base, visitor)
    svg_svguri_reference_mixin_visit_edges(&this.svguri_reference_mixin, visitor)

## Ported from Libraries/LibWeb/SVG/SVGTextPathElement.cpp:42 Web::SVG::SVGTextPathElement::create_layout_node (override).
pub func svg_text_path_element_create_layout_node_impl(base: DomElement*, style: CssComputedProperties*) -> LayoutNode*?:
    let this = (SvgTextPathElement*)base
    # heap().allocate<Layout::SVGTextPathBox>(...): a layout node's initialize is JS::Cell's, which does nothing.
    return realm_create_layout_svg_text_path_box(dom_element_realm(base), dom_node_document(base.dom_node()), this, style).layout_node()