Luce packages
LuceLuce BaseLuciaOS

dymokomi/luce-browser-engine

Source of release 0.6.1

0.6.1 / src / web / html / html_input_element_8.lucb

#==============================================================================================
#
#   html_input_element_8 - HTML::HTMLInputElement: constraint validation and the inlines
#
#   DESCRIPTION:
#       Port of LibWeb/HTML/HTMLInputElement.cpp (lines 3542-3916) and the inline functions of
#       HTMLInputElement.h: the suffering-from states of constraint validation (with the valid
#       email address regular expression, a static kept in the C heap), pickers, mutability,
#       button layout and the selection stringifier.
#
#==============================================================================================

# mark: Constraint validation ===================================================================

## Ported from HTMLInputElement.cpp:3543 Web::HTML::HTMLInputElement::suffering_from_being_missing (override).
# https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#suffering-from-being-missing
pub func html_input_element_suffering_from_being_missing_impl(base: HtmlFormAssociatedElement*) -> bool:
    let this = html_input_element_from_form_associated_element(base)
    var has_checkedness_false_for_all_elements_in_group = true
    var has_required_element_in_group = false
    match html_input_element_type_state(this):
        .checkbox:
            # https://html.spec.whatwg.org/multipage/input.html#checkbox-state-(type%3Dcheckbox)%3Asuffering-from-being-missing
            # If the element is required and its checkedness is false, then the element is suffering from being missing.
            if html_input_element_has_attribute(this, html_attribute_names_required) and not html_input_element_checked(this):
                return true
        .radio_button:
            # https://html.spec.whatwg.org/multipage/input.html#radio-button-state-(type%3Dradio)%3Asuffering-from-being-missing
            # If an element in the radio button group is required, and all of the input elements in the radio button group
            # have a checkedness that is false, then the element is suffering from being missing.
            for node in dom_node_inclusive_subtree(tree_node_root(this.dom_node())):
                let element = as_if_html_input_element(node) else continue
                if html_is_in_same_radio_button_group(this, element):
                    if html_input_element_checked(element):
                        has_checkedness_false_for_all_elements_in_group = false
                    if html_input_element_has_attribute(element, html_attribute_names_required):
                        has_required_element_in_group = true
            if has_checkedness_false_for_all_elements_in_group and has_required_element_in_group:
                return true
        .file_upload:
            # https://html.spec.whatwg.org/multipage/input.html#file-upload-state-(type%3Dfile)%3Asuffering-from-being-missing
            # If the element is required and the list of selected files is empty, then the element is suffering from being missing.
            if html_input_element_has_attribute(this, html_attribute_names_required) and file_api_file_list_length(html_input_element_files(this) else trap("VERIFY: GC::Ptr<FileList>::operator-> on null")) == 0:
                return true
        _:
            _ = has_required_element_in_group

    # https://html.spec.whatwg.org/multipage/input.html#the-required-attribute%3Asuffering-from-being-missing
    # If the element is required, and its value IDL attribute applies and is in the mode value, and the element is mutable, and the element's value is the empty
    # string, then the element is suffering from being missing.
    if html_input_element_has_attribute(this, html_attribute_names_required) and html_input_element_value_attribute_mode(this) == HtmlInputElementValueAttributeMode.value and html_input_element_is_mutable_impl(base) and html_utf16_is_empty(&this.m_value):
        return true

    return false

## `static auto regex` of valid_email_address_regex(): compiled on first use in the C heap
## (DESIGN.md ยง3.3 rule 7: it outlives every VM).
var html_valid_email_address_regex_s_regex: web_url.RegexEcmaScriptRegex*?

