Luce packages
LuceLuce BaseLuciaOS

dymokomi/luce-browser-engine

Source of release 0.6.0

0.6.0 / src / web / dom / slot.lucb

#==============================================================================================
#
#   slot - DOM::Slot: the slot name and assigned nodes of an HTMLSlotElement
#
#   DESCRIPTION:
#       Port of LibWeb/DOM/Slot.cpp (lines 1-21) and the inline functions of Slot.h. Slot is a
#       stateful mixin of HTMLSlotElement (DESIGN.md ยง2.5); its virtual destructor does
#       nothing.
#
#==============================================================================================

## Ported from Slot.cpp:15 Web::DOM::Slot::visit_edges.
pub func dom_slot_visit_edges(this: DomSlot*, visitor: gc.CellVisitor*):
    for node in ak.vector_span(&this.m_assigned_nodes):
        match node:
            .dom_element(slottable): gc.cell_visitor_visit_t_2(visitor, slottable)
            .dom_text(slottable): gc.cell_visitor_visit_t_2(visitor, slottable)

# mark: Slot.h ==================================================================================

## Ported from Slot.h:19 Web::DOM::Slot::slot_name.
# Not called `name` to distinguish from `Element::name`.
pub func dom_slot_slot_name(this: DomSlot*) -> ak.FlyString:
    return this.m_name

## Ported from Slot.h:20 Web::DOM::Slot::set_slot_name.
pub func dom_slot_set_slot_name(this: DomSlot*, name: ak.FlyString):
    this.m_name = name

## Ported from Slot.h:22 Web::DOM::Slot::assigned_nodes_internal.
pub func dom_slot_assigned_nodes_internal(this: DomSlot*) -> const DomSlottable[]:
    return ak.vector_span_const(&this.m_assigned_nodes)

## Ported from Slot.h:23 Web::DOM::Slot::set_assigned_nodes.
pub func dom_slot_set_assigned_nodes(this: DomSlot*, assigned_nodes: ak.Vector[DomSlottable]):
    this.m_assigned_nodes = assigned_nodes