dymokomi/luce-browser-engine
Source of release 0.6.0
0.6.0 / src / web / html / html_legend_element.lucb
#==============================================================================================
#
# html_legend_element - HTML::HTMLLegendElement: <legend>
#
# DESCRIPTION:
# Port of LibWeb/HTML/HTMLLegendElement.cpp (lines 1-58): construction (which moves the
# mixin tables to HTMLLegendElement's, as C++'s vptrs move), initialize, the form IDL
# attribute and the LegendBox layout node.
#
#==============================================================================================
## Ported from HTMLLegendElement.cpp:17 Web::HTML::HTMLLegendElement::HTMLLegendElement.
pub func html_legend_element_construct(this: HtmlLegendElement*, document: DomDocument*, qualified_name: DomQualifiedName):
html_element_construct(this.html_element(), document, qualified_name)
# The vptrs of the mixin bases move to HTMLLegendElement's tables.
let element = this.html_element()
element.element.slottable_mixin.vtable = &html_legend_element_slottable_mixin_vtable
element.element.aria_mixin.vtable = &html_legend_element_aria_mixin_vtable
element.element.animatable.vtable = &html_legend_element_animatable_vtable
element.global_event_handlers.vtable = &html_legend_element_global_event_handlers_vtable
element.form_associated_element.vtable = &html_legend_element_form_associated_element_vtable
## Ported from HTMLLegendElement.cpp:24 Web::HTML::HTMLLegendElement::initialize (override).
pub func html_legend_element_initialize_impl(base: JsCell*, realm: Realm*):
web_set_prototype_for_interface(base, realm, BindInterfaceName.html_legend_element)
html_element_initialize_impl(base, realm)
## Ported from HTMLLegendElement.cpp:31 Web::HTML::HTMLLegendElement::form.
# https://html.spec.whatwg.org/multipage/form-elements.html#dom-legend-form
pub func html_legend_element_form(this: HtmlLegendElement*) -> HtmlFormElement*?:
# The form IDL attribute's behavior depends on whether the legend element is in a fieldset element or not.
# If the legend has a fieldset element as its parent, then the form IDL attribute must return the same value as the form IDL attribute on that fieldset element.
if let parent = dom_node_parent_element(this.dom_node()):
if let field_set = as_if_html_field_set_element(parent):
return html_form_associated_element_form(&field_set.html_element().form_associated_element)
# Otherwise, it must return null.
return none
## Ported from HTMLLegendElement.cpp:43 Web::HTML::HTMLLegendElement::create_layout_node (override).
pub func html_legend_element_create_layout_node_impl(base: DomElement*, style: CssComputedProperties*) -> LayoutNode*?:
let document = dom_node_document(base.dom_node())
# heap().allocate<Layout::LegendBox>(...): a layout node's initialize is JS::Cell's, which does nothing.
return realm_create_layout_legend_box(dom_element_realm(base), document, base, style).layout_node()
## Ported from HTMLLegendElement.cpp:48 Web::HTML::HTMLLegendElement::layout_node.
pub func html_legend_element_layout_node(this: HtmlLegendElement*) -> LayoutLegendBox*?:
return (LayoutLegendBox*?)dom_node_layout_node(this.dom_node())
## Ported from HTMLLegendElement.cpp:53 Web::HTML::HTMLLegendElement::layout_node.
pub func html_legend_element_layout_node_const(this: HtmlLegendElement*) -> LayoutLegendBox*?:
return (LayoutLegendBox*?)dom_node_layout_node(this.dom_node())