## Ported from HTMLInputElement.cpp:3590 Web::HTML::valid_email_address_regex.
# https://html.spec.whatwg.org/multipage/input.html#valid-e-mail-address
func html_valid_email_address_regex() -> web_url.RegexEcmaScriptRegex*:
    if let regex = html_valid_email_address_regex_s_regex:
        return regex
    let saved_atomic_allocator = ak.atomic_allocator
    ak.atomic_allocator = none
    defer ak.atomic_allocator = saved_atomic_allocator
    with memory.heap:
        html_valid_email_address_regex_s_regex = web_url.regex_ecma_script_regex_compile(ak.sv("^[a-zA-Z0-9.!#$%&'*+\\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$"), web_url.RegexEcmaScriptCompileFlags()) else trap("MUST: regex::ECMAScriptRegex::compile")
    return html_valid_email_address_regex_s_regex else trap("unreachable")

## Ported from HTMLInputElement.cpp:3599 Web::HTML::HTMLInputElement::suffering_from_a_type_mismatch (override).
# https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#suffering-from-a-type-mismatch
pub func html_input_element_suffering_from_a_type_mismatch_impl(base: HtmlFormAssociatedElement*) -> bool:
    let this = html_input_element_from_form_associated_element(base)
    let input = html_input_element_value(this)
    match html_input_element_type_state(this):
        # https://html.spec.whatwg.org/multipage/input.html#url-state-(type%3Durl)%3Asuffering-from-a-type-mismatch
        .url:
            # While the value of the element is neither the empty string nor a valid absolute URL, the element is suffering from a type mismatch.
            # AD-HOC: https://github.com/whatwg/html/issues/11083 and https://github.com/web-platform-tests/wpt/pull/51011
            #         We intentionally don't check if the value is a "valid absolute URL", because that's not what other
            #         engines actually do. So we instead just implement what matches the behavior in existing engines.
            let input_utf8 = ak.utf16_string_base_to_utf8_but_should_be_ported_to_utf16(&input.utf16_string_base)
            return not html_utf16_is_empty(&input) and web_url.parser_basic_parse(ak.string_bytes_as_string_view(&input_utf8)) == none

        # https://html.spec.whatwg.org/multipage/input.html#email-state-(type%3Demail)%3Asuffering-from-a-type-mismatch
        .email:
            # When the multiple attribute is not specified on the element: While the value of the element is neither the
            # empty string nor a single valid email address, the element is suffering from a type mismatch.
            if not html_input_element_has_attribute(this, html_attribute_names_multiple):
                return not html_utf16_is_empty(&input) and web_url.regex_ecma_script_regex_exec(html_valid_email_address_regex(), ak.utf16_string_base_utf16_view(&input.utf16_string_base), 0) != web_url.RegexMatchResult.match_

            # When the multiple attribute is specified on the element: While the value of the element is not a valid email
            # address list, the element is suffering from a type mismatch.
            # https://html.spec.whatwg.org/multipage/input.html#valid-e-mail-address-list
            # A valid email address list is a set of comma-separated tokens, where each token is itself a valid email
            # address. To obtain the list of tokens from a valid email address list, an implementation must split the
            # string on commas.
            var valid = true

            var addresses = ak.utf16_string_base_split_view_u16(&input.utf16_string_base, (u16)',', ak.SplitBehavior.nothing)
            for address in ak.vector_span(&addresses):
                if web_url.regex_ecma_script_regex_exec(html_valid_email_address_regex(), address, 0) == web_url.RegexMatchResult.match_:
                    continue

                valid = false
                break

            return not valid

        _:
            _ = input

    return false

