dymokomi/luce-browser-engine
Source of release 0.6.1
0.6.1 / src / web / html / validity_state.lucb
#==============================================================================================
#
# validity_state - HTML::ValidityState: the live validity states of a form control
#
# DESCRIPTION:
# Port of LibWeb/HTML/ValidityState.cpp (lines 1-115): creation, initialize, visit_edges
# and the eleven getters, each the matching "suffering from" state of the control.
#
# The C++ member is `FormAssociatedElement const&`; the port keeps the mixin pointer
# (HtmlFormAssociatedElement*) and visits the HTML element it lives in, as C++ does.
#
#==============================================================================================
# mark: Creation ================================================================================
## Ported from ValidityState.cpp:16 Web::HTML::ValidityState::create.
pub func html_validity_state_create(realm: Realm*, control: HtmlFormAssociatedElement*) -> HtmlValidityState*:
return realm_create_html_validity_state(realm, realm, control)
## Ported from ValidityState.cpp:21 Web::HTML::ValidityState::ValidityState.
pub func html_validity_state_construct(this: HtmlValidityState*, realm: Realm*, control: HtmlFormAssociatedElement*):
bind_platform_object_construct_realm(this.bind_platform_object(), realm)
this.m_control = control
## Ported from ValidityState.cpp:27 Web::HTML::ValidityState::initialize (override).
pub func html_validity_state_initialize_impl(base: JsCell*, realm: Realm*):
web_set_prototype_for_interface(base, realm, BindInterfaceName.validity_state)
# Base::initialize(realm): PlatformObject inherits JS::Object's.
js_cell_initialize_impl(base, realm)
## Ported from ValidityState.cpp:33 Web::HTML::ValidityState::visit_edges (override).
pub func html_validity_state_visit_edges_impl(base: gc.Cell*, visitor: gc.CellVisitor*):
let this = (HtmlValidityState*)base
bind_platform_object_visit_edges_impl(base, visitor)
gc.cell_visitor_visit_t[HtmlElement](visitor, html_form_associated_element_form_associated_element_to_html_element_const(this.m_control))
# mark: The validity states =====================================================================
## Ported from ValidityState.cpp:40 Web::HTML::ValidityState::value_missing.
# https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#dom-validitystate-valuemissing
pub func html_validity_state_value_missing(this: HtmlValidityState*) -> bool:
# The control is suffering from being missing.
return html_form_associated_element_suffering_from_being_missing(this.m_control)
## Ported from ValidityState.cpp:47 Web::HTML::ValidityState::type_mismatch.
# https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#dom-validitystate-typemismatch
pub func html_validity_state_type_mismatch(this: HtmlValidityState*) -> bool:
# The control is suffering from a type mismatch.
return html_form_associated_element_suffering_from_a_type_mismatch(this.m_control)
## Ported from ValidityState.cpp:54 Web::HTML::ValidityState::pattern_mismatch.
# https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#dom-validitystate-patternmismatch
pub func html_validity_state_pattern_mismatch(this: HtmlValidityState*) -> bool:
# The control is suffering from a pattern mismatch.
return html_form_associated_element_suffering_from_a_pattern_mismatch(this.m_control)
## Ported from ValidityState.cpp:61 Web::HTML::ValidityState::too_long.
# https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#dom-validitystate-toolong
pub func html_validity_state_too_long(this: HtmlValidityState*) -> bool:
# The control is suffering from being too long.
return html_form_associated_element_suffering_from_being_too_long(this.m_control)
## Ported from ValidityState.cpp:68 Web::HTML::ValidityState::too_short.
# https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#dom-validitystate-tooshort
pub func html_validity_state_too_short(this: HtmlValidityState*) -> bool:
# The control is suffering from being too short.
return html_form_associated_element_suffering_from_being_too_short(this.m_control)
## Ported from ValidityState.cpp:75 Web::HTML::ValidityState::range_underflow.
# https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#dom-validitystate-rangeunderflow
pub func html_validity_state_range_underflow(this: HtmlValidityState*) -> bool:
# The control is suffering from an underflow.
return html_form_associated_element_suffering_from_an_underflow(this.m_control)
## Ported from ValidityState.cpp:82 Web::HTML::ValidityState::range_overflow.
# https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#dom-validitystate-rangeoverflow
pub func html_validity_state_range_overflow(this: HtmlValidityState*) -> bool:
# The control is suffering from an overflow.
return html_form_associated_element_suffering_from_an_overflow(this.m_control)
## Ported from ValidityState.cpp:89 Web::HTML::ValidityState::step_mismatch.
# https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#dom-validitystate-stepmismatch
pub func html_validity_state_step_mismatch(this: HtmlValidityState*) -> bool:
# The control is suffering from a step mismatch.
return html_form_associated_element_suffering_from_a_step_mismatch(this.m_control)
## Ported from ValidityState.cpp:96 Web::HTML::ValidityState::bad_input.
# https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#dom-validitystate-badinput
pub func html_validity_state_bad_input(this: HtmlValidityState*) -> bool:
# The control is suffering from bad input.
return html_form_associated_element_suffering_from_bad_input(this.m_control)
## Ported from ValidityState.cpp:103 Web::HTML::ValidityState::custom_error.
# https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#dom-validitystate-customerror
pub func html_validity_state_custom_error(this: HtmlValidityState*) -> bool:
# The control is suffering from a custom error.
return html_form_associated_element_suffering_from_a_custom_error(this.m_control)
## Ported from ValidityState.cpp:110 Web::HTML::ValidityState::valid.
# https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#dom-validitystate-valid
pub func html_validity_state_valid(this: HtmlValidityState*) -> bool:
return not (html_validity_state_value_missing(this) or html_validity_state_type_mismatch(this) or html_validity_state_pattern_mismatch(this) or html_validity_state_too_long(this) or html_validity_state_too_short(this) or html_validity_state_range_underflow(this) or html_validity_state_range_overflow(this) or html_validity_state_step_mismatch(this) or html_validity_state_bad_input(this) or html_validity_state_custom_error(this))