dymokomi/luce-browser-engine
Source of release 0.6.0
0.6.0 / src / web / math_ml / math_ml_mi_element.lucb
#==============================================================================================
#
# math_ml_mi_element - MathML::MathMLMiElement: <mi> and its mathvariant presentational hint
#
# DESCRIPTION:
# Port of Libraries/LibWeb/MathML/MathMLMiElement.cpp (lines 1-42): construction (which
# moves the mixin tables to MathMLMiElement's, as C++'s vptrs move) and the mathvariant
# presentational hint.
#
# Copyright (c) 2025, Lorenz Ackermann, <me@lorenzackermann.xyz>
# SPDX-License-Identifier: BSD-2-Clause
#
#==============================================================================================
## Ported from Libraries/LibWeb/MathML/MathMLMiElement.cpp:18 Web::MathML::MathMLMiElement::MathMLMiElement.
pub func math_ml_math_ml_mi_element_construct(this: MathMlMathMlMiElement*, document: DomDocument*, qualified_name: DomQualifiedName):
math_ml_math_ml_element_construct(this.math_ml_math_ml_element(), document, qualified_name)
# The vptrs of the mixin bases move to MathMLMiElement's tables.
let element = this.math_ml_math_ml_element()
element.element.slottable_mixin.vtable = &math_ml_math_ml_mi_element_slottable_mixin_vtable
element.element.aria_mixin.vtable = &math_ml_math_ml_mi_element_aria_mixin_vtable
element.element.animatable.vtable = &math_ml_math_ml_mi_element_animatable_vtable
element.global_event_handlers.vtable = &math_ml_math_ml_mi_element_global_event_handlers_vtable
## Ported from Libraries/LibWeb/MathML/MathMLMiElement.cpp:23 Web::MathML::MathMLMiElement::is_presentational_hint (override).
pub func math_ml_math_ml_mi_element_is_presentational_hint_impl(base: DomElement*, name: ak.FlyString) -> bool:
if math_ml_math_ml_element_is_presentational_hint_impl(base, name):
return true
return html_name_is_one_of(name, [math_ml_attribute_names_mathvariant])
## Ported from Libraries/LibWeb/MathML/MathMLMiElement.cpp:30 Web::MathML::MathMLMiElement::apply_presentational_hints (override).
pub func math_ml_math_ml_mi_element_apply_presentational_hints_impl(base: DomElement*, properties: ak.Vector[CssStyleProperty]*):
math_ml_math_ml_element_apply_presentational_hints_impl(base, properties)
# https://w3c.github.io/mathml-core/#dfn-mathvariant
# The mathvariant attribute, if present, must be an ASCII case-insensitive match of normal. In that case, the user
# agent is expected to treat the attribute as a presentational hint setting the element's text-transform property
# to none. Otherwise it has no effects.
if let mathvariant = dom_element_attribute(base, math_ml_attribute_names_mathvariant):
if html_value_is_ignoring_case(mathvariant, "normal"):
html_append_keyword_hint(properties, css_data.PropertyId.text_transform, css_data.Keyword.none_)