## Ported from HTMLInputElement.cpp:3645 Web::HTML::HTMLInputElement::suffering_from_a_pattern_mismatch (override).
# https://html.spec.whatwg.org/multipage/input.html#the-pattern-attribute%3Asuffering-from-a-pattern-mismatch
pub func html_input_element_suffering_from_a_pattern_mismatch_impl(base: HtmlFormAssociatedElement*) -> bool:
    let this = html_input_element_from_form_associated_element(base)
    # If the element's value is not the empty string, and either the element's multiple attribute is not specified or
    # it does not apply to the input element given its type attribute's current state, and the element has a compiled
    # pattern regular expression but that regular expression does not match the element's value, then the element is
    # suffering from a pattern mismatch.

    # If the element's value is not the empty string, and the element's multiple attribute is specified and applies to
    # the input element, and the element has a compiled pattern regular expression but that regular expression does not
    # match each of the element's values, then the element is suffering from a pattern mismatch.

    if not html_input_element_pattern_applies(this):
        return false

    let value = html_input_element_value(this)
    if html_utf16_is_empty(&value):
        return false

    let regexp_object = html_input_element_compiled_pattern_regular_expression(this) else return false

    if html_input_element_has_attribute(this, html_attribute_names_multiple) and html_input_element_multiple_applies(this):
        assert(html_input_element_type_state(this) == HtmlInputElementTypeAttributeState.email)
        var valid = true

        var tokens = ak.utf16_string_base_split_view_u16(&value.utf16_string_base, (u16)',', ak.SplitBehavior.nothing)
        for token in ak.vector_span(&tokens):
            if web_url.regex_ecma_script_regex_exec(regexp_object, token, 0) == web_url.RegexMatchResult.match_:
                continue

            valid = false
            break

        return not valid

    return web_url.regex_ecma_script_regex_exec(regexp_object, ak.utf16_string_base_utf16_view(&value.utf16_string_base), 0) != web_url.RegexMatchResult.match_

## Ported from HTMLInputElement.cpp:3686 Web::HTML::HTMLInputElement::suffering_from_an_underflow (override).
# https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#suffering-from-an-underflow
pub func html_input_element_suffering_from_an_underflow_impl(base: HtmlFormAssociatedElement*) -> bool:
    let this = html_input_element_from_form_associated_element(base)
    # and the result of applying the algorithm to convert a string to a number to the string given by the element's
    # value is a number
    let number = html_input_element_convert_string_to_number_utf16_string(this, html_input_element_value(this)) else return false
    return html_input_element_is_number_underflowing(this, number)

## Ported from HTMLInputElement.cpp:3697 Web::HTML::HTMLInputElement::is_number_underflowing.
func html_input_element_is_number_underflowing(this: HtmlInputElement*, number: f64) -> bool:
    # https://html.spec.whatwg.org/multipage/input.html#the-min-and-max-attributes%3Asuffering-from-an-underflow-2
    # When the element has a minimum and does not have a reversed range,
    let minimum = html_input_element_min(this)
    if minimum != none and not html_input_element_has_reversed_range(this):
        # and the number obtained from that algorithm is less than the minimum, the element is suffering from an underflow.
        return number < (minimum else trap("unreachable"))

    let minimum_value = minimum else return false
    let maximum = html_input_element_max(this) else return false
    # https://html.spec.whatwg.org/multipage/input.html#the-min-and-max-attributes%3Asuffering-from-an-underflow-3
    # When an element has a reversed range, and the number obtained from that algorithm is more than the maximum and
    # less than the minimum, the element is simultaneously suffering from an underflow and suffering from an overflow.
    return html_input_element_has_reversed_range(this) and number > maximum and number < minimum_value

## Ported from HTMLInputElement.cpp:3719 Web::HTML::HTMLInputElement::suffering_from_an_overflow (override).
# https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#suffering-from-an-overflow
pub func html_input_element_suffering_from_an_overflow_impl(base: HtmlFormAssociatedElement*) -> bool:
    let this = html_input_element_from_form_associated_element(base)
    # and the result of applying the algorithm to convert a string to a number to the string given by the element's
    # value is a number
    let number = html_input_element_convert_string_to_number_utf16_string(this, html_input_element_value(this)) else return false
    return html_input_element_is_number_overflowing(this, number)

