dymokomi/luce-browser-engine
Source of release 0.6.1
0.6.1 / src / web / dom / element_13.lucb
#==============================================================================================
#
# element_13 - DOM::Element: the inline functions of Element.h
#
# DESCRIPTION:
# Port of the inline member functions of LibWeb/DOM/Element.h (lines 122-616 and
# 776-811), in the header's order: names and the qualified name, the trivial virtuals,
# the style and invalidation flags, the shadow root, custom element state, top layer,
# counters, structural pseudo-class flags, Node::parent_element, has_class and
# has_pseudo_element.
#
#==============================================================================================
# mark: Names ===================================================================================
## Ported from Element.h:122 Web::DOM::Element::is_dom_element (virtual).
pub func dom_element_is_dom_element_impl(this: DomElement*) -> bool:
return true
## The Element whose SlottableMixin base `base` is (C++'s implicit `this` adjustment, DESIGN.md §2.5).
func dom_element_from_slottable_mixin(base: DomSlottableMixin*) -> DomElement*:
return (DomElement*)((u8*)base - memory.offset_of(DomElement, slottable_mixin))
## Ported from Element.h:124 Web::DOM::Element::slottable_as_node (override).
pub func dom_element_slottable_as_node_impl(base: DomSlottableMixin*) -> DomNode*:
return dom_element_from_slottable_mixin(base).dom_node()
## Ported from Element.h:126 Web::DOM::Element::qualified_name.
pub func dom_element_qualified_name(this: DomElement*) -> ak.FlyString:
return dom_qualified_name_as_string(&this.m_qualified_name)
## Ported from Element.h:129 Web::DOM::Element::node_name (override).
pub func dom_element_node_name_impl(base: DomNode*) -> ak.FlyString:
return dom_element_html_uppercased_qualified_name((DomElement*)base)
## Ported from Element.h:130 Web::DOM::Element::local_name.
pub func dom_element_local_name(this: DomElement*) -> ak.FlyString:
return dom_qualified_name_local_name(&this.m_qualified_name)
## Ported from Element.h:132 Web::DOM::Element::lowercased_local_name.
pub func dom_element_lowercased_local_name(this: DomElement*) -> ak.FlyString:
return dom_qualified_name_lowercased_local_name(&this.m_qualified_name)
## Ported from Element.h:135 Web::DOM::Element::tag_name.
# NOTE: This is for the JS bindings
pub func dom_element_tag_name(this: DomElement*) -> ak.FlyString:
return dom_element_html_uppercased_qualified_name(this)
## Ported from Element.h:137 Web::DOM::Element::prefix.
pub func dom_element_prefix(this: DomElement*) -> ak.FlyString?:
return dom_qualified_name_prefix(&this.m_qualified_name)
## Ported from Element.h:144 Web::DOM::Element::namespace_uri.
# NOTE: This is for the JS bindings
pub func dom_element_namespace_uri(this: DomElement*) -> ak.FlyString?:
return dom_qualified_name_namespace(&this.m_qualified_name)
## Ported from Element.h:150 Web::DOM::Element::attribute.
pub func dom_element_attribute(this: DomElement*, name: ak.FlyString) -> ak.String?:
return dom_element_get_attribute(this, name)
## Ported from Element.h:196 Web::DOM::Element::part_names.
pub func dom_element_part_names(this: DomElement*) -> const ak.FlyString[]:
return ak.vector_span(&this.m_parts)
## Ported from Element.h:216 Web::DOM::Element::class_names.
pub func dom_element_class_names(this: DomElement*) -> ak.Vector[ak.FlyString]:
return this.m_classes
# mark: Trivial virtuals ========================================================================
## Ported from Element.h:219 Web::DOM::Element::supports_dimension_attributes (virtual).
# https://html.spec.whatwg.org/multipage/embedded-content-other.html#dimension-attributes
pub func dom_element_supports_dimension_attributes_impl(this: DomElement*) -> bool:
return false
## Ported from Element.h:221 Web::DOM::Element::is_presentational_hint (virtual).
pub func dom_element_is_presentational_hint_impl(this: DomElement*, arg0: ak.FlyString) -> bool:
return false
## Ported from Element.h:222 Web::DOM::Element::apply_presentational_hints (virtual).
pub func dom_element_apply_presentational_hints_impl(this: DomElement*, arg0: ak.Vector[CssStyleProperty]*):
return
## Ported from Element.h:229 Web::DOM::Element::use_pseudo_element.
pub func dom_element_use_pseudo_element(this: DomElement*) -> css_data.PseudoElement?:
return this.m_use_pseudo_element
## Ported from Element.h:230 Web::DOM::Element::set_use_pseudo_element.
pub func dom_element_set_use_pseudo_element(this: DomElement*, use_pseudo_element: css_data.PseudoElement?):
this.m_use_pseudo_element = use_pseudo_element
## Ported from Element.h:247 Web::DOM::Element::inline_style.
pub func dom_element_inline_style(this: DomElement*) -> CssStyleProperties*?:
return this.m_inline_style
## Ported from Element.h:248 Web::DOM::Element::inline_style.
pub func dom_element_inline_style_const(this: DomElement*) -> CssStyleProperties*?:
return this.m_inline_style
## Ported from Element.h:279 Web::DOM::Element::set_fullscreen_flag.
pub func dom_element_set_fullscreen_flag(this: DomElement*, is_fullscreen: bool):
this.m_fullscreen_flag = is_fullscreen
## Ported from Element.h:280 Web::DOM::Element::is_fullscreen_element.
pub func dom_element_is_fullscreen_element(this: DomElement*) -> bool:
return this.m_fullscreen_flag
## Ported from Element.h:301 Web::DOM::Element::shadow_root.
pub func dom_element_shadow_root(this: DomElement*) -> DomShadowRoot*?:
return this.m_shadow_root
## Ported from Element.h:302 Web::DOM::Element::shadow_root.
pub func dom_element_shadow_root_const(this: DomElement*) -> DomShadowRoot*?:
return this.m_shadow_root
# mark: Style function flags ====================================================================
## Ported from Element.h:308 Web::DOM::Element::style_uses_attr_css_function.
pub func dom_element_style_uses_attr_css_function(this: DomElement*) -> bool:
return this.m_style_uses_attr_css_function
## Ported from Element.h:309 Web::DOM::Element::set_style_uses_attr_css_function.
pub func dom_element_set_style_uses_attr_css_function(this: DomElement*):
this.m_style_uses_attr_css_function = true
## Ported from Element.h:310 Web::DOM::Element::style_uses_var_css_function.
pub func dom_element_style_uses_var_css_function(this: DomElement*) -> bool:
return this.m_style_uses_var_css_function
## Ported from Element.h:311 Web::DOM::Element::set_style_uses_var_css_function.
pub func dom_element_set_style_uses_var_css_function(this: DomElement*):
this.m_style_uses_var_css_function = true
## Ported from Element.h:312 Web::DOM::Element::style_uses_tree_counting_function.
pub func dom_element_style_uses_tree_counting_function(this: DomElement*) -> bool:
return this.m_style_uses_tree_counting_function
## Ported from Element.h:313 Web::DOM::Element::set_style_uses_tree_counting_function.
pub func dom_element_set_style_uses_tree_counting_function(this: DomElement*):
if let parent = dom_node_parent_element(this.dom_node()):
dom_element_set_child_style_uses_tree_counting_function(parent)
this.m_style_uses_tree_counting_function = true
## Ported from Element.h:320 Web::DOM::Element::style_uses_if_css_function.
pub func dom_element_style_uses_if_css_function(this: DomElement*) -> bool:
return this.m_style_uses_if_css_function
## Ported from Element.h:321 Web::DOM::Element::set_style_uses_if_css_function.
pub func dom_element_set_style_uses_if_css_function(this: DomElement*):
this.m_style_uses_if_css_function = true
## Ported from Element.h:322 Web::DOM::Element::style_uses_inherit_css_function.
pub func dom_element_style_uses_inherit_css_function(this: DomElement*) -> bool:
return this.m_style_uses_inherit_css_function
## Ported from Element.h:323 Web::DOM::Element::set_style_uses_inherit_css_function.
pub func dom_element_set_style_uses_inherit_css_function(this: DomElement*):
this.m_style_uses_inherit_css_function = true
## Ported from Element.h:325 Web::DOM::Element::child_style_uses_tree_counting_function.
pub func dom_element_child_style_uses_tree_counting_function(this: DomElement*) -> bool:
return this.m_child_style_uses_tree_counting_function
## Ported from Element.h:326 Web::DOM::Element::set_child_style_uses_tree_counting_function.
pub func dom_element_set_child_style_uses_tree_counting_function(this: DomElement*):
this.m_child_style_uses_tree_counting_function = true
# mark: Layout and focus hooks ==================================================================
## Ported from Element.h:341 Web::DOM::Element::adjust_computed_style (virtual).
pub func dom_element_adjust_computed_style_impl(this: DomElement*, arg0: CssComputedProperties*):
return
## Ported from Element.h:343 Web::DOM::Element::did_receive_focus (virtual).
pub func dom_element_did_receive_focus_impl(this: DomElement*):
return
## Ported from Element.h:344 Web::DOM::Element::did_lose_focus (virtual).
pub func dom_element_did_lose_focus_impl(this: DomElement*):
return
## Ported from Element.h:351 Web::DOM::Element::clear_removed_attributes_for_style_invalidation.
pub func dom_element_clear_removed_attributes_for_style_invalidation(this: DomElement*):
ak.vector_clear(&this.m_removed_attributes_for_style_invalidation)
## `Vector<FlyString>::contains_slow(name)`.
func dom_element_fly_strings_contain(names: const ak.Vector[ak.FlyString]*, name: ak.FlyString) -> bool:
for i in 0..<ak.vector_size(names):
if ak.fly_string_eq_fly_string(ak.vector_at_const(names, i), &name):
return true
return false
## Ported from Element.h:352 Web::DOM::Element::has_removed_attribute_for_style_invalidation.
pub func dom_element_has_removed_attribute_for_style_invalidation(this: DomElement*, attribute_name: ak.FlyString) -> bool:
return dom_element_fly_strings_contain(&this.m_removed_attributes_for_style_invalidation, attribute_name)
## Ported from Element.h:356 Web::DOM::Element::remember_removed_attribute_for_style_invalidation.
pub func dom_element_remember_removed_attribute_for_style_invalidation(this: DomElement*, attribute_name: ak.FlyString):
if not dom_element_fly_strings_contain(&this.m_removed_attributes_for_style_invalidation, attribute_name):
ak.vector_append_t(&this.m_removed_attributes_for_style_invalidation, attribute_name)
## Ported from Element.h:408 Web::DOM::Element::to_element (override).
pub func dom_element_to_element_impl(base: AriaMixin*) -> DomElement*:
return dom_element_from_aria_mixin(base)
## Ported from Element.h:409 Web::DOM::Element::to_element (override).
pub func dom_element_to_element_const_impl(base: AriaMixin*) -> DomElement*:
return dom_element_from_aria_mixin(base)
# mark: Custom elements =========================================================================
## Ported from Element.h:421 Web::DOM::Element::custom_element_reaction_queue.
pub func dom_element_custom_element_reaction_queue(this: DomElement*) -> ak.Vector[DomCustomElementUpgradeReactionOrDomCustomElementCallbackReaction]*?:
return this.m_custom_element_reaction_queue
## Ported from Element.h:422 Web::DOM::Element::custom_element_reaction_queue.
pub func dom_element_custom_element_reaction_queue_const(this: DomElement*) -> const ak.Vector[DomCustomElementUpgradeReactionOrDomCustomElementCallbackReaction]*?:
return this.m_custom_element_reaction_queue
## Ported from Element.h:425 Web::DOM::Element::custom_state_set.
pub func dom_element_custom_state_set(this: DomElement*) -> HtmlCustomStateSet*?:
return this.m_custom_state_set
## Ported from Element.h:434 Web::DOM::Element::is_value.
pub func dom_element_is_value(this: DomElement*) -> ak.String?:
return this.m_is_value
## Ported from Element.h:435 Web::DOM::Element::set_is_value.
pub func dom_element_set_is_value(this: DomElement*, is_: ak.String?):
this.m_is_value = is_
# mark: Direction, ids and the top layer ========================================================
## Ported from Element.h:464 Web::DOM::Element::dir.
pub func dom_element_dir(this: DomElement*) -> DomElementDir?:
return this.m_dir
## Ported from Element.h:473 Web::DOM::Element::id.
pub func dom_element_id(this: DomElement*) -> ak.FlyString?:
return this.m_id
## Ported from Element.h:474 Web::DOM::Element::name.
pub func dom_element_name(this: DomElement*) -> ak.FlyString?:
return this.m_name
## Ported from Element.h:476 Web::DOM::Element::take_lazy_load_resumption_steps (virtual).
pub func dom_element_take_lazy_load_resumption_steps_impl(this: DomElement*) -> gc.Function0[unit]*?:
return none
## Ported from Element.h:483 Web::DOM::Element::set_in_top_layer.
# An element el is in the top layer if el is contained in its node document’s top layer
# but not contained in its node document’s pending top layer removals.
pub func dom_element_set_in_top_layer(this: DomElement*, in_top_layer: bool):
this.m_in_top_layer = in_top_layer
## Ported from Element.h:484 Web::DOM::Element::in_top_layer.
pub func dom_element_in_top_layer(this: DomElement*) -> bool:
return this.m_in_top_layer
## Ported from Element.h:488 Web::DOM::Element::set_rendered_in_top_layer.
# An element el is rendered in the top layer if el is contained in its node document’s top layer,
# FIXME: and el has overlay: auto.
pub func dom_element_set_rendered_in_top_layer(this: DomElement*, rendered_in_top_layer: bool):
this.m_rendered_in_top_layer = rendered_in_top_layer
## Ported from Element.h:489 Web::DOM::Element::rendered_in_top_layer.
pub func dom_element_rendered_in_top_layer(this: DomElement*) -> bool:
return this.m_rendered_in_top_layer
## Ported from Element.h:491 Web::DOM::Element::has_non_empty_counters_set.
pub func dom_element_has_non_empty_counters_set(this: DomElement*) -> bool:
return this.m_counters_set != none
## Ported from Element.h:496 Web::DOM::Element::proximity_to_the_viewport.
pub func dom_element_proximity_to_the_viewport(this: DomElement*) -> DomProximityToTheViewport:
return this.m_proximity_to_the_viewport
# mark: Structural pseudo-class flags ===========================================================
## Ported from Element.h:511 Web::DOM::Element::affected_by_has_pseudo_class_in_subject_position.
pub func dom_element_affected_by_has_pseudo_class_in_subject_position(this: DomElement*) -> bool:
return this.m_affected_by_has_pseudo_class_in_subject_position
## Ported from Element.h:512 Web::DOM::Element::set_affected_by_has_pseudo_class_in_subject_position.
pub func dom_element_set_affected_by_has_pseudo_class_in_subject_position(this: DomElement*, value: bool):
this.m_affected_by_has_pseudo_class_in_subject_position = value
## Ported from Element.h:514 Web::DOM::Element::affected_by_has_pseudo_class_in_non_subject_position.
pub func dom_element_affected_by_has_pseudo_class_in_non_subject_position(this: DomElement*) -> bool:
return this.m_affected_by_has_pseudo_class_in_non_subject_position
## Ported from Element.h:515 Web::DOM::Element::set_affected_by_has_pseudo_class_in_non_subject_position.
pub func dom_element_set_affected_by_has_pseudo_class_in_non_subject_position(this: DomElement*, value: bool):
this.m_affected_by_has_pseudo_class_in_non_subject_position = value
## Ported from Element.h:517 Web::DOM::Element::affected_by_has_pseudo_class_with_relative_selector_that_has_sibling_combinator.
pub func dom_element_affected_by_has_pseudo_class_with_relative_selector_that_has_sibling_combinator(this: DomElement*) -> bool:
return this.m_affected_by_has_pseudo_class_with_relative_selector_that_has_sibling_combinator
## Ported from Element.h:518 Web::DOM::Element::set_affected_by_has_pseudo_class_with_relative_selector_that_has_sibling_combinator.
pub func dom_element_set_affected_by_has_pseudo_class_with_relative_selector_that_has_sibling_combinator(this: DomElement*, value: bool):
this.m_affected_by_has_pseudo_class_with_relative_selector_that_has_sibling_combinator = value
## Ported from Element.h:523 Web::DOM::Element::in_subtree_of_has_pseudo_class_relative_selector_with_sibling_combinator.
# Set on any element reached by stepping through a + or ~ combinator while
# matching a :has() argument. Lets generic invalidation defer ancestor
# sibling scans until it reaches the sibling subtree root. Write-once,
# intentionally never cleared.
pub func dom_element_in_subtree_of_has_pseudo_class_relative_selector_with_sibling_combinator(this: DomElement*) -> bool:
return this.m_in_subtree_of_has_pseudo_class_relative_selector_with_sibling_combinator
## Ported from Element.h:524 Web::DOM::Element::set_in_subtree_of_has_pseudo_class_relative_selector_with_sibling_combinator.
pub func dom_element_set_in_subtree_of_has_pseudo_class_relative_selector_with_sibling_combinator(this: DomElement*, value: bool):
this.m_in_subtree_of_has_pseudo_class_relative_selector_with_sibling_combinator = value
## Ported from Element.h:530 Web::DOM::Element::in_has_scope.
# Set on any element that was traversed during matching of a :has() argument
# selector (i.e. the descendant/child/sibling walk inside :has()). Lets the
# invalidation walker terminate once it reaches an element whose state cannot
# affect any :has() anchor. Write-once, intentionally never cleared.
pub func dom_element_in_has_scope(this: DomElement*) -> bool:
return this.m_in_has_scope
## Ported from Element.h:531 Web::DOM::Element::set_in_has_scope.
pub func dom_element_set_in_has_scope(this: DomElement*, value: bool):
this.m_in_has_scope = value
## Ported from Element.h:533 Web::DOM::Element::affected_by_direct_sibling_combinator.
pub func dom_element_affected_by_direct_sibling_combinator(this: DomElement*) -> bool:
return this.m_affected_by_direct_sibling_combinator
## Ported from Element.h:534 Web::DOM::Element::set_affected_by_direct_sibling_combinator.
pub func dom_element_set_affected_by_direct_sibling_combinator(this: DomElement*, value: bool):
this.m_affected_by_direct_sibling_combinator = value
## Ported from Element.h:536 Web::DOM::Element::affected_by_indirect_sibling_combinator.
pub func dom_element_affected_by_indirect_sibling_combinator(this: DomElement*) -> bool:
return this.m_affected_by_indirect_sibling_combinator
## Ported from Element.h:537 Web::DOM::Element::set_affected_by_indirect_sibling_combinator.
pub func dom_element_set_affected_by_indirect_sibling_combinator(this: DomElement*, value: bool):
this.m_affected_by_indirect_sibling_combinator = value
## Ported from Element.h:539 Web::DOM::Element::affected_by_first_child_pseudo_class.
pub func dom_element_affected_by_first_child_pseudo_class(this: DomElement*) -> bool:
return this.m_affected_by_first_child_pseudo_class
## Ported from Element.h:540 Web::DOM::Element::set_affected_by_first_child_pseudo_class.
pub func dom_element_set_affected_by_first_child_pseudo_class(this: DomElement*, value: bool):
this.m_affected_by_first_child_pseudo_class = value
## Ported from Element.h:542 Web::DOM::Element::affected_by_last_child_pseudo_class.
pub func dom_element_affected_by_last_child_pseudo_class(this: DomElement*) -> bool:
return this.m_affected_by_last_child_pseudo_class
## Ported from Element.h:545 Web::DOM::Element::affected_by_forward_positional_pseudo_class.
pub func dom_element_affected_by_forward_positional_pseudo_class(this: DomElement*) -> bool:
return this.m_affected_by_forward_positional_pseudo_class
## Ported from Element.h:546 Web::DOM::Element::set_affected_by_forward_positional_pseudo_class.
pub func dom_element_set_affected_by_forward_positional_pseudo_class(this: DomElement*, value: bool):
this.m_affected_by_forward_positional_pseudo_class = value
## Ported from Element.h:548 Web::DOM::Element::affected_by_backward_positional_pseudo_class.
pub func dom_element_affected_by_backward_positional_pseudo_class(this: DomElement*) -> bool:
return this.m_affected_by_backward_positional_pseudo_class
## Ported from Element.h:553 Web::DOM::Element::affected_by_structural_pseudo_class_in_non_subject_position.
# Write-once: this can be set while matching descendants, and recomputing this element's own style may not revisit
# those descendant selectors. Keeping it sticky is conservative and avoids stale descendant style after moves.
pub func dom_element_affected_by_structural_pseudo_class_in_non_subject_position(this: DomElement*) -> bool:
return this.m_affected_by_structural_pseudo_class_in_non_subject_position
## Ported from Element.h:554 Web::DOM::Element::set_affected_by_structural_pseudo_class_in_non_subject_position.
pub func dom_element_set_affected_by_structural_pseudo_class_in_non_subject_position(this: DomElement*):
this.m_affected_by_structural_pseudo_class_in_non_subject_position = true
## Ported from Element.h:558 Web::DOM::Element::affected_by_sibling_combinator_in_non_subject_position.
# Write-once: this can be set while matching descendants, and recomputing this element's own style may not revisit
# those descendant selectors. Keeping it sticky is conservative and avoids stale descendant style after moves.
pub func dom_element_affected_by_sibling_combinator_in_non_subject_position(this: DomElement*) -> bool:
return this.m_affected_by_sibling_combinator_in_non_subject_position
## Ported from Element.h:559 Web::DOM::Element::set_affected_by_sibling_combinator_in_non_subject_position.
pub func dom_element_set_affected_by_sibling_combinator_in_non_subject_position(this: DomElement*):
this.m_affected_by_sibling_combinator_in_non_subject_position = true
## Ported from Element.h:561 Web::DOM::Element::sibling_invalidation_distance.
pub func dom_element_sibling_invalidation_distance(this: DomElement*) -> usize:
return this.m_sibling_invalidation_distance
## Ported from Element.h:562 Web::DOM::Element::set_sibling_invalidation_distance.
pub func dom_element_set_sibling_invalidation_distance(this: DomElement*, value: usize):
this.m_sibling_invalidation_distance = value
## Ported from Element.h:564 Web::DOM::Element::affected_by_forward_structural_changes.
pub func dom_element_affected_by_forward_structural_changes(this: DomElement*) -> bool:
return dom_element_affected_by_direct_sibling_combinator(this) or dom_element_affected_by_indirect_sibling_combinator(this) or dom_element_affected_by_first_child_pseudo_class(this) or dom_element_affected_by_forward_positional_pseudo_class(this)
## Ported from Element.h:569 Web::DOM::Element::affected_by_backward_structural_changes.
pub func dom_element_affected_by_backward_structural_changes(this: DomElement*) -> bool:
return dom_element_affected_by_last_child_pseudo_class(this) or dom_element_affected_by_backward_positional_pseudo_class(this)
# mark: View transitions, scripts and registries ================================================
## Ported from Element.h:579 Web::DOM::Element::captured_in_a_view_transition.
pub func dom_element_captured_in_a_view_transition(this: DomElement*) -> bool:
return this.m_captured_in_a_view_transition
## Ported from Element.h:580 Web::DOM::Element::set_captured_in_a_view_transition.
pub func dom_element_set_captured_in_a_view_transition(this: DomElement*, value: bool):
this.m_captured_in_a_view_transition = value
## Ported from Element.h:595 Web::DOM::Element::contributes_a_script_blocking_style_sheet (virtual).
pub func dom_element_contributes_a_script_blocking_style_sheet_impl(this: DomElement*) -> bool:
return false
## Ported from Element.h:598 Web::DOM::Element::had_duplicate_attribute_during_tokenization.
pub func dom_element_had_duplicate_attribute_during_tokenization(this: DomElement*) -> bool:
return this.m_had_duplicate_attribute_during_tokenization
## Ported from Element.h:609 Web::DOM::Element::is_implicitly_potentially_render_blocking (virtual).
# https://html.spec.whatwg.org/multipage/urls-and-fetching.html#implicitly-potentially-render-blocking
pub func dom_element_is_implicitly_potentially_render_blocking_impl(this: DomElement*) -> bool:
return false
## Ported from Element.h:615 Web::DOM::Element::custom_element_registry.
pub func dom_element_custom_element_registry(this: DomElement*) -> HtmlCustomElementRegistry*?:
return this.m_custom_element_registry
## Ported from Element.h:616 Web::DOM::Element::set_custom_element_registry.
pub func dom_element_set_custom_element_registry(this: DomElement*, registry: HtmlCustomElementRegistry*?):
this.m_custom_element_registry = registry
## Ported from Element.h:632 Web::DOM::Element::computed_properties_changed (virtual).
pub func dom_element_computed_properties_changed_impl(this: DomElement*):
return
## Ported from Element.h:638 Web::DOM::Element::custom_element_state.
pub func dom_element_custom_element_state(this: DomElement*) -> DomCustomElementState:
return this.m_custom_element_state
## Ported from Element.h:639 Web::DOM::Element::custom_element_definition.
pub func dom_element_custom_element_definition(this: DomElement*) -> HtmlCustomElementDefinition*?:
return this.m_custom_element_definition
# mark: Node::parent_element, has_class, has_pseudo_element ====================================
## Ported from Element.h:779 Web::DOM::Node::parent_element.
pub func dom_node_parent_element(this: DomNode*) -> DomElement*?:
let parent = tree_node_parent(this) else return none
return as_if_dom_element(parent)
## Ported from Element.h:784 Web::DOM::Node::parent_element.
pub func dom_node_parent_element_const(this: DomNode*) -> DomElement*?:
let parent = tree_node_parent(this) else return none
return as_if_dom_element(parent)
## Ported from Element.h:789 Web::DOM::Element::has_class.
pub func dom_element_has_class(this: DomElement*, class_name: ak.FlyString, case_sensitivity: ak.CaseSensitivity = ak.CaseSensitivity.case_sensitive) -> bool:
if case_sensitivity == ak.CaseSensitivity.case_sensitive:
# any_of(m_classes, [&](auto& it) { return it == class_name; })
for it in ak.vector_span(&this.m_classes):
if ak.fly_string_eq_fly_string(&it, &class_name):
return true
return false
# any_of(m_classes, [&](auto& it) { return it.equals_ignoring_ascii_case(class_name); })
for it in ak.vector_span(&this.m_classes):
if ak.fly_string_equals_ignoring_ascii_case_fly_string(&it, &class_name):
return true
return false
## Ported from Element.h:801 Web::DOM::Element::has_pseudo_element.
pub func dom_element_has_pseudo_element(this: DomElement*, type_: css_data.PseudoElement) -> bool:
let pseudo_element_data = this.m_pseudo_element_data else return false
if not css_selector_pseudo_element_selector_is_known_pseudo_element_type(type_):
return false
let pseudo_element = ak.hash_map_get_k(pseudo_element_data, type_) else return false
return dom_pseudo_element_layout_node(*pseudo_element) != none