dymokomi/luce-browser-engine
Source of release 0.6.1
0.6.1 / src / web / html / html_map_element.lucb
#==============================================================================================
#
# html_map_element - HTML::HTMLMapElement: <map>
#
# DESCRIPTION:
# Port of LibWeb/HTML/HTMLMapElement.cpp (lines 1-47): construction (which moves the mixin
# tables to HTMLMapElement's, as C++'s vptrs move), initialize, visit_edges and the areas
# collection.
#
#==============================================================================================
## Ported from HTMLMapElement.cpp:16 Web::HTML::HTMLMapElement::HTMLMapElement.
pub func html_map_element_construct(this: HtmlMapElement*, document: DomDocument*, qualified_name: DomQualifiedName):
html_element_construct(this.html_element(), document, qualified_name)
# The vptrs of the mixin bases move to HTMLMapElement's tables.
let element = this.html_element()
element.element.slottable_mixin.vtable = &html_map_element_slottable_mixin_vtable
element.element.aria_mixin.vtable = &html_map_element_aria_mixin_vtable
element.element.animatable.vtable = &html_map_element_animatable_vtable
element.global_event_handlers.vtable = &html_map_element_global_event_handlers_vtable
element.form_associated_element.vtable = &html_map_element_form_associated_element_vtable
## Ported from HTMLMapElement.cpp:23 Web::HTML::HTMLMapElement::initialize (override).
pub func html_map_element_initialize_impl(base: JsCell*, realm: Realm*):
web_set_prototype_for_interface(base, realm, BindInterfaceName.html_map_element)
html_element_initialize_impl(base, realm)
## Ported from HTMLMapElement.cpp:29 Web::HTML::HTMLMapElement::visit_edges (override).
pub func html_map_element_visit_edges_impl(base: gc.Cell*, visitor: gc.CellVisitor*):
let this = (HtmlMapElement*)base
html_element_visit_edges_impl(base, visitor)
gc.cell_visitor_visit_t[DomHtmlCollection](visitor, this.m_areas)
## The filter of the areas collection: `[](Element const& element) { return is<HTML::HTMLAreaElement>(element); }`.
func html_map_element_areas_filter(context: void*?, element: DomElement*) -> bool:
return is_html_area_element(element)
## Ported from HTMLMapElement.cpp:36 Web::HTML::HTMLMapElement::areas.
# https://html.spec.whatwg.org/multipage/image-maps.html#dom-map-areas
pub func html_map_element_areas(this: HtmlMapElement*) -> DomHtmlCollection*:
# The areas attribute must return an HTMLCollection rooted at the map element, whose filter matches only area elements.
if this.m_areas == none:
this.m_areas = dom_html_collection_create(this.dom_parent_node(), DomHtmlCollectionScope.descendants, ak.Function1[DomElement*, bool](call = html_map_element_areas_filter, context = none), ak.Function2[DomElement*, DomElement*, bool]())
return this.m_areas else trap("unreachable")