## Ported from HTMLInputElement.cpp:3730 Web::HTML::HTMLInputElement::is_number_overflowing.
func html_input_element_is_number_overflowing(this: HtmlInputElement*, number: f64) -> bool:
    let maximum = html_input_element_max(this)
    # https://html.spec.whatwg.org/multipage/input.html#the-min-and-max-attributes%3Asuffering-from-an-overflow-2
    # When the element has a maximum and does not have a reversed range,
    if maximum != none and not html_input_element_has_reversed_range(this):
        # and the number obtained from that algorithm is more than the maximum, the element is suffering from an overflow.
        return number > (maximum else trap("unreachable"))

    let maximum_value = maximum else return false
    let minimum = html_input_element_min(this) else return false
    # https://html.spec.whatwg.org/multipage/input.html#the-min-and-max-attributes%3Asuffering-from-an-underflow-3
    # When an element has a reversed range, and the number obtained from that algorithm is more than the maximum and
    # less than the minimum, the element is simultaneously suffering from an underflow and suffering from an overflow.
    return html_input_element_has_reversed_range(this) and number > maximum_value and number < minimum

## Ported from HTMLInputElement.cpp:3752 Web::HTML::HTMLInputElement::suffering_from_a_step_mismatch (override).
# https://html.spec.whatwg.org/multipage/input.html#the-step-attribute%3Asuffering-from-a-step-mismatch
pub func html_input_element_suffering_from_a_step_mismatch_impl(base: HtmlFormAssociatedElement*) -> bool:
    let this = html_input_element_from_form_associated_element(base)
    # and the result of applying the algorithm to convert a string to a number to the string given by the element's
    # value is a number,
    let number = html_input_element_convert_string_to_number_utf16_string(this, html_input_element_value(this)) else return false
    return html_input_element_is_number_mismatching_step(this, number)

## Ported from HTMLInputElement.cpp:3763 Web::HTML::HTMLInputElement::is_number_mismatching_step.
func html_input_element_is_number_mismatching_step(this: HtmlInputElement*, number: f64) -> bool:
    # When the element has an allowed value step,
    let allowed_value_step = html_input_element_allowed_value_step(this) else return false
    # and that number subtracted from the step base is not an integral multiple of the allowed value step, the element
    # is suffering from a step mismatch.
    return not is_integral_multiple(html_input_element_step_base(this) - number, allowed_value_step)

## Ported from HTMLInputElement.cpp:3776 Web::HTML::HTMLInputElement::suffering_from_bad_input (override).
# https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#suffering-from-bad-input
pub func html_input_element_suffering_from_bad_input_impl(base: HtmlFormAssociatedElement*) -> bool:
    let this = html_input_element_from_form_associated_element(base)
    match html_input_element_type_state(this):
        .email:
            # https://html.spec.whatwg.org/multipage/input.html#email-state-(type%3Demail)%3Asuffering-from-bad-input
            # While the user interface is representing input that the user agent cannot convert to punycode, the control is suffering from bad input.
            # FIXME: Implement this.

            # https://html.spec.whatwg.org/multipage/input.html#email-state-(type%3Demail)%3Asuffering-from-bad-input-2
            # While the user interface describes a situation where an individual value contains a U+002C COMMA (,) or is representing input that the user agent
            # cannot convert to punycode, the control is suffering from bad input.
            # FIXME: Implement this.
            _ = this
        .date:
            # https://html.spec.whatwg.org/multipage/input.html#date-state-(type%3Ddate)%3Asuffering-from-bad-input
            # While the user interface describes input that the user agent cannot convert to a valid date string, the control is suffering from bad input.
            # FIXME: Implement this.
            _ = this
        .month:
            # https://html.spec.whatwg.org/multipage/input.html#month-state-(type%3Dmonth)%3Asuffering-from-bad-input
            # While the user interface describes input that the user agent cannot convert to a valid month string, the control is suffering from bad input.
            # FIXME: Implement this.
            _ = this
        .week:
            # https://html.spec.whatwg.org/multipage/input.html#week-state-(type%3Dweek)%3Asuffering-from-bad-input
            # While the user interface describes input that the user agent cannot convert to a valid week string, the control is suffering from bad input.
            # FIXME: Implement this.
            _ = this
        .time:
            # https://html.spec.whatwg.org/multipage/#time-state-(type=time):suffering-from-bad-input
            # While the user interface describes input that the user agent cannot convert to a valid time string, the control is suffering from bad input.
            # FIXME: Implement this.
            _ = this
        .local_date_and_time:
            # https://html.spec.whatwg.org/multipage/input.html#local-date-and-time-state-(type%3Ddatetime-local)%3Asuffering-from-bad-input
            # While the user interface describes input that the user agent cannot convert to a valid normalized local date and time string, the control is suffering from bad
            # input.
            # FIXME: Implement this.
            _ = this
        .number:
            # https://html.spec.whatwg.org/multipage/input.html#number-state-(type%3Dnumber)%3Asuffering-from-bad-input
            # While the user interface describes input that the user agent cannot convert to a valid floating-point number, the control is suffering from bad input.
            # FIXME: Implement this.
            _ = this
        .range:
            # https://html.spec.whatwg.org/multipage/input.html#range-state-(type%3Drange)%3Asuffering-from-bad-input
            # While the user interface describes input that the user agent cannot convert to a valid floating-point number, the control is suffering from bad input.
            # FIXME: Implement this.
            _ = this
        .color:
            # https://html.spec.whatwg.org/multipage/input.html#color-state-(type%3Dcolor)%3Asuffering-from-bad-input
            # While the element's value is not the empty string and parsing it returns failure, the control is suffering from bad input.
            # FIXME: Implement this.
            _ = this
        _:
            _ = this
    return false

