Luce packages
LuceLuce BaseLuciaOS

dymokomi/luce-browser-engine

Source of release 0.6.1

0.6.1 / src / web / html / html_quote_element.lucb

#==============================================================================================
#
#   html_quote_element - HTML::HTMLQuoteElement: <blockquote> and <q>
#
#   DESCRIPTION:
#       Port of LibWeb/HTML/HTMLQuoteElement.cpp (lines 1-41): construction (which moves the
#       mixin tables to HTMLQuoteElement's, as C++'s vptrs move), initialize and the default ARIA
#       role.
#
#==============================================================================================

## Ported from HTMLQuoteElement.cpp:17 Web::HTML::HTMLQuoteElement::HTMLQuoteElement.
pub func html_quote_element_construct(this: HtmlQuoteElement*, document: DomDocument*, qualified_name: DomQualifiedName):
    html_element_construct(this.html_element(), document, qualified_name)
    # The vptrs of the mixin bases move to HTMLQuoteElement's tables.
    let element = this.html_element()
    element.element.slottable_mixin.vtable = &html_quote_element_slottable_mixin_vtable
    element.element.aria_mixin.vtable = &html_quote_element_aria_mixin_vtable
    element.element.animatable.vtable = &html_quote_element_animatable_vtable
    element.global_event_handlers.vtable = &html_quote_element_global_event_handlers_vtable
    element.form_associated_element.vtable = &html_quote_element_form_associated_element_vtable

## Ported from HTMLQuoteElement.cpp:24 Web::HTML::HTMLQuoteElement::initialize (override).
pub func html_quote_element_initialize_impl(base: JsCell*, realm: Realm*):
    web_set_prototype_for_interface(base, realm, BindInterfaceName.html_quote_element)
    html_element_initialize_impl(base, realm)

## Ported from HTMLQuoteElement.cpp:30 Web::HTML::HTMLQuoteElement::default_role (override).
pub func html_quote_element_default_role_impl(base: AriaMixin*) -> AriaRole?:
    let this = (HtmlElement*)dom_element_from_aria_mixin(base)
    # https://www.w3.org/TR/html-aria/#el-blockquote
    if html_element_local_name_is(this, html_tag_names_blockquote):
        return AriaRole.blockquote
    # https://www.w3.org/TR/html-aria/#el-q
    if html_element_local_name_is(this, html_tag_names_q):
        return AriaRole.generic
    trap("VERIFY_NOT_REACHED")