Luce packages
LuceLuce BaseLuciaOS

dymokomi/luce-browser-engine

Source of release 0.6.0

0.6.0 / src / web / dom / document_fragment.lucb

#==============================================================================================
#
#   document_fragment - DOM::DocumentFragment: fragments and their host
#
#   DESCRIPTION:
#       Port of LibWeb/DOM/DocumentFragment.cpp (lines 1-44) and the inline functions of
#       DocumentFragment.h. ShadowRoot derives from it.
#
#==============================================================================================

## Ported from DocumentFragment.cpp:15 Web::DOM::DocumentFragment::DocumentFragment.
pub func dom_document_fragment_construct(this: DomDocumentFragment*, document: DomDocument*):
    dom_parent_node_construct_dom_document(this.dom_parent_node(), document, DomNodeType.document_fragment_node)

## Ported from DocumentFragment.cpp:20 Web::DOM::DocumentFragment::initialize (override).
pub func dom_document_fragment_initialize_impl(base: JsCell*, realm: Realm*):
    web_set_prototype_for_interface(base, realm, BindInterfaceName.document_fragment)
    # Base::initialize(realm): ParentNode and Node inherit EventTarget's.
    dom_event_target_initialize_impl(base, realm)

## Ported from DocumentFragment.cpp:26 Web::DOM::DocumentFragment::visit_edges (override).
pub func dom_document_fragment_visit_edges_impl(base: gc.Cell*, visitor: gc.CellVisitor*):
    let this = (DomDocumentFragment*)base
    dom_parent_node_visit_edges_impl(base, visitor)
    gc.cell_visitor_visit_t(visitor, this.m_host)

## Ported from DocumentFragment.cpp:32 Web::DOM::DocumentFragment::set_host.
pub func dom_document_fragment_set_host(this: DomDocumentFragment*, element: DomElement*?):
    this.m_host = element

## Ported from DocumentFragment.cpp:38 Web::DOM::DocumentFragment::construct_impl.
# https://dom.spec.whatwg.org/#dom-documentfragment-documentfragment
pub func dom_document_fragment_construct_impl(realm: Realm*) -> DomDocumentFragment*!:
    let window = as_html_window((gc.Cell*)realm_global_object(realm))
    return realm_create_dom_document_fragment(realm, html_window_associated_document(window))

# mark: DocumentFragment.h ======================================================================

## Ported from DocumentFragment.h:25 Web::DOM::DocumentFragment::node_name (override).
pub func dom_document_fragment_node_name_impl(base: DomNode*) -> ak.FlyString:
    return ak.fly_string_from_str("#document-fragment")

## Ported from DocumentFragment.h:27 Web::DOM::DocumentFragment::host.
pub func dom_document_fragment_host(this: DomDocumentFragment*) -> DomElement*?:
    return this.m_host

## Ported from DocumentFragment.h:28 Web::DOM::DocumentFragment::host.
pub func dom_document_fragment_host_const(this: DomDocumentFragment*) -> DomElement*?:
    return this.m_host