# mark: Pickers, mutability, layout and the stringifier =========================================

## Ported from HTMLInputElement.cpp:3837 Web::HTML::HTMLInputElement::supports_a_picker.
# https://html.spec.whatwg.org/multipage/input.html#input-support-picker
pub func html_input_element_supports_a_picker(this: HtmlInputElement*) -> bool:
    # The input element can support a picker. A picker is a user interface element that allows the end user to choose a value.
    # Whether an input element supports a picker depends on the type attribute state and implementation-defined behavior.
    # An input element must support a picker when its type attribute is in the File Upload state.
    let type_state = html_input_element_type_state(this)
    return type_state == HtmlInputElementTypeAttributeState.file_upload or type_state == HtmlInputElementTypeAttributeState.color

## Ported from HTMLInputElement.cpp:3845 Web::HTML::HTMLInputElement::set_is_open.
pub func html_input_element_set_is_open(this: HtmlInputElement*, is_open: bool):
    if is_open == this.m_is_open:
        return

    this.m_is_open = is_open
    css_invalidation_invalidate_style_after_input_open_state_change(this.dom_element())

## Ported from HTMLInputElement.cpp:3854 Web::HTML::HTMLInputElement::is_mutable (override).
pub func html_input_element_is_mutable_impl(base: HtmlFormAssociatedElement*) -> bool:
    let this = html_input_element_from_form_associated_element(base)
    # https://html.spec.whatwg.org/multipage/input.html#the-input-element:concept-fe-mutable-3
    # A select element that is not disabled is mutable.
    # https://html.spec.whatwg.org/multipage/input.html#the-readonly-attribute:concept-fe-mutable
    # The readonly attribute is a boolean attribute that controls whether or not the user can edit the form control. When specified, the element is not mutable.
    return html_form_associated_element_enabled(base) and not (html_input_element_has_attribute(this, html_attribute_names_readonly) and html_input_element_is_allowed_to_be_readonly(this))

