dymokomi/luce-browser-engine
Source of release 0.6.1
0.6.1 / src / web / dom / node_8.lucb
#==============================================================================================
#
# node_8 - DOM::Node: accessible name entry points, observers, ancestry queries, Node.h
#
# DESCRIPTION:
# Port of LibWeb/DOM/Node.cpp (lines 3312-3404): accessibleName/accessibleDescription,
# the first valid IDREF, registered observers, the display:none and event-listener
# ancestry queries and the containing shadow root; then the inline functions of
# LibWeb/DOM/Node.h (lines 110-538) in their header order: the node-type predicates, the
# default bodies of Node's virtual functions, the dirty-flag accessors and the generic
# helpers (which take a ClassInfo or a callback, DESIGN.md §2.4, §2.7).
#
#==============================================================================================
# mark: Accessible name and description =========================================================
## Ported from Node.cpp:3313 Web::DOM::Node::accessible_name.
# https://www.w3.org/TR/accname-1.2/#mapping_additional_nd_name
pub func dom_node_accessible_name(this: DomNode*, document: DomDocument*, should_compute_role: DomShouldComputeRole = DomShouldComputeRole.yes) -> ak.String!:
var visited_nodes: ak.HashTable[i64, ak.I64Traits]
# User agents MUST compute an accessible name using the rules outlined below in the section titled Accessible Name and Description Computation.
return try dom_node_name_or_description(this, DomNameOrDescription.name, document, &visited_nodes, DomIsDescendant.no, should_compute_role)
## Ported from Node.cpp:3321 Web::DOM::Node::accessible_description.
# https://www.w3.org/TR/accname-1.2/#mapping_additional_nd_description
pub func dom_node_accessible_description(this: DomNode*, document: DomDocument*) -> ak.String!:
# If aria-describedby is present, user agents MUST compute the accessible description by concatenating the text alternatives for elements referenced by an aria-describedby attribute on the current element.
# The text alternatives for the referenced elements are computed using a number of methods, outlined below in the section titled Accessible Name and Description Computation.
if not dom_node_is_element(this):
return ak.string_new()
let element = (DomElement*)this
let described_by = aria_mixin_aria_described_by(&element.aria_mixin) else return ak.string_new()
var visited_nodes: ak.HashTable[i64, ak.I64Traits]
var builder = ak.string_builder_new()
var id_list = dom_node_split_on_ascii_whitespace(&described_by)
for id in ak.vector_span(&id_list):
if let description_element = dom_parent_node_get_element_by_id(document.dom_parent_node(), ak.fly_string_from_utf8(id) else trap("MUST: FlyString::from_utf8")):
let description = try dom_node_name_or_description(description_element.dom_node(), DomNameOrDescription.description, document, &visited_nodes)
if not ak.string_is_empty(&description):
if ak.string_builder_is_empty(&builder):
dom_node_append_string(&builder, description)
else:
ak.string_builder_append(&builder, " ")
dom_node_append_string(&builder, description)
return try ak.string_builder_to_string(&builder)
## Ported from Node.cpp:3354 Web::DOM::Node::first_valid_id.
pub func dom_node_first_valid_id(value: ak.StringView, document: DomDocument*) -> ak.StringView?:
let predicate = ak.CharPredicateFunction(function = web_infra.is_ascii_whitespace)
var id_list = ak.string_view_split_view_if(&value, &predicate)
for id in ak.vector_span(&id_list):
if dom_parent_node_get_element_by_id(document.dom_parent_node(), ak.fly_string_from_utf8(id) else trap("MUST: FlyString::from_utf8")) != none:
return id
return none
# mark: Registered observers and ancestry queries ===============================================
## Ported from Node.cpp:3364 Web::DOM::Node::add_registered_observer.
pub func dom_node_add_registered_observer(this: DomNode*, registered_observer: DomRegisteredObserver*):
if this.m_registered_observer_list == none:
this.m_registered_observer_list = new ak.Vector[DomRegisteredObserver*] else trap("out of memory")
let list = this.m_registered_observer_list else trap("unreachable")
ak.vector_append_t(list, registered_observer)
## Ported from Node.cpp:3371 Web::DOM::Node::has_inclusive_ancestor_with_display_none_ignoring_animations.
pub func dom_node_has_inclusive_ancestor_with_display_none_ignoring_animations(this: DomNode*) -> bool:
var ancestor: DomNode*? = this
while let ancestor_node = ancestor:
ancestor = none
if let parent_or_host = dom_node_parent_or_shadow_host(ancestor_node):
ancestor = parent_or_host.dom_node()
if not dom_node_is_element(ancestor_node):
continue
let ancestor_element = (DomElement*)ancestor_node
if let computed_properties = dom_element_computed_properties(ancestor_element):
let display = css_display_style_value_display(css_style_value_as_display(css_computed_properties_property(computed_properties, css_data.PropertyId.display, CssComputedPropertiesWithAnimationsApplied.no)))
if css_display_is_none(&display):
return true
return false
## Ported from Node.cpp:3384 Web::DOM::Node::has_inclusive_ancestor_with_event_listener.
pub func dom_node_has_inclusive_ancestor_with_event_listener(this: DomNode*, type_: ak.FlyString) -> bool:
var ancestor: DomNode*? = this
while let ancestor_node = ancestor:
if dom_event_target_has_event_listener(ancestor_node.dom_event_target(), type_):
return true
ancestor = none
if let parent_or_host = dom_node_parent_or_shadow_host(ancestor_node):
ancestor = parent_or_host.dom_node()
if let window = dom_document_window(dom_node_document(this)):
return dom_event_target_has_event_listener(window.dom_event_target(), type_)
return false
## Ported from Node.cpp:3395 Web::DOM::Node::containing_shadow_root.
pub func dom_node_containing_shadow_root(this: DomNode*) -> DomShadowRoot*?:
if let shadow_root = as_if_dom_shadow_root(this):
let host = dom_document_fragment_host(shadow_root.dom_document_fragment()) else trap("shadow root without a host")
return dom_node_containing_shadow_root(host.dom_node())
if let shadow_root = as_if_dom_shadow_root(tree_node_root(this)):
return shadow_root
return none
# mark: Node.h: parents and node types ==========================================================
## Ported from Node.h:118 Web::DOM::Node::parent_or_shadow_host const.
pub func dom_node_parent_or_shadow_host_const(this: DomNode*) -> DomParentNode*?:
return dom_node_parent_or_shadow_host(this)
## Ported from Node.h:121 Web::DOM::Node::parent_or_shadow_host_element const.
pub func dom_node_parent_or_shadow_host_element_const(this: DomNode*) -> DomElement*?:
return dom_node_parent_or_shadow_host_element(this)
## Ported from Node.h:123 Web::DOM::Node::flat_tree_parent const.
pub func dom_node_flat_tree_parent_const(this: DomNode*) -> DomParentNode*?:
return dom_node_flat_tree_parent(this)
## Ported from Node.h:125 Web::DOM::Node::flat_tree_parent_element const.
pub func dom_node_flat_tree_parent_element_const(this: DomNode*) -> DomElement*?:
return dom_node_flat_tree_parent_element(this)
## Ported from Node.h:129 Web::DOM::Node::type.
pub func dom_node_type(this: DomNode*) -> DomNodeType:
return this.m_type
## Ported from Node.h:130 Web::DOM::Node::is_element.
pub func dom_node_is_element(this: DomNode*) -> bool:
return dom_node_type(this) == DomNodeType.element_node
## Ported from Node.h:131 Web::DOM::Node::is_text.
pub func dom_node_is_text(this: DomNode*) -> bool:
return dom_node_type(this) == DomNodeType.text_node or dom_node_type(this) == DomNodeType.cdata_section_node
## Ported from Node.h:132 Web::DOM::Node::is_exclusive_text.
pub func dom_node_is_exclusive_text(this: DomNode*) -> bool:
return dom_node_type(this) == DomNodeType.text_node
## Ported from Node.h:133 Web::DOM::Node::is_document.
pub func dom_node_is_document(this: DomNode*) -> bool:
return dom_node_type(this) == DomNodeType.document_node
## Ported from Node.h:134 Web::DOM::Node::is_document_type.
pub func dom_node_is_document_type(this: DomNode*) -> bool:
return dom_node_type(this) == DomNodeType.document_type_node
## Ported from Node.h:135 Web::DOM::Node::is_comment.
pub func dom_node_is_comment(this: DomNode*) -> bool:
return dom_node_type(this) == DomNodeType.comment_node
## Ported from Node.h:136 Web::DOM::Node::is_character_data.
pub func dom_node_is_character_data(this: DomNode*) -> bool:
let type_ = dom_node_type(this)
return type_ == DomNodeType.text_node or type_ == DomNodeType.comment_node or type_ == DomNodeType.cdata_section_node or type_ == DomNodeType.processing_instruction_node
## Ported from Node.h:137 Web::DOM::Node::is_document_fragment.
pub func dom_node_is_document_fragment(this: DomNode*) -> bool:
return dom_node_type(this) == DomNodeType.document_fragment_node
## Ported from Node.h:138 Web::DOM::Node::is_parent_node.
pub func dom_node_is_parent_node(this: DomNode*) -> bool:
return dom_node_is_element(this) or dom_node_is_document(this) or dom_node_is_document_fragment(this)
## Ported from Node.h:139 Web::DOM::Node::is_slottable.
pub func dom_node_is_slottable(this: DomNode*) -> bool:
return dom_node_is_element(this) or dom_node_is_text(this) or dom_node_is_cdata_section(this)
## Ported from Node.h:140 Web::DOM::Node::is_attribute.
pub func dom_node_is_attribute(this: DomNode*) -> bool:
return dom_node_type(this) == DomNodeType.attribute_node
## Ported from Node.h:141 Web::DOM::Node::is_cdata_section.
pub func dom_node_is_cdata_section(this: DomNode*) -> bool:
return dom_node_type(this) == DomNodeType.cdata_section_node
# mark: Node.h: default bodies of the type-query virtuals =======================================
## Ported from Node.h:142 Web::DOM::Node::is_shadow_root (virtual).
pub func dom_node_is_shadow_root_impl(this: DomNode*) -> bool:
return false
## Ported from Node.h:144 Web::DOM::Node::requires_svg_container (virtual).
pub func dom_node_requires_svg_container_impl(this: DomNode*) -> bool:
return false
## Ported from Node.h:145 Web::DOM::Node::is_svg_container (virtual).
pub func dom_node_is_svg_container_impl(this: DomNode*) -> bool:
return false
## Ported from Node.h:146 Web::DOM::Node::is_svg_element (virtual).
pub func dom_node_is_svg_element_impl(this: DomNode*) -> bool:
return false
## Ported from Node.h:147 Web::DOM::Node::is_svg_graphics_element (virtual).
pub func dom_node_is_svg_graphics_element_impl(this: DomNode*) -> bool:
return false
## Ported from Node.h:148 Web::DOM::Node::is_svg_mask_element (virtual).
pub func dom_node_is_svg_mask_element_impl(this: DomNode*) -> bool:
return false
## Ported from Node.h:149 Web::DOM::Node::is_svg_script_element (virtual).
pub func dom_node_is_svg_script_element_impl(this: DomNode*) -> bool:
return false
## Ported from Node.h:150 Web::DOM::Node::is_svg_style_element (virtual).
pub func dom_node_is_svg_style_element_impl(this: DomNode*) -> bool:
return false
## Ported from Node.h:151 Web::DOM::Node::is_svg_svg_element (virtual).
pub func dom_node_is_svg_svg_element_impl(this: DomNode*) -> bool:
return false
## Ported from Node.h:152 Web::DOM::Node::is_svg_symbol_element (virtual).
pub func dom_node_is_svg_symbol_element_impl(this: DomNode*) -> bool:
return false
## Ported from Node.h:153 Web::DOM::Node::is_svg_use_element (virtual).
pub func dom_node_is_svg_use_element_impl(this: DomNode*) -> bool:
return false
## Ported from Node.h:154 Web::DOM::Node::is_svg_view_element (virtual).
pub func dom_node_is_svg_view_element_impl(this: DomNode*) -> bool:
return false
## Ported from Node.h:155 Web::DOM::Node::is_svg_a_element (virtual).
pub func dom_node_is_svg_a_element_impl(this: DomNode*) -> bool:
return false
## Ported from Node.h:156 Web::DOM::Node::is_svg_g_element (virtual).
pub func dom_node_is_svg_g_element_impl(this: DomNode*) -> bool:
return false
## Ported from Node.h:157 Web::DOM::Node::is_svg_foreign_object_element (virtual).
pub func dom_node_is_svg_foreign_object_element_impl(this: DomNode*) -> bool:
return false
## Ported from Node.h:162 Web::DOM::Node::node_type.
# NOTE: This is intended for the JS bindings.
pub func dom_node_node_type(this: DomNode*) -> u16:
return (u16)this.m_type
## Ported from Node.h:166 Web::DOM::Node::is_editable_or_editing_host.
pub func dom_node_is_editable_or_editing_host(this: DomNode*) -> bool:
return dom_node_is_editable(this) or dom_node_is_editing_host(this)
## Ported from Node.h:169 Web::DOM::Node::in_editable_subtree.
pub func dom_node_in_editable_subtree(this: DomNode*) -> bool:
return this.m_in_editable_subtree
## Ported from Node.h:172 Web::DOM::Node::is_dom_node (virtual, final).
pub func dom_node_is_dom_node_impl(this: DomNode*) -> bool:
return true
## Ported from Node.h:173 Web::DOM::Node::is_html_element (virtual).
pub func dom_node_is_html_element_impl(this: DomNode*) -> bool:
return false
## Ported from Node.h:174 Web::DOM::Node::is_html_html_element (virtual).
pub func dom_node_is_html_html_element_impl(this: DomNode*) -> bool:
return false
## Ported from Node.h:175 Web::DOM::Node::is_html_anchor_element (virtual).
pub func dom_node_is_html_anchor_element_impl(this: DomNode*) -> bool:
return false
## Ported from Node.h:176 Web::DOM::Node::is_html_area_element (virtual).
pub func dom_node_is_html_area_element_impl(this: DomNode*) -> bool:
return false
## Ported from Node.h:177 Web::DOM::Node::is_html_base_element (virtual).
pub func dom_node_is_html_base_element_impl(this: DomNode*) -> bool:
return false
## Ported from Node.h:178 Web::DOM::Node::is_html_body_element (virtual).
pub func dom_node_is_html_body_element_impl(this: DomNode*) -> bool:
return false
## Ported from Node.h:179 Web::DOM::Node::is_html_head_element (virtual).
pub func dom_node_is_html_head_element_impl(this: DomNode*) -> bool:
return false
## Ported from Node.h:180 Web::DOM::Node::is_html_heading_element (virtual).
pub func dom_node_is_html_heading_element_impl(this: DomNode*) -> bool:
return false
## Ported from Node.h:181 Web::DOM::Node::is_html_input_element (virtual).
pub func dom_node_is_html_input_element_impl(this: DomNode*) -> bool:
return false
## Ported from Node.h:182 Web::DOM::Node::is_html_link_element (virtual).
pub func dom_node_is_html_link_element_impl(this: DomNode*) -> bool:
return false
## Ported from Node.h:183 Web::DOM::Node::is_html_media_element (virtual).
pub func dom_node_is_html_media_element_impl(this: DomNode*) -> bool:
return false
## Ported from Node.h:184 Web::DOM::Node::is_html_optgroup_element (virtual).
pub func dom_node_is_html_optgroup_element_impl(this: DomNode*) -> bool:
return false
## Ported from Node.h:185 Web::DOM::Node::is_html_option_element (virtual).
pub func dom_node_is_html_option_element_impl(this: DomNode*) -> bool:
return false
## Ported from Node.h:186 Web::DOM::Node::is_html_progress_element (virtual).
pub func dom_node_is_html_progress_element_impl(this: DomNode*) -> bool:
return false
## Ported from Node.h:187 Web::DOM::Node::is_html_script_element (virtual).
pub func dom_node_is_html_script_element_impl(this: DomNode*) -> bool:
return false
## Ported from Node.h:188 Web::DOM::Node::is_html_select_element (virtual).
pub func dom_node_is_html_select_element_impl(this: DomNode*) -> bool:
return false
## Ported from Node.h:189 Web::DOM::Node::is_html_style_element (virtual).
pub func dom_node_is_html_style_element_impl(this: DomNode*) -> bool:
return false
## Ported from Node.h:190 Web::DOM::Node::is_html_template_element (virtual).
pub func dom_node_is_html_template_element_impl(this: DomNode*) -> bool:
return false
## Ported from Node.h:191 Web::DOM::Node::is_html_table_element (virtual).
pub func dom_node_is_html_table_element_impl(this: DomNode*) -> bool:
return false
## Ported from Node.h:192 Web::DOM::Node::is_html_table_section_element (virtual).
pub func dom_node_is_html_table_section_element_impl(this: DomNode*) -> bool:
return false
## Ported from Node.h:193 Web::DOM::Node::is_html_table_row_element (virtual).
pub func dom_node_is_html_table_row_element_impl(this: DomNode*) -> bool:
return false
## Ported from Node.h:194 Web::DOM::Node::is_html_table_cell_element (virtual).
pub func dom_node_is_html_table_cell_element_impl(this: DomNode*) -> bool:
return false
## Ported from Node.h:195 Web::DOM::Node::is_html_title_element (virtual).
pub func dom_node_is_html_title_element_impl(this: DomNode*) -> bool:
return false
## Ported from Node.h:196 Web::DOM::Node::is_html_br_element (virtual).
pub func dom_node_is_html_br_element_impl(this: DomNode*) -> bool:
return false
## Ported from Node.h:197 Web::DOM::Node::is_html_button_element (virtual).
pub func dom_node_is_html_button_element_impl(this: DomNode*) -> bool:
return false
## Ported from Node.h:198 Web::DOM::Node::is_html_slot_element (virtual).
pub func dom_node_is_html_slot_element_impl(this: DomNode*) -> bool:
return false
## Ported from Node.h:199 Web::DOM::Node::is_html_embed_element (virtual).
pub func dom_node_is_html_embed_element_impl(this: DomNode*) -> bool:
return false
## Ported from Node.h:200 Web::DOM::Node::is_html_object_element (virtual).
pub func dom_node_is_html_object_element_impl(this: DomNode*) -> bool:
return false
## Ported from Node.h:201 Web::DOM::Node::is_html_form_element (virtual).
pub func dom_node_is_html_form_element_impl(this: DomNode*) -> bool:
return false
## Ported from Node.h:202 Web::DOM::Node::is_html_image_element (virtual).
pub func dom_node_is_html_image_element_impl(this: DomNode*) -> bool:
return false
## Ported from Node.h:203 Web::DOM::Node::is_html_iframe_element (virtual).
pub func dom_node_is_html_iframe_element_impl(this: DomNode*) -> bool:
return false
## Ported from Node.h:204 Web::DOM::Node::is_html_div_element (virtual).
pub func dom_node_is_html_div_element_impl(this: DomNode*) -> bool:
return false
## Ported from Node.h:205 Web::DOM::Node::is_html_span_element (virtual).
pub func dom_node_is_html_span_element_impl(this: DomNode*) -> bool:
return false
## Ported from Node.h:206 Web::DOM::Node::is_html_textarea_element (virtual).
pub func dom_node_is_html_textarea_element_impl(this: DomNode*) -> bool:
return false
## Ported from Node.h:207 Web::DOM::Node::is_html_frameset_element (virtual).
pub func dom_node_is_html_frameset_element_impl(this: DomNode*) -> bool:
return false
## Ported from Node.h:208 Web::DOM::Node::is_html_fieldset_element (virtual).
pub func dom_node_is_html_fieldset_element_impl(this: DomNode*) -> bool:
return false
## Ported from Node.h:209 Web::DOM::Node::is_html_li_element (virtual).
pub func dom_node_is_html_li_element_impl(this: DomNode*) -> bool:
return false
## Ported from Node.h:210 Web::DOM::Node::is_html_menu_element (virtual).
pub func dom_node_is_html_menu_element_impl(this: DomNode*) -> bool:
return false
## Ported from Node.h:211 Web::DOM::Node::is_html_olist_element (virtual).
pub func dom_node_is_html_olist_element_impl(this: DomNode*) -> bool:
return false
## Ported from Node.h:212 Web::DOM::Node::is_html_ulist_element (virtual).
pub func dom_node_is_html_ulist_element_impl(this: DomNode*) -> bool:
return false
## Ported from Node.h:213 Web::DOM::Node::is_html_ol_ul_menu_element.
pub func dom_node_is_html_ol_ul_menu_element(this: DomNode*) -> bool:
return dom_node_is_html_olist_element(this) or dom_node_is_html_ulist_element(this) or dom_node_is_html_menu_element(this)
## Ported from Node.h:217 Web::DOM::Node::is_navigable_container (virtual).
pub func dom_node_is_navigable_container_impl(this: DomNode*) -> bool:
return false
## Ported from Node.h:218 Web::DOM::Node::is_lazy_loading (virtual).
pub func dom_node_is_lazy_loading_impl(this: DomNode*) -> bool:
return false
# mark: Node.h: children, names, documents and connection =======================================
## Ported from Node.h:251 Web::DOM::Node::has_child_nodes.
# NOTE: This is intended for the JS bindings.
pub func dom_node_has_child_nodes(this: DomNode*) -> bool:
return tree_node_has_children(this)
## Ported from Node.h:255 Web::DOM::Node::node_name (pure virtual).
pub func dom_node_node_name_impl(this: DomNode*) -> ak.FlyString:
trap("pure virtual: Web::DOM::Node::node_name")
## Ported from Node.h:272 Web::DOM::Node::document.
pub func dom_node_document(this: DomNode*) -> DomDocument*:
return this.m_document else trap("Node::document(): no node document")
## Ported from Node.h:273 Web::DOM::Node::document const.
pub func dom_node_document_const(this: DomNode*) -> DomDocument*:
return this.m_document else trap("Node::document(): no node document")
## Ported from Node.h:284 Web::DOM::Node::shadow_including_root const.
pub func dom_node_shadow_including_root_const(this: DomNode*) -> DomNode*:
return dom_node_shadow_including_root(this)
## Ported from Node.h:291 Web::DOM::Node::is_connected.
pub func dom_node_is_connected(this: DomNode*) -> bool:
return this.m_is_connected
## Ported from Node.h:292 Web::DOM::Node::set_is_connected.
pub func dom_node_set_is_connected(this: DomNode*, is_connected: bool):
this.m_is_connected = is_connected
## Ported from Node.h:296 Web::DOM::Node::parent_node.
pub func dom_node_parent_node(this: DomNode*) -> DomNode*?:
return tree_node_parent(this)
## Ported from Node.h:297 Web::DOM::Node::parent_node const.
pub func dom_node_parent_node_const(this: DomNode*) -> DomNode*?:
return tree_node_parent(this)
# mark: Node.h: default bodies of the tree-mutation virtuals ====================================
## Ported from Node.h:321 Web::DOM::Node::children_changed (virtual).
# FIXME: It would be good if we could always provide this metadata for use in optimizations.
pub func dom_node_children_changed_impl(this: DomNode*, arg0: DomNodeChildrenChangedMetadata):
return
## Ported from Node.h:323 Web::DOM::Node::adopted_from (virtual).
pub func dom_node_adopted_from_impl(this: DomNode*, arg0: DomDocument*):
return
## Ported from Node.h:324 Web::DOM::Node::cloned (virtual).
pub func dom_node_cloned_impl(this: DomNode*, arg0: DomNode*, arg1: bool) -> !:
return
# mark: Node.h: layout node and paintable links =================================================
## Ported from Node.h:329 Web::DOM::Node::unsafe_layout_node const.
pub func dom_node_unsafe_layout_node_const(this: DomNode*) -> LayoutNode*?:
return this.m_layout_node
## Ported from Node.h:330 Web::DOM::Node::unsafe_layout_node.
pub func dom_node_unsafe_layout_node(this: DomNode*) -> LayoutNode*?:
return this.m_layout_node
## Ported from Node.h:339 Web::DOM::Node::unsafe_paintable const.
pub func dom_node_unsafe_paintable_const(this: DomNode*) -> PaintPaintable*?:
return this.m_paintable
## Ported from Node.h:340 Web::DOM::Node::unsafe_paintable.
pub func dom_node_unsafe_paintable(this: DomNode*) -> PaintPaintable*?:
return this.m_paintable
## Ported from Node.h:352 Web::DOM::Node::is_child_allowed (virtual).
pub func dom_node_is_child_allowed_impl(this: DomNode*, arg0: DomNode*) -> bool:
return true
# mark: Node.h: dirty flags =====================================================================
## Ported from Node.h:354 Web::DOM::Node::needs_layout_tree_update.
pub func dom_node_needs_layout_tree_update(this: DomNode*) -> bool:
return this.m_needs_layout_tree_update
## Ported from Node.h:357 Web::DOM::Node::child_needs_layout_tree_update.
pub func dom_node_child_needs_layout_tree_update(this: DomNode*) -> bool:
return this.m_child_needs_layout_tree_update
## Ported from Node.h:358 Web::DOM::Node::set_child_needs_layout_tree_update.
pub func dom_node_set_child_needs_layout_tree_update(this: DomNode*, b: bool):
this.m_child_needs_layout_tree_update = b
## Ported from Node.h:360 Web::DOM::Node::needs_style_update.
pub func dom_node_needs_style_update(this: DomNode*) -> bool:
return this.m_needs_style_update
## Ported from Node.h:362 Web::DOM::Node::set_needs_style_update_internal.
pub func dom_node_set_needs_style_update_internal(this: DomNode*, arg0: bool):
this.m_needs_style_update = true
## Ported from Node.h:364 Web::DOM::Node::child_needs_style_update.
pub func dom_node_child_needs_style_update(this: DomNode*) -> bool:
return this.m_child_needs_style_update
## Ported from Node.h:365 Web::DOM::Node::set_child_needs_style_update.
pub func dom_node_set_child_needs_style_update(this: DomNode*, b: bool):
this.m_child_needs_style_update = b
## Ported from Node.h:367 Web::DOM::Node::entire_subtree_needs_style_update.
pub func dom_node_entire_subtree_needs_style_update(this: DomNode*) -> bool:
return this.m_entire_subtree_needs_style_update
## Ported from Node.h:368 Web::DOM::Node::set_entire_subtree_needs_style_update.
pub func dom_node_set_entire_subtree_needs_style_update(this: DomNode*, b: bool):
this.m_entire_subtree_needs_style_update = b
## Ported from Node.h:373 Web::DOM::Node::style_scope const.
pub func dom_node_style_scope_const(this: DomNode*) -> CssStyleScope*:
return dom_node_style_scope(this)
# mark: Node.h: ids, observers and generic helpers ==============================================
## Ported from Node.h:400 Web::DOM::Node::unique_id.
pub func dom_node_unique_id(this: DomNode*) -> i64:
return this.m_unique_id
## Ported from Node.h:421 Web::DOM::Node::registered_observer_list.
pub func dom_node_registered_observer_list(this: DomNode*) -> (ak.Vector[DomRegisteredObserver*]*?)*:
return &this.m_registered_observer_list
## Ported from Node.h:422 Web::DOM::Node::registered_observer_list const.
pub func dom_node_registered_observer_list_const(this: DomNode*) -> ak.Vector[DomRegisteredObserver*]*?:
return this.m_registered_observer_list
## Ported from Node.h:439 Web::DOM::Node::for_each_child_of_type_fallible: the children of class
## `class_info`, each given to `callback` (with `context`) until it fails or answers Break.
pub func dom_node_for_each_child_of_type_fallible(this: DomNode*, class_info: const ak.ClassInfo*, callback: func(void*?, DomNode*) -> ak.IterationDecision!, context: void*?) -> !:
var node = tree_node_first_child(this)
while let child = node:
let id = child.cell().class_id
if id >= class_info.first_id and id <= class_info.last_id:
if (try callback(context, child)) == ak.IterationDecision.break_:
return
node = tree_node_next_sibling(child)
## Ported from Node.h:450 Web::DOM::Node::first_flat_tree_ancestor_of_type const: the nearest
## flat-tree ancestor of class `class_info` (the caller downcasts).
pub func dom_node_first_flat_tree_ancestor_of_type_const(this: DomNode*, class_info: const ak.ClassInfo*) -> DomNode*?:
return dom_node_first_flat_tree_ancestor_of_type(this, class_info)
## Ported from Node.h:460 Web::DOM::Node::find_in_shadow_including_ancestry: the first of this
## node and its shadow-including ancestors that `predicate` accepts.
pub func dom_node_find_in_shadow_including_ancestry(this: DomNode*, predicate: ak.Function1[DomNode*, bool]) -> DomNode*?:
var it: DomNode*? = this
while let node = it:
if ak.function1_call(&predicate, node):
return node
it = dom_node_parent_or_shadow_host_node(node)
return none
## Ported from Node.h:484 Web::DOM::Node::containing_shadow_root const.
pub func dom_node_containing_shadow_root_const(this: DomNode*) -> DomShadowRoot*?:
return dom_node_containing_shadow_root(this)