dymokomi/luce-browser-engine
Source of release 0.6.1
0.6.1 / src / web / html / html_table_caption_element.lucb
#==============================================================================================
#
# html_table_caption_element - HTML::HTMLTableCaptionElement: <caption>
#
# DESCRIPTION:
# Port of LibWeb/HTML/HTMLTableCaptionElement.cpp (lines 1-50) and
# HTMLTableCaptionElement.h: the constructor (which moves the mixin tables to
# HTMLTableCaptionElement's, as C++'s vptrs move), initialize, the align attribute's
# presentational hint and the default role.
#
#==============================================================================================
## Ported from HTMLTableCaptionElement.cpp:17 Web::HTML::HTMLTableCaptionElement::HTMLTableCaptionElement.
pub func html_table_caption_element_construct(this: HtmlTableCaptionElement*, document: DomDocument*, qualified_name: DomQualifiedName):
html_element_construct(this.html_element(), document, qualified_name)
# The vptrs of the mixin bases move to HTMLTableCaptionElement's tables.
let element = this.html_element()
element.element.slottable_mixin.vtable = &html_table_caption_element_slottable_mixin_vtable
element.element.aria_mixin.vtable = &html_table_caption_element_aria_mixin_vtable
element.element.animatable.vtable = &html_table_caption_element_animatable_vtable
element.global_event_handlers.vtable = &html_table_caption_element_global_event_handlers_vtable
element.form_associated_element.vtable = &html_table_caption_element_form_associated_element_vtable
## Ported from HTMLTableCaptionElement.cpp:24 Web::HTML::HTMLTableCaptionElement::initialize (override).
pub func html_table_caption_element_initialize_impl(base: JsCell*, realm: Realm*):
web_set_prototype_for_interface(base, realm, BindInterfaceName.html_table_caption_element)
html_element_initialize_impl(base, realm)
## Ported from HTMLTableCaptionElement.cpp:30 Web::HTML::HTMLTableCaptionElement::is_presentational_hint (override).
pub func html_table_caption_element_is_presentational_hint_impl(base: DomElement*, name: ak.FlyString) -> bool:
if dom_element_is_presentational_hint_impl(base, name):
return true
return ak.fly_string_eq_fly_string(&name, &html_attribute_names_align)
## Ported from HTMLTableCaptionElement.cpp:39 Web::HTML::HTMLTableCaptionElement::apply_presentational_hints (override).
# https://html.spec.whatwg.org/multipage/rendering.html#tables-2
pub func html_table_caption_element_apply_presentational_hints_impl(base: DomElement*, properties: ak.Vector[CssStyleProperty]*):
dom_element_apply_presentational_hints_impl(base, properties)
for attribute in dom_element_attribute_span(base):
let name = dom_attr_name(attribute)
let value = dom_attr_value(attribute)
if ak.fly_string_eq_fly_string(&name, &html_attribute_names_align):
if ak.string_eq_string_view(&value, ak.sv("bottom")):
ak.vector_append_t(properties, CssStyleProperty(property_id = css_data.PropertyId.caption_side, value = css_keyword_style_value_create(css_data.Keyword.bottom).css_style_value()))
## Ported from HTMLTableCaptionElement.h:25 Web::HTML::HTMLTableCaptionElement::default_role (override).
# https://www.w3.org/TR/html-aria/#el-caption
pub func html_table_caption_element_default_role_impl(base: AriaMixin*) -> AriaRole?:
return AriaRole.caption