## Ported from HTMLInputElement.cpp:3867 Web::HTML::HTMLInputElement::uses_button_layout (override).
# https://html.spec.whatwg.org/multipage/rendering.html#button-layout
pub func html_input_element_uses_button_layout_impl(base: HtmlElement*) -> bool:
    let this = (HtmlInputElement*)base
    # https://html.spec.whatwg.org/multipage/rendering.html#the-input-element-as-a-button:button-layout-2
    # An input element whose type attribute is in the Submit Button, Reset Button, or Button state, when it generates a
    # CSS box, is expected to depict a button and use button layout [..]

    # https://html.spec.whatwg.org/multipage/rendering.html#the-input-element-as-a-colour-well:button-layout-2
    # The element, when it generates a CSS box, is expected to use button layout, that has no child boxes of the
    # anonymous button content box.

    # https://html.spec.whatwg.org/multipage/rendering.html#the-input-element-as-a-file-upload-control:button-layout-2
    # The button is expected to use button layout and match the '::file-selector-button' pseudo-element.

    # https://html.spec.whatwg.org/multipage/input.html#image-button-state-(type=image):concept-button
    # The element is a button, specifically a submit button.
    # NOTE: Although type=image is specified to be a submit button, that does not mean that the type attribute is
    #       Submit Button, so we don't include ::ImageButton below.

    match html_input_element_type_state(this):
        .submit_button, .reset_button, .button, .color, .file_upload:
            return true
        _:
            return false

## Ported from HTMLInputElement.cpp:3889 Web::HTML::HTMLInputElement::selected_text_for_stringifier (override).
pub func html_input_element_selected_text_for_stringifier_impl(base: HtmlFormAssociatedTextControlElement*) -> ak.Utf16String?:
    let this = html_input_element_from_text_control(base)
    # https://w3c.github.io/selection-api/#dom-selection-stringifier
    # Used for clipboard copy and window.getSelection().toString() when this element is active.
    if not html_input_element_has_selectable_text(this):
        return none

    let start = (usize)html_form_associated_text_control_element_selection_start(base)
    let end = (usize)html_form_associated_text_control_element_selection_end(base)
    if start >= end:
        return none

    match html_input_element_type_state(this):
        .text, .search, .telephone, .url, .email:
            let relevant_value = html_form_associated_text_control_element_relevant_value(base)
            return ak.utf16_string_from_utf16(ak.utf16_string_base_substring_view_usize(&relevant_value.utf16_string_base, start, end - start))

        .password:
            return ak.utf16_string_repeated(0x2022, end - start)  # 0x2022 is BULLET character
        _:
            return none

# mark: Inline functions of HTMLInputElement.h ==================================================

## Ported from HTMLInputElement.h:62 Web::HTML::HTMLInputElement::autocomplete_element_to_html_element (override).
pub func html_input_element_autocomplete_element_to_html_element_impl(base: HtmlAutocompleteElement*) -> HtmlElement*:
    return html_input_element_from_autocomplete_element(base).html_element()

## Ported from HTMLInputElement.h:78 Web::HTML::HTMLInputElement::type_state.
pub func html_input_element_type_state(this: HtmlInputElement*) -> HtmlInputElementTypeAttributeState:
    return this.m_type

## Ported from HTMLInputElement.h:81 Web::HTML::HTMLInputElement::default_value.
pub func html_input_element_default_value(this: HtmlInputElement*) -> ak.String:
    return dom_element_get_attribute_value(this.dom_element(), html_attribute_names_value)

## Ported from HTMLInputElement.h:84 Web::HTML::HTMLInputElement::form_value (override).
pub func html_input_element_form_value_impl(base: HtmlFormAssociatedElement*) -> ak.Utf16String:
    return html_input_element_value(html_input_element_from_form_associated_element(base))

## Ported from HTMLInputElement.h:89 Web::HTML::HTMLInputElement::relevant_value (override).
# https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#concept-textarea/input-relevant-value
pub func html_input_element_relevant_value_impl(base: HtmlFormAssociatedTextControlElement*) -> ak.Utf16String:
    return html_input_element_value(html_input_element_from_text_control(base))

## Ported from HTMLInputElement.h:90 Web::HTML::HTMLInputElement::set_relevant_value (override).
pub func html_input_element_set_relevant_value_impl(base: HtmlFormAssociatedTextControlElement*, value: ak.Utf16String) -> !:
    try html_input_element_set_value(html_input_element_from_text_control(base), value)

## Ported from HTMLInputElement.h:93 Web::HTML::HTMLInputElement::set_dirty_value_flag (override).
pub func html_input_element_set_dirty_value_flag_impl(base: HtmlFormAssociatedTextControlElement*, flag: bool):
    html_input_element_from_text_control(base).m_dirty_value = flag

## Ported from HTMLInputElement.h:95 Web::HTML::HTMLInputElement::user_validity.
pub func html_input_element_user_validity(this: HtmlInputElement*) -> bool:
    return this.m_user_validity

## Ported from HTMLInputElement.h:96 Web::HTML::HTMLInputElement::set_user_validity.
pub func html_input_element_set_user_validity(this: HtmlInputElement*, flag: bool):
    this.m_user_validity = flag

## Ported from HTMLInputElement.h:99 Web::HTML::HTMLInputElement::has_uncommitted_changes.
pub func html_input_element_has_uncommitted_changes(this: HtmlInputElement*) -> bool:
    return this.m_has_uncommitted_changes

## Ported from HTMLInputElement.h:104 Web::HTML::HTMLInputElement::checked.
pub func html_input_element_checked(this: HtmlInputElement*) -> bool:
    return this.m_checked

## Ported from HTMLInputElement.h:107 Web::HTML::HTMLInputElement::checked_binding.
pub func html_input_element_checked_binding(this: HtmlInputElement*) -> bool:
    return html_input_element_checked(this)

## Ported from HTMLInputElement.h:110 Web::HTML::HTMLInputElement::indeterminate.
pub func html_input_element_indeterminate(this: HtmlInputElement*) -> bool:
    return this.m_indeterminate

## Ported from HTMLInputElement.h:153 Web::HTML::HTMLInputElement::selected_coordinate.
pub func html_input_element_selected_coordinate(this: HtmlInputElement*) -> HtmlInputElementSelectedCoordinate:
    return this.m_selected_coordinate

## Ported from HTMLInputElement.h:174 Web::HTML::HTMLInputElement::is_form_associated_element (override).
pub func html_input_element_is_form_associated_element_impl(base: HtmlFormAssociatedElement*) -> bool:
    _ = base
    return true

## Ported from HTMLInputElement.h:177 Web::HTML::HTMLInputElement::is_listed (override).
# https://html.spec.whatwg.org/multipage/forms.html#category-listed
pub func html_input_element_is_listed_impl(base: HtmlFormAssociatedElement*) -> bool:
    _ = base
    return true

## Ported from HTMLInputElement.h:180 Web::HTML::HTMLInputElement::is_submittable (override).
# https://html.spec.whatwg.org/multipage/forms.html#category-submit
pub func html_input_element_is_submittable_impl(base: HtmlFormAssociatedElement*) -> bool:
    _ = base
    return true

## Ported from HTMLInputElement.h:183 Web::HTML::HTMLInputElement::is_resettable (override).
# https://html.spec.whatwg.org/multipage/forms.html#category-reset
pub func html_input_element_is_resettable_impl(base: HtmlFormAssociatedElement*) -> bool:
    _ = base
    return true

## Ported from HTMLInputElement.h:186 Web::HTML::HTMLInputElement::is_autocapitalize_and_autocorrect_inheriting (override).
# https://html.spec.whatwg.org/multipage/forms.html#category-autocapitalize
pub func html_input_element_is_autocapitalize_and_autocorrect_inheriting_impl(base: HtmlFormAssociatedElement*) -> bool:
    _ = base
    return true

## Ported from HTMLInputElement.h:208 Web::HTML::HTMLInputElement::is_labelable (override).
# https://html.spec.whatwg.org/multipage/forms.html#category-label
pub func html_input_element_is_labelable_impl(base: HtmlElement*) -> bool:
    return html_input_element_type_state((HtmlInputElement*)base) != HtmlInputElementTypeAttributeState.hidden

## Ported from HTMLInputElement.h:212 Web::HTML::HTMLInputElement::placeholder_element.
pub func html_input_element_placeholder_element(this: HtmlInputElement*) -> DomElement*?:
    return this.m_placeholder_element

## Ported from HTMLInputElement.h:213 Web::HTML::HTMLInputElement::placeholder_element (const).
pub func html_input_element_placeholder_element_const(this: HtmlInputElement*) -> DomElement*?:
    return this.m_placeholder_element

## Ported from HTMLInputElement.h:235 Web::HTML::HTMLInputElement::is_open.
pub func html_input_element_is_open(this: HtmlInputElement*) -> bool:
    return this.m_is_open

## Ported from HTMLInputElement.h:240 Web::HTML::HTMLInputElement::selection_direction_binding.
pub func html_input_element_selection_direction_binding(this: HtmlInputElement*) -> ak.String?:
    return html_form_associated_text_control_element_selection_direction(html_input_element_text_control(this))

## Ported from HTMLInputElement.h:243 Web::HTML::HTMLInputElement::text_control_to_html_element (override).
pub func html_input_element_text_control_to_html_element_impl(base: HtmlFormAssociatedTextControlElement*) -> HtmlElement*:
    return html_input_element_from_text_control(base).html_element()

## Ported from HTMLInputElement.h:245 Web::HTML::HTMLInputElement::form_associated_element_to_text_node (override).
pub func html_input_element_form_associated_element_to_text_node_impl(base: HtmlFormAssociatedTextControlElement*) -> DomText*?:
    return html_input_element_from_text_control(base).m_text_node

## Ported from HTMLInputElement.h:246 Web::HTML::HTMLInputElement::text_control_scroll_container (override).
pub func html_input_element_text_control_scroll_container_impl(base: HtmlFormAssociatedTextControlElement*) -> DomElement*?:
    return html_input_element_from_text_control(base).m_inner_text_element

## Ported from HTMLInputElement.h:249 Web::HTML::HTMLInputElement::has_periodic_domain.
# https://html.spec.whatwg.org/multipage/input.html#has-a-periodic-domain/
pub func html_input_element_has_periodic_domain(this: HtmlInputElement*) -> bool:
    return html_input_element_type_state(this) == HtmlInputElementTypeAttributeState.time

## Ported from HTMLInputElement.h:279 Web::HTML::HTMLInputElement::is_html_input_element (override).
pub func html_input_element_is_html_input_element_impl(base: DomNode*) -> bool:
    _ = base
    return true

## Ported from HTMLInputElement.h:294 Web::HTML::HTMLInputElement::supports_dimension_attributes (override).
# https://html.spec.whatwg.org/multipage/input.html#image-button-state-(type=image):dimension-attributes
pub func html_input_element_supports_dimension_attributes_impl(base: DomElement*) -> bool:
    return html_input_element_type_state((HtmlInputElement*)base) == HtmlInputElementTypeAttributeState.image_button

## Ported from HTMLInputElement.h:303 Web::HTML::HTMLInputElement::to_html_element (override).
pub func html_input_element_to_html_element_impl(base: LayoutImageProvider*) -> DomElement*?:
    return html_input_element_from_image_provider(base).dom_element()

## Ported from HTMLInputElement.h:304 Web::HTML::HTMLInputElement::current_frame_index (override).
pub func html_input_element_current_frame_index_impl(base: LayoutImageProvider*) -> usize:
    _ = base
    return 0

## Ported from HTMLInputElement.h:305 Web::HTML::HTMLInputElement::decoded_image_data (override).
pub func html_input_element_decoded_image_data_impl(base: LayoutImageProvider*) -> HtmlDecodedImageData*?:
    return html_input_element_image_data(html_input_element_from_image_provider(base))