Luce packages
LuceLuce BaseLuciaOS

dymokomi/luce-browser-engine

Source of release 0.6.0

0.6.0 / src / web / stubs / stub_closure.lucb

#==============================================================================================
#
#   stub_closure - stubs of virtual functions of classes outside the phase-1 files
#
#   DESCRIPTION:
#       Every function of the region with its generated signature and a `trap("unported:
#       ...")` body, in the donor files' order (DESIGN.md §4.5). A region agent replaces this
#       fragment with ported fragments and deletes it. Generated by the skeleton generator
#       from Ladybird at 47c82b38d0; do not edit by hand.
#
#       Donor files:
#           Libraries/LibWeb/HTML/UniversalGlobalScope.h
#           Libraries/LibWeb/HTML/WindowOrWorkerGlobalScope.h
#           Libraries/LibWeb/StorageAPI/NavigatorStorage.h
#
#==============================================================================================

## Ported from Libraries/LibWeb/HTML/UniversalGlobalScope.h:26 Web::HTML::UniversalGlobalScopeMixin::this_impl (virtual).
pub func html_universal_global_scope_mixin_this_impl_impl(this: HtmlUniversalGlobalScopeMixin*) -> DomEventTarget*:
    trap("pure virtual: Web::HTML::UniversalGlobalScopeMixin::this_impl")

## Ported from Libraries/LibWeb/HTML/UniversalGlobalScope.h:27 Web::HTML::UniversalGlobalScopeMixin::this_impl (virtual).
pub func html_universal_global_scope_mixin_this_impl_const_impl(this: HtmlUniversalGlobalScopeMixin*) -> DomEventTarget*:
    trap("pure virtual: Web::HTML::UniversalGlobalScopeMixin::this_impl")

## Ported from Libraries/LibWeb/HTML/WindowOrWorkerGlobalScope.h:34 Web::HTML::WindowOrWorkerGlobalScopeMixin::this_impl (virtual).
pub func html_window_or_worker_global_scope_mixin_this_impl_impl(this: HtmlWindowOrWorkerGlobalScopeMixin*) -> DomEventTarget*:
    trap("pure virtual: Web::HTML::WindowOrWorkerGlobalScopeMixin::this_impl")

## Ported from Libraries/LibWeb/HTML/WindowOrWorkerGlobalScope.h:35 Web::HTML::WindowOrWorkerGlobalScopeMixin::this_impl (virtual).
pub func html_window_or_worker_global_scope_mixin_this_impl_const_impl(this: HtmlWindowOrWorkerGlobalScopeMixin*) -> DomEventTarget*:
    trap("pure virtual: Web::HTML::WindowOrWorkerGlobalScopeMixin::this_impl")

## Ported from Libraries/LibWeb/StorageAPI/NavigatorStorage.h:24 Web::StorageAPI::NavigatorStorage::this_navigator_storage_object (virtual).
pub func storage_api_navigator_storage_this_navigator_storage_object_impl(this: StorageApiNavigatorStorage*) -> BindPlatformObject*:
    trap("pure virtual: Web::StorageAPI::NavigatorStorage::this_navigator_storage_object")

# mark: Declarations outside the phase-1 closure that region r15 calls ========================

## Web::HTML::CustomElementReactionNames::connectedCallback (Libraries/LibWeb/HTML/CustomElements/CustomElementReactionNames.h:15).
pub var html_custom_element_reaction_names_connected_callback: ak.FlyString

## Web::HTML::CustomElementReactionNames::disconnectedCallback (Libraries/LibWeb/HTML/CustomElements/CustomElementReactionNames.h:16).
pub var html_custom_element_reaction_names_disconnected_callback: ak.FlyString

## Web::HTML::CustomElementReactionNames::connectedMoveCallback (Libraries/LibWeb/HTML/CustomElements/CustomElementReactionNames.h:18).
pub var html_custom_element_reaction_names_connected_move_callback: ak.FlyString

## Ported from Libraries/LibWeb/HTML/CustomElements/CustomElementRegistry.cpp:536 Web::HTML::is_a_global_custom_element_registry.
## (Ported by region r26: fragment parsing reaches it with a null registry.)
# https://dom.spec.whatwg.org/#is-a-global-custom-element-registry
pub func html_is_a_global_custom_element_registry(registry: HtmlCustomElementRegistry*?) -> bool:
    # Null or a CustomElementRegistry object registry is a global custom element registry if registry is non-null and
    # registry’s is scoped is false.
    let value = registry else return false
    return not html_custom_element_registry_is_scoped(value)

## Ported from Libraries/LibWeb/HTML/XMLSerializer.cpp:132 Web::HTML::serialize_node_to_xml_string.
pub func html_serialize_node_to_xml_string(root: DomNode*, require_well_formed: HtmlRequireWellFormed) -> ak.String!:
    trap("unported: Web::HTML::serialize_node_to_xml_string")

# mark: Declarations outside the phase-1 closure that region r16 calls ========================

## Ported from Libraries/LibWeb/TrustedTypes/TrustedTypePolicy.h:77 Web::TrustedTypes::get_trusted_types_compliant_attribute_value.
pub func trusted_types_get_trusted_types_compliant_attribute_value(attribute_name: ak.FlyString, attribute_ns: ak.Utf16String?, element: DomElement*, new_value: TrustedTypesTrustedHtmlOrTrustedTypesTrustedScriptOrTrustedTypesTrustedScriptUrlOrUtf16String) -> ak.Utf16String!:
    trap("unported: Web::TrustedTypes::get_trusted_types_compliant_attribute_value")

## Ported from Libraries/LibWeb/HTML/CustomElements/CustomElementName.cpp:15 Web::HTML::is_valid_custom_element_name.
## A pure function that element creation and attachShadow need, so it is ported whole here.
# https://html.spec.whatwg.org/multipage/custom-elements.html#valid-custom-element-name
pub func html_is_valid_custom_element_name(name: ak.String) -> bool:
    # A string name is a valid custom element name if all of the following are true:
    # - name is a valid element local name;
    if not dom_is_valid_element_local_name(ak.fly_string_from_string(name)):
        return false

    # - name's 0th code point is an ASCII lower alpha;
    let code_points = ak.string_code_points(&name)
    let first = ak.utf8_view_begin(&code_points)
    if ak.utf8_code_point_iterator_done(&first) or not ak.is_ascii_lower_alpha(ak.utf8_code_point_iterator_deref(&first)):
        return false

    # - name does not contain any ASCII upper alphas;
    # - name contains a U+002D (-); and
    var contains_ascii_upper_alpha = false
    var contains_hyphen = false
    var iterator = ak.utf8_view_begin(&code_points)
    while not ak.utf8_code_point_iterator_done(&iterator):
        let code_point = ak.utf8_code_point_iterator_deref(&iterator)
        _ = ak.utf8_code_point_iterator_inc(&iterator)
        if ak.is_ascii_upper_alpha(code_point):
            contains_ascii_upper_alpha = true
            break
        if code_point == (u32)'-':
            contains_hyphen = true
    if contains_ascii_upper_alpha or not contains_hyphen:
        return false

    # - name is not one of the following:
    #   - "annotation-xml"
    #   - "color-profile"
    #   - "font-face"
    #   - "font-face-src"
    #   - "font-face-uri"
    #   - "font-face-format"
    #   - "font-face-name"
    #   - "missing-glyph"
    let reserved: str[8] = ["annotation-xml", "color-profile", "font-face", "font-face-src", "font-face-uri", "font-face-format", "font-face-name", "missing-glyph"]
    for reserved_name in reserved:
        if ak.string_eq_string_view(&name, ak.sv(reserved_name)):
            return false

    return true

## Ported from Libraries/LibWeb/HTML/CustomElements/CustomElementRegistry.cpp:507 Web::HTML::look_up_a_custom_element_definition.
## Steps 1-2 only: a registry's definition set is not ported (custom elements need scripting, phase 3).
pub func html_look_up_a_custom_element_definition(registry: HtmlCustomElementRegistry*?, namespace_: ak.FlyString?, local_name: ak.FlyString, is_: ak.String?) -> HtmlCustomElementDefinition*?:
    # 1. If registry is null, then return null.
    if registry == none:
        return none

    # 2. If namespace is not the HTML namespace, then return null.
    if not dom_node_optional_fly_string_is(namespace_, namespace_html):
        return none

    # 3. If registry's custom element definition set contains an item with name and local name both equal to
    #    localName, then return that item.
    let defining_registry = registry else trap("unreachable")
    let converted_local_name = ak.fly_string_to_string_const(&local_name)
    if let maybe_definition = html_custom_element_registry_get_definition_with_name_and_local_name(defining_registry, converted_local_name, converted_local_name):
        return maybe_definition

    # 4. If registry's custom element definition set contains an item with name equal to is and local name equal to
    #    localName, then return that item.
    # 5. Return null.

    # NB: If `is` has no value, it can never match as custom element definitions always have a name and localName
    #     (i.e. not stored as Optional<String>)
    let is_value = is_ else return none

    return html_custom_element_registry_get_definition_with_name_and_local_name(defining_registry, is_value, converted_local_name)

## Ported from Libraries/LibWeb/HTML/CustomElements/CustomElementDefinition.h Web::HTML::CustomElementDefinition::disable_shadow.
pub func html_custom_element_definition_disable_shadow(this: HtmlCustomElementDefinition*) -> bool:
    trap("unported: Web::HTML::CustomElementDefinition::disable_shadow")

## Web::TrustedTypes::TrustedTypeName (Libraries/LibWeb/TrustedTypes/TrustedTypePolicy.h:25).
pub enum TrustedTypesTrustedTypeName as i32:
    trusted_html = 0
    trusted_script = 1
    trusted_script_url = 2

## Ported from Libraries/LibWeb/TrustedTypes/TrustedTypePolicy.h:75 Web::TrustedTypes::get_trusted_type_compliant_string.
pub func trusted_types_get_trusted_type_compliant_string(expected_type: TrustedTypesTrustedTypeName, global: JsObject*, input: TrustedTypesTrustedHtmlOrTrustedTypesTrustedScriptOrTrustedTypesTrustedScriptUrlOrUtf16String, sink: TrustedTypesInjectionSink, sink_group: ak.String) -> ak.Utf16String!:
    trap("unported: Web::TrustedTypes::get_trusted_type_compliant_string")

## Ported from Libraries/LibWeb/Geometry/DOMRectList.h:22 Web::Geometry::DOMRectList::create.
pub func geometry_dom_rect_list_create(realm: Realm*, rects: ak.Vector[GeometryDomRect*?]) -> GeometryDomRectList*:
    trap("unported: Web::Geometry::DOMRectList::create")

## Ported from Libraries/LibWeb/Geometry/DOMRectList.h:26 Web::Geometry::DOMRectList::length.
## (Added by region r18 for Range::get_bounding_client_rect.)
pub func geometry_dom_rect_list_length(this: GeometryDomRectList*) -> u32:
    trap("unported: Web::Geometry::DOMRectList::length")

## Ported from Libraries/LibWeb/Geometry/DOMRectList.h:27 Web::Geometry::DOMRectList::item.
## (Added by region r18 for Range::get_bounding_client_rect.)
pub func geometry_dom_rect_list_item(this: GeometryDomRectList*, index: u32) -> GeometryDomRect*?:
    trap("unported: Web::Geometry::DOMRectList::item")

## Ported from Libraries/LibWeb/CSS/StylePropertyMap.h:19 Web::CSS::StylePropertyMap::create.
pub func css_style_property_map_create(realm: Realm*, declaration: CssStyleDeclaration*) -> CssStylePropertyMap*:
    trap("unported: Web::CSS::StylePropertyMap::create")

## Ported from Libraries/LibWeb/HTML/ScrollOptions.h:20 Web::HTML::normalize_non_finite_values (an inline helper
## of a types-only header).
# https://drafts.csswg.org/cssom-view/#normalize-non-finite-values
pub func html_normalize_non_finite_values_f64(value: f64) -> f64:
    # When asked to normalize non-finite values for a value x, if x is one of the three special floating point
    # literal values (Infinity, -Infinity or NaN), then x must be changed to the value 0. [WEBIDL]
    if math.is_infinite(value) or math.is_nan(value):
        return 0.0

    return value

## Ported from Libraries/LibWeb/HTML/ScrollOptions.h:31 Web::HTML::normalize_non_finite_values.
# https://drafts.csswg.org/cssom-view/#normalize-non-finite-values
pub func html_normalize_non_finite_values_optional(value: f64?) -> f64:
    let present = value else return 0.0
    return html_normalize_non_finite_values_f64(present)

## Web::HTML::CustomElementReactionNames::attributeChangedCallback (Libraries/LibWeb/HTML/CustomElements/CustomElementReactionNames.h).
pub var html_custom_element_reaction_names_attribute_changed_callback: ak.FlyString

## Ported from Libraries/LibWeb/HTML/CustomElements/CustomElementDefinition.h:38 Web::HTML::CustomElementDefinition::lifecycle_callbacks.
pub func html_custom_element_definition_lifecycle_callbacks(this: HtmlCustomElementDefinition*) -> const ak.OrderedHashMap[ak.FlyString, IdlCallbackType*?, ak.FlyStringTraits]*:
    trap("unported: Web::HTML::CustomElementDefinition::lifecycle_callbacks")

## Ported from Libraries/LibWeb/HTML/CustomElements/CustomElementDefinition.h:36 Web::HTML::CustomElementDefinition::observed_attributes.
pub func html_custom_element_definition_observed_attributes(this: HtmlCustomElementDefinition*) -> const ak.Vector[ak.String]*:
    trap("unported: Web::HTML::CustomElementDefinition::observed_attributes")

## `Variant<GC::Ref<DOM::Element>, AlreadyConstructedCustomElementMarker>`: an entry of a custom element
## definition's construction stack (Libraries/LibWeb/HTML/CustomElements/CustomElementDefinition.h:95).
pub enum HtmlCustomElementDefinitionConstructionStackEntry:
    dom_element(value: DomElement*)
    already_constructed_custom_element_marker

## Ported from Libraries/LibWeb/HTML/CustomElements/CustomElementDefinition.h:40 Web::HTML::CustomElementDefinition::construction_stack.
pub func html_custom_element_definition_construction_stack(this: HtmlCustomElementDefinition*) -> ak.Vector[HtmlCustomElementDefinitionConstructionStackEntry]*:
    trap("unported: Web::HTML::CustomElementDefinition::construction_stack")

## Ported from Libraries/LibWeb/HTML/CustomElements/CustomElementDefinition.h:33 Web::HTML::CustomElementDefinition::constructor.
pub func html_custom_element_definition_constructor(this: HtmlCustomElementDefinition*) -> IdlCallbackType*:
    trap("unported: Web::HTML::CustomElementDefinition::constructor")

## `TRY(completion)` on a JS::Completion: its value, or the thrown value stored as the pending exception
## (DESIGN.md §2.10). (Region r19 gave JS::Completion its phase-1 form.)
pub func js_completion_release_value(completion: JsCompletion) -> JsValue!:
    if js_completion_is_error(&completion):
        vm_set_pending_exception(vm_the(), .js_completion(completion))
        error(js_exception, "")
    return js_completion_value(&completion)

## Ported from Libraries/LibWeb/HTML/CustomElements/CustomStateSet.h Web::HTML::CustomStateSet::create.
pub func html_custom_state_set_create(realm: Realm*, element: DomElement*) -> HtmlCustomStateSet*:
    trap("unported: Web::HTML::CustomStateSet::create")

## Ported from Libraries/LibWeb/CSS/StylePropertyMapReadOnly.h Web::CSS::StylePropertyMapReadOnly::create_computed_style.
pub func css_style_property_map_read_only_create_computed_style(realm: Realm*, element: DomAbstractElement) -> CssStylePropertyMapReadOnly*:
    trap("unported: Web::CSS::StylePropertyMapReadOnly::create_computed_style")

## Ported from Libraries/LibWeb/HTML/CustomElements/CustomElementRegistry.cpp:487 Web::HTML::look_up_a_custom_element_registry.
## Pure DOM steps every element creation runs, so ported whole here.
pub func html_look_up_a_custom_element_registry(node: DomNode*) -> HtmlCustomElementRegistry*?:
    # To look up a custom element registry, given a Node object node:
    # 1. If node is an Element object, then return node's custom element registry.
    if let element = as_if_dom_element(node):
        return dom_element_custom_element_registry(element)

    # 2. If node is a ShadowRoot object, then return node's custom element registry.
    if let shadow_root = as_if_dom_shadow_root(node):
        return dom_shadow_root_custom_element_registry(shadow_root)

    # 3. If node is a Document object, then return node's custom element registry.
    if let document = as_if_dom_document(node):
        return dom_document_custom_element_registry(document)

    # 4. Return null.
    return none

## Ported from Libraries/LibWeb/HTML/CustomElements/CustomElementDefinition.h:30 Web::HTML::CustomElementDefinition::name.
pub func html_custom_element_definition_name(this: HtmlCustomElementDefinition*) -> ak.String:
    trap("unported: Web::HTML::CustomElementDefinition::name")

## Ported from Libraries/LibWeb/HTML/CustomElements/CustomElementDefinition.h:31 Web::HTML::CustomElementDefinition::local_name.
pub func html_custom_element_definition_local_name(this: HtmlCustomElementDefinition*) -> ak.String:
    trap("unported: Web::HTML::CustomElementDefinition::local_name")

## Ported from Libraries/LibWeb/HTML/WindowOrWorkerGlobalScope.h Web::HTML::WindowOrWorkerGlobalScopeMixin::report_an_exception.
pub func html_window_or_worker_global_scope_mixin_report_an_exception(this: HtmlWindowOrWorkerGlobalScopeMixin*, exception: JsValue):
    trap("unported: Web::HTML::WindowOrWorkerGlobalScopeMixin::report_an_exception")

## The JS value of the exception a failed (`T!`) step left pending (a throw completion's
## `error_value()`, DESIGN.md §2.10).
## (Region r19 gave JS::Completion its phase-1 form: the pending exception becomes a throw
## completion, whose value this is.)
pub func js_take_pending_exception_value() -> JsValue:
    let completion = vm_take_throw_completion(vm_the())
    return js_completion_value(&completion)

## `value.as_if<HTML::HTMLElement>()` on a JS::Value: the platform object a wrapper holds. Phase 3.
pub func js_value_as_if_html_element(value: JsValue) -> HtmlElement*?:
    trap("unported (P3): JS::Value::as_if<HTML::HTMLElement>")

## Ported from Libraries/LibWeb/HTML/WindowOrWorkerGlobalScope.cpp:1105 Web::HTML::WindowOrWorkerGlobalScopeMixin::run_steps_after_a_timeout.
## (Added by region r19, which calls it from AbortSignal::timeout.)
pub func html_window_or_worker_global_scope_mixin_run_steps_after_a_timeout(this: HtmlWindowOrWorkerGlobalScopeMixin*, timeout: i32, completion_step: ak.Function0[unit]):
    trap("unported: Web::HTML::WindowOrWorkerGlobalScopeMixin::run_steps_after_a_timeout")

# mark: Declarations outside the phase-1 closure that region r18 calls =================

## Web::Editing::CommandNames::delete_ (Libraries/LibWeb/Editing/CommandNames.h:20; zero until interned).
pub var editing_command_names_delete: ak.FlyString

## Web::Editing::CommandNames::forwardDelete (Libraries/LibWeb/Editing/CommandNames.h:25; zero until interned).
pub var editing_command_names_forward_delete: ak.FlyString

## Web::Editing::CommandNames::insertLineBreak (Libraries/LibWeb/Editing/CommandNames.h:31; zero until interned).
pub var editing_command_names_insert_line_break: ak.FlyString

## Web::Editing::CommandNames::insertParagraph (Libraries/LibWeb/Editing/CommandNames.h:33; zero until interned).
pub var editing_command_names_insert_paragraph: ak.FlyString

## Web::Editing::CommandNames::insertText (Libraries/LibWeb/Editing/CommandNames.h:34; zero until interned).
pub var editing_command_names_insert_text: ak.FlyString

## Web::UIEvents::InputTypes::deleteContentBackward (Libraries/LibWeb/UIEvents/InputTypes.h:15; zero until interned).
pub var ui_events_input_types_delete_content_backward: ak.FlyString

## Web::UIEvents::InputTypes::deleteContentForward (Libraries/LibWeb/UIEvents/InputTypes.h:16; zero until interned).
## (Added by region r28 for EventHandler::handle_keydown.)
pub var ui_events_input_types_delete_content_forward: ak.FlyString

## Web::UIEvents::InputTypes::insertLineBreak (Libraries/LibWeb/UIEvents/InputTypes.h:18; zero until interned).
pub var ui_events_input_types_insert_line_break: ak.FlyString

## Web::UIEvents::InputTypes::insertParagraph (Libraries/LibWeb/UIEvents/InputTypes.h:19; zero until interned).
pub var ui_events_input_types_insert_paragraph: ak.FlyString

# mark: Declarations outside the phase-1 closure that region r17 calls ========================

## `referrer.has<URL::URL>() ? referrer.get<URL::URL>() : none`.
pub func fetch_request_referrer_type_as_url(referrer: FetchRequestReferrerType) -> web_url.Url?:
    match referrer:
        .url(url): return url
        .fetch_request_referrer(_): return none

## Ported from Libraries/LibWeb/TrustedTypes/TrustedHTML.cpp Web::TrustedTypes::TrustedHTML::to_string.
pub func trusted_types_trusted_html_to_string(this: TrustedTypesTrustedHtml*) -> ak.Utf16String:
    trap("unported (P3): Web::TrustedTypes::TrustedHTML::to_string")

## Ported from Libraries/LibWeb/DOMURL/DOMURL.cpp:450 Web::DOMURL::parse (ported whole, but for the blob
## URL entry of step 4, which needs FileAPI's blob URL store: phase 2).
# https://url.spec.whatwg.org/#concept-url-parser
pub func domurl_parse(input: ak.StringView, base_url: web_url.Url? = none, encoding: ak.StringView? = none) -> web_url.Url?:
    # FIXME: We should probably have an extended version of URL::URL for LibWeb instead of standalone functions like this.

    # 1. Let url be the result of running the basic URL parser on input with base and encoding.
    var base: web_url.Url = web_url.url_empty()
    var base_pointer: const web_url.Url*? = none
    if let base_value = base_url:
        base = base_value
        base_pointer = &base
    let url = web_url.parser_basic_parse(input, base_pointer, none, none, encoding)

    # 2. If url is failure, return failure.
    let parsed = url else return none

    # 3. If url’s scheme is not "blob", return url.
    let scheme = web_url.url_scheme(&parsed)
    if not ak.string_eq_string_view(&scheme, ak.sv("blob")):
        return parsed

    # 4. Set url’s blob URL entry to the result of resolving the blob URL url, if that did not return failure, and null otherwise.
    trap("unported (P3): FileAPI::resolve_a_blob_url")

## Web::HTML::HTMLAllCollection::Scope (Libraries/LibWeb/HTML/HTMLAllCollection.h).
pub enum HtmlHtmlAllCollectionScope as i32:
    children = 0
    descendants = 1

## Ported from Libraries/LibWeb/HTML/HTMLAllCollection.cpp Web::HTML::HTMLAllCollection::create.
pub func html_html_all_collection_create(root: DomParentNode*, scope: HtmlHtmlAllCollectionScope, filter: ak.Function1[DomElement*, bool]) -> HtmlAllCollection*:
    trap("unported (P3): Web::HTML::HTMLAllCollection::create")

## Web::HTML::CustomElementReactionNames::adoptedCallback (Libraries/LibWeb/HTML/CustomElements/CustomElementReactionNames.h).
pub var html_custom_element_reaction_names_adopted_callback: ak.FlyString

## Ported from Libraries/LibWeb/UIEvents/CompositionEvent.cpp Web::UIEvents::CompositionEvent::create (the event as its DOM::Event).
pub func ui_events_composition_event_create(realm: Realm*, event_name: ak.String) -> DomEvent*:
    trap("unported (P4): Web::UIEvents::CompositionEvent::create")

## Ported from Libraries/LibWeb/HTML/DragEvent.cpp Web::HTML::DragEvent::create (the event as its DOM::Event).
pub func html_drag_event_create(realm: Realm*, event_name: ak.FlyString) -> DomEvent*:
    trap("unported (P4): Web::HTML::DragEvent::create")

## Ported from Libraries/LibWeb/HTML/MessageEvent.cpp Web::HTML::MessageEvent::create (the event as its DOM::Event).
pub func html_message_event_create(realm: Realm*, event_name: ak.String) -> DomEvent*:
    trap("unported (P4): Web::HTML::MessageEvent::create")

## Ported from Libraries/LibWeb/HTML/StorageEvent.cpp Web::HTML::StorageEvent::create (the event as its DOM::Event).
pub func html_storage_event_create(realm: Realm*, event_name: ak.FlyString) -> DomEvent*:
    trap("unported (P4): Web::HTML::StorageEvent::create")

## Ported from Libraries/LibWeb/UIEvents/TextEvent.cpp Web::UIEvents::TextEvent::create (the event as its DOM::Event).
pub func ui_events_text_event_create(realm: Realm*, event_name: ak.FlyString) -> DomEvent*:
    trap("unported (P4): Web::UIEvents::TextEvent::create")

## Web::CSS::MediaQueryListEventInit (Libraries/LibWeb/CSS/MediaQueryListEvent.h).
pub struct CssMediaQueryListEventInit:
    pub var event_init: DomEventInit
    pub var media: ak.String
    pub var matches: bool

## Ported from Libraries/LibWeb/CSS/MediaQueryListEvent.cpp Web::CSS::MediaQueryListEvent::create (the event as its DOM::Event).
pub func css_media_query_list_event_create(realm: Realm*, event_name: ak.FlyString, event_init: CssMediaQueryListEventInit) -> DomEvent*:
    trap("unported (P3): Web::CSS::MediaQueryListEvent::create")

## Web::HTML::WindowOrWorkerGlobalScopeMixin::AffectedAnyWebSockets (Libraries/LibWeb/HTML/WindowOrWorkerGlobalScope.h).
pub enum HtmlWindowOrWorkerGlobalScopeMixinAffectedAnyWebSockets as i32:
    no = 0
    yes = 1

## Web::PermissionsPolicy::Decision (Libraries/LibWeb/PermissionsPolicy/Decision.h:11).
pub enum PermissionsPolicyDecision as i32:
    enabled = 0
    disabled = 1

## Web::PermissionsPolicy::AutoplayAllowlist (Libraries/LibWeb/PermissionsPolicy/AutoplayAllowlist.h): opaque in this phase.
pub struct PermissionsPolicyAutoplayAllowlist:
    pub var opaque_: u8

## Ported from Libraries/LibWeb/PermissionsPolicy/AutoplayAllowlist.cpp Web::PermissionsPolicy::AutoplayAllowlist::the.
pub func permissions_policy_autoplay_allowlist_the() -> PermissionsPolicyAutoplayAllowlist*:
    trap("unported (P4): Web::PermissionsPolicy::AutoplayAllowlist::the")

## Ported from Libraries/LibWeb/PermissionsPolicy/AutoplayAllowlist.cpp Web::PermissionsPolicy::AutoplayAllowlist::is_allowed_for_origin.
pub func permissions_policy_autoplay_allowlist_is_allowed_for_origin(this: PermissionsPolicyAutoplayAllowlist*, document: DomDocument*, origin: web_url.Origin) -> PermissionsPolicyDecision:
    trap("unported (P4): Web::PermissionsPolicy::AutoplayAllowlist::is_allowed_for_origin")

## Ported from Libraries/LibWeb/IntersectionObserver/IntersectionObserver.cpp Web::IntersectionObserver::IntersectionObserver::unobserve.
pub func intersection_observer_intersection_observer_unobserve(this: IntersectionObserverIntersectionObserver*, target: DomElement*):
    trap("unported (P3): Web::IntersectionObserver::IntersectionObserver::unobserve")


## Web::ViewTransition::ViewTransition::Phase (Libraries/LibWeb/ViewTransition/ViewTransition.h:131).
pub enum ViewTransitionViewTransitionPhase as u8:
    pending_capture = 0
    update_callback_called = 1
    animating = 2
    done = 3

## Ported from Libraries/LibWeb/ViewTransition/ViewTransition.cpp Web::ViewTransition::ViewTransition::create.
pub func view_transition_view_transition_create(realm: Realm*) -> ViewTransitionViewTransition*:
    trap("unported (P4): Web::ViewTransition::ViewTransition::create")

## Ported from Libraries/LibWeb/ViewTransition/ViewTransition.h:138 Web::ViewTransition::ViewTransition::set_update_callback.
pub func view_transition_view_transition_set_update_callback(this: ViewTransitionViewTransition*, callback: IdlCallbackType*?):
    trap("unported (P4): Web::ViewTransition::ViewTransition::set_update_callback")

## Ported from Libraries/LibWeb/ViewTransition/ViewTransition.cpp Web::ViewTransition::ViewTransition::skip_the_view_transition.
pub func view_transition_view_transition_skip_the_view_transition(this: ViewTransitionViewTransition*, reason: JsValue):
    trap("unported (P4): Web::ViewTransition::ViewTransition::skip_the_view_transition")

## Ported from Libraries/LibWeb/ViewTransition/ViewTransition.h:137 Web::ViewTransition::ViewTransition::phase.
pub func view_transition_view_transition_phase(this: ViewTransitionViewTransition*) -> ViewTransitionViewTransitionPhase:
    trap("unported (P4): Web::ViewTransition::ViewTransition::phase")

## Ported from Libraries/LibWeb/ViewTransition/ViewTransition.cpp Web::ViewTransition::ViewTransition::setup_view_transition.
pub func view_transition_view_transition_setup_view_transition(this: ViewTransitionViewTransition*):
    trap("unported (P4): Web::ViewTransition::ViewTransition::setup_view_transition")

## Ported from Libraries/LibWeb/ViewTransition/ViewTransition.cpp Web::ViewTransition::ViewTransition::handle_transition_frame.
pub func view_transition_view_transition_handle_transition_frame(this: ViewTransitionViewTransition*):
    trap("unported (P4): Web::ViewTransition::ViewTransition::handle_transition_frame")

## Ported from Libraries/LibWeb/ViewTransition/ViewTransition.cpp Web::ViewTransition::ViewTransition::call_the_update_callback.
pub func view_transition_view_transition_call_the_update_callback(this: ViewTransitionViewTransition*):
    trap("unported (P4): Web::ViewTransition::ViewTransition::call_the_update_callback")

## Ported from Libraries/LibHTTP/Cookie/Cookie.cpp:64 HTTP::Cookie::canonicalize_domain
## (Document::initialize asks it of every new document's URL; LibHTTP is not ported, the
## function is, by the phase-1 seams work).
pub func http_cookie_canonicalize_domain(url: web_url.Url) -> ak.String?:
    if web_url.url_host(&url) == none:
        return none

    # 1. Convert the host name to a sequence of individual domain name labels.
    # 2. All labels must be one of U-label, A-label, or Non-Reserved LDH (NR-LDH) label (see Section 2.3.1 of [RFC5890]).
    #    If any label is not one of these then abort this algorithm and fail to canonicalize the host name.
    # 3. Convert each U-label to an A-label (see Section 2.3.2.1 of [RFC5890]).
    # 4. If any label is a Fake A-label then abort this algorithm and fail to canonicalize the host name.
    # 5. Concatenate the resulting labels, separated by a %x2E (".") character.
    # FIXME: Implement the above conversions.

    let serialized_host = web_url.url_serialized_host(&url)
    return web_unicode.string_to_lowercase(&serialized_host) else trap("MUST: String::to_lowercase")

## Ported from Libraries/LibWeb/XPath/XPath.cpp Web::XPath::create_expression.
pub func xpath_create_expression(realm: Realm*, expression: ak.String, resolver: XPathXPathNsResolver*?) -> XPathXPathExpression*!:
    trap("unported (P3): Web::XPath::create_expression")

## Ported from Libraries/LibWeb/XPath/XPath.cpp Web::XPath::evaluate.
pub func xpath_evaluate(realm: Realm*, expression: ak.String, context_node: DomNode*, resolver: XPathXPathNsResolver*?, type_: u16, result: XPathXPathResult*?) -> XPathXPathResult*!:
    trap("unported (P3): Web::XPath::evaluate")

## Web::Fetch::Headers::Guard (Libraries/LibWeb/Fetch/Headers.h).
pub enum FetchHeadersGuard as i32:
    immutable = 0
    request = 1
    request_no_cors = 2
    response = 3
    none_ = 4

## Web::Fetch::Response (Libraries/LibWeb/Fetch/Response.h), the JS-facing response: opaque in this phase.
pub struct FetchJsResponse:
    pub var opaque_: u8

## Ported from Libraries/LibWeb/Fetch/Response.cpp Web::Fetch::Response::create.
pub func fetch_js_response_create(realm: Realm*, response: FetchResponse*, guard: FetchHeadersGuard) -> FetchJsResponse*:
    trap("unported (P3): Web::Fetch::Response::create")

## Web::Editing::CommandDefinition (Libraries/LibWeb/Editing/Commands.h:16). `command` is a FlyString const& in C++.
pub struct EditingCommandDefinition:
    pub var command: ak.FlyString
    pub var action: (func(DomDocument*, ak.Utf16String) -> bool)?
    pub var indeterminate: (func(DomDocument*) -> bool)?
    pub var state: (func(DomDocument*) -> bool)?
    pub var value: (func(DomDocument*) -> ak.Utf16String)?
    pub var relevant_css_property: css_data.PropertyId?
    pub var preserves_overrides: bool
    pub var inline_activated_values: ak.Vector[ak.Utf16View]
    pub var mapped_value: ak.FlyString

## Ported from Libraries/LibWeb/Editing/Commands.cpp Web::Editing::find_command_definition.
pub func editing_find_command_definition(command: ak.FlyString) -> const EditingCommandDefinition*?:
    trap("unported (P4): Web::Editing::find_command_definition")

## Web::Editing::RecordedOverride (Libraries/LibWeb/Editing/Internal/Algorithms.h:24).
pub struct EditingRecordedOverride:
    pub var command: ak.FlyString
    pub var value: EditingRecordedOverrideValue

## The Variant<Utf16String, bool> of Web::Editing::RecordedOverride::value.
pub enum EditingRecordedOverrideValue:
    utf16_string(value: ak.Utf16String)
    bool_(value: bool)

## Ported from Libraries/LibWeb/Editing/Internal/Algorithms.cpp Web::Editing::active_range.
pub func editing_active_range(document: DomDocument*) -> DomRange*?:
    trap("unported (P4): Web::Editing::active_range")

## Ported from Libraries/LibWeb/Editing/Internal/Algorithms.cpp Web::Editing::effective_command_value.
pub func editing_effective_command_value(node: DomNode*?, command: ak.FlyString) -> ak.Utf16String?:
    trap("unported (P4): Web::Editing::effective_command_value")

## Ported from Libraries/LibWeb/Editing/Internal/Algorithms.cpp Web::Editing::is_formattable_node.
pub func editing_is_formattable_node(node: DomNode*) -> bool:
    trap("unported (P4): Web::Editing::is_formattable_node")

## Ported from Libraries/LibWeb/Editing/Internal/Algorithms.cpp Web::Editing::for_each_node_effectively_contained_in_range.
pub func editing_for_each_node_effectively_contained_in_range(range: DomRange*?, callback: ak.Function1[DomNode*, TraversalDecision]):
    trap("unported (P4): Web::Editing::for_each_node_effectively_contained_in_range")

## Ported from Libraries/LibWeb/Editing/Internal/Algorithms.cpp Web::Editing::record_current_overrides.
pub func editing_record_current_overrides(document: DomDocument*) -> ak.Vector[EditingRecordedOverride]:
    trap("unported (P4): Web::Editing::record_current_overrides")

## Ported from Libraries/LibWeb/Editing/Internal/Algorithms.cpp Web::Editing::restore_states_and_values.
pub func editing_restore_states_and_values(document: DomDocument*, overrides: const ak.Vector[EditingRecordedOverride]*):
    trap("unported (P4): Web::Editing::restore_states_and_values")

## Ported from Libraries/LibWeb/Editing/Internal/Algorithms.cpp Web::Editing::font_size_to_pixel_size.
pub func editing_font_size_to_pixel_size(value: const ak.Utf16View*) -> gfx.CssPixels:
    trap("unported (P4): Web::Editing::font_size_to_pixel_size")

## Ported from Libraries/LibWeb/Editing/Internal/Algorithms.cpp Web::Editing::legacy_font_size.
pub func editing_legacy_font_size(pixel_size: i32) -> ak.Utf16String:
    trap("unported (P4): Web::Editing::legacy_font_size")

## Web::UIEvents::InputEventInit (Libraries/LibWeb/UIEvents/InputEvent.h:14).
pub struct UiEventsInputEventInit:
    pub var ui_event_init: UiEventsUiEventInit
    pub var data: ak.Utf16String?
    pub var is_composing: bool
    pub var input_type: ak.FlyString

## The C++ default member initializers of Web::UIEvents::InputEventInit.
pub func ui_events_input_event_init_init_fields(this: UiEventsInputEventInit*):
    this.ui_event_init = UiEventsUiEventInit(event_init = DomEventInit(), view = none, detail = 0)
    this.data = none
    this.is_composing = false
    this.input_type = ak.FlyString()

## Web::UIEvents::InputEvent (Libraries/LibWeb/UIEvents/InputEvent.h:20): opaque in this phase.
pub struct UiEventsInputEvent:
    pub var opaque_: u8

## Ported from Libraries/LibWeb/UIEvents/InputEvent.cpp Web::UIEvents::InputEvent::create_from_platform_event.
## (Region r28 added target_ranges, with C++'s default `{}`, for EventHandler::input_event.)
pub func ui_events_input_event_create_from_platform_event(realm: Realm*, event_name: ak.FlyString, event_init: UiEventsInputEventInit, target_ranges: ak.Vector[DomStaticRange*] = ak.Vector[DomStaticRange*]()) -> UiEventsInputEvent*:
    trap("unported (P4): Web::UIEvents::InputEvent::create_from_platform_event")

# mark: Declarations outside the phase-1 closure that region r22 calls ========================

## Ported from Libraries/LibJS/Runtime/Value.cpp:1264 JS::to_integer_or_infinity(double).
# 7.1.5 ToIntegerOrInfinity ( argument ), https://tc39.es/ecma262/#sec-tointegerorinfinity
pub func js_to_integer_or_infinity(number: f64) -> f64:
    # 1. Let number be ? ToNumber(argument).

    # 2. If number is NaN, +0𝔽, or -0𝔽, return 0.
    if math.is_nan(number) or number == 0.0:
        return 0.0

    # 3. If number is +∞𝔽, return +∞.
    if number == math.infinity:
        return math.infinity

    # 4. If number is -∞𝔽, return -∞.
    if number == -math.infinity:
        return -math.infinity

    # 5. Let integer be floor(abs(ℝ(number))).
    var integer = math.floor(math.abs(number))

    # 6. If number < -0𝔽, set integer to -integer.
    # NOTE: The zero check is required as 'integer' is a double here but an MV in the spec,
    #       which doesn't have negative zero.
    if number < 0.0 and integer != 0.0:
        integer = -integer

    # 7. Return integer.
    return integer

## Ported from Libraries/LibJS/Runtime/Date.cpp:577 JS::make_time.
# 21.4.1.27 MakeTime ( hour, min, sec, ms ), https://tc39.es/ecma262/#sec-maketime
pub func js_make_time(hour: f64, min: f64, sec: f64, ms: f64) -> f64:
    # 1. If hour is not finite or min is not finite or sec is not finite or ms is not finite, return NaN.
    if not math.is_finite(hour) or not math.is_finite(min) or not math.is_finite(sec) or not math.is_finite(ms):
        return math.nan

    # 2. Let h be 𝔽(! ToIntegerOrInfinity(hour)).
    let h = js_to_integer_or_infinity(hour)
    # 3. Let m be 𝔽(! ToIntegerOrInfinity(min)).
    let m = js_to_integer_or_infinity(min)
    # 4. Let s be 𝔽(! ToIntegerOrInfinity(sec)).
    let s = js_to_integer_or_infinity(sec)
    # 5. Let milli be 𝔽(! ToIntegerOrInfinity(ms)).
    let milli = js_to_integer_or_infinity(ms)
    # 6. Let t be ((h * msPerHour + m * msPerMinute) + s * msPerSecond) + milli, performing the arithmetic according to IEEE 754-2019 rules (that is, as if using the ECMAScript operators * and +).
    # NOTE: C++ arithmetic abides by IEEE 754 rules
    let t = ((h * 3600000.0 + m * 60000.0) + s * 1000.0) + milli
    # 7. Return t.
    return t

## Ported from Libraries/LibJS/Runtime/Date.cpp:25 JS::Date::create.
pub func js_date_create(realm: Realm*, date_value: f64) -> JsDate*:
    trap("unported (P3): JS::Date::create")

## Ported from Libraries/LibWeb/HTML/CustomElements/CustomElementDefinition.h:43 Web::HTML::CustomElementDefinition::form_associated.
pub func html_custom_element_definition_form_associated(this: HtmlCustomElementDefinition*) -> bool:
    trap("unported (P3): Web::HTML::CustomElementDefinition::form_associated")

## Ported from Libraries/LibWeb/HTML/CustomElements/CustomElementDefinition.h:44 Web::HTML::CustomElementDefinition::disable_internals.
pub func html_custom_element_definition_disable_internals(this: HtmlCustomElementDefinition*) -> bool:
    trap("unported (P3): Web::HTML::CustomElementDefinition::disable_internals")

# mark: Declarations outside the phase-1 closure that region r29 calls ========================

## Ported from Libraries/LibWeb/IndexedDB/Internal/Algorithms.cpp:2219 Web::IndexedDB::cleanup_indexed_database_transactions.
## Database::for_each_database visits no database before IndexedDB (phase 4), so no transaction
## has this cleanup event loop.
pub func indexed_db_cleanup_indexed_database_transactions(event_loop: HtmlEventLoop*) -> bool:
    let has_matching_event_loop = false
    # Database::for_each_database(...): no databases exist before phase 4.
    return has_matching_event_loop

# mark: Declarations outside the phase-1 closure that region r23 calls ========================

## Web::HTML::CustomElementReactionNames::formAssociatedCallback (Libraries/LibWeb/HTML/CustomElements/CustomElementReactionNames.h:20).
pub var html_custom_element_reaction_names_form_associated_callback: ak.FlyString

## Web::HTML::CustomElementReactionNames::formResetCallback (Libraries/LibWeb/HTML/CustomElements/CustomElementReactionNames.h:22).
pub var html_custom_element_reaction_names_form_reset_callback: ak.FlyString

## Web::HTML::CustomElementReactionNames::formDisabledCallback (Libraries/LibWeb/HTML/CustomElements/CustomElementReactionNames.h:21).
pub var html_custom_element_reaction_names_form_disabled_callback: ak.FlyString

## Web::UIEvents::InputTypes::insertFromPaste (Libraries/LibWeb/UIEvents/InputTypes.h:17; zero until interned).
pub var ui_events_input_types_insert_from_paste: ak.FlyString

## Web::UIEvents::InputTypes::insertText (Libraries/LibWeb/UIEvents/InputTypes.h:20; zero until interned).
pub var ui_events_input_types_insert_text: ak.FlyString

## Ported from Libraries/LibWeb/XHR/FormData.h:42 Web::XHR::FormData::entry_list (a copy of the list).
pub func xhr_form_data_entry_list(this: XhrFormData*) -> ak.Vector[XhrFormDataEntry]:
    trap("unported (P3): Web::XHR::FormData::entry_list")

## Ported from Libraries/LibWeb/HTML/RadioNodeList.cpp Web::HTML::RadioNodeList::create (RadioNodeList is outside
## the phase-1 closure: its value attribute is scripting, phase 3).
pub func html_radio_node_list_create(realm: Realm*, root: DomNode*, scope: DomLiveNodeListScope, filter: ak.Function1[DomNode*, bool]) -> HtmlRadioNodeList*:
    trap("unported (P3): Web::HTML::RadioNodeList::create")

## Web::FileAPI::FilePropertyBag (Libraries/LibWeb/FileAPI/File.h:13) with its BlobPropertyBag base
## (Blob.h:24; `endings` keeps its default, Transparent).
pub struct FileApiFilePropertyBag:
    pub var type_: ak.String
    pub var last_modified: i64?

## Ported from Libraries/LibWeb/FileAPI/Blob.h:49 Web::FileAPI::Blob::type.
pub func file_api_blob_type(this: FileApiBlob*) -> ak.String:
    trap("unported (P3): Web::FileAPI::Blob::type")

## Ported from Libraries/LibWeb/FileAPI/Blob.h:58 Web::FileAPI::Blob::raw_bytes.
pub func file_api_blob_raw_bytes(this: FileApiBlob*) -> const u8[]:
    trap("unported (P3): Web::FileAPI::Blob::raw_bytes")

## Ported from Libraries/LibWeb/FileAPI/Blob.h:47 Web::FileAPI::Blob::size. (Added by region p2c for scheme fetch.)
pub func file_api_blob_size(this: FileApiBlob*) -> u64:
    trap("unported (P3): Web::FileAPI::Blob::size")

## Ported from Libraries/LibWeb/FileAPI/Blob.cpp:230 Web::FileAPI::Blob::slice. (Added by region p2c for scheme fetch.)
pub func file_api_blob_slice(this: FileApiBlob*, start: i64? = none, end: i64? = none, content_type: ak.String? = none) -> FileApiBlob*!:
    trap("unported (P3): Web::FileAPI::Blob::slice")

## is<Web::FileAPI::File> of a Blob.
pub func is_file_api_file(blob: FileApiBlob*) -> bool:
    trap("unported (P3): is<Web::FileAPI::File>")

## Ported from Libraries/LibWeb/FileAPI/File.cpp Web::FileAPI::File::create(Realm&, BlobParts const&, String const&,
## Optional<FilePropertyBag> const&). (BlobPart is Variant<BufferSource, Blob, String>; the callers here
## pass Blobs only.)
pub func file_api_file_create(realm: Realm*, file_bits: ak.Vector[FileApiBlob*], file_name: ak.String, options: FileApiFilePropertyBag? = none) -> FileApiFile*!:
    trap("unported (P3): Web::FileAPI::File::create")

## Ported from Libraries/LibWeb/FileAPI/File.h:29 Web::FileAPI::File::name.
pub func file_api_file_name(this: FileApiFile*) -> ak.String:
    trap("unported (P3): Web::FileAPI::File::name")

## Ported from Libraries/LibWeb/FileAPI/File.h:31 Web::FileAPI::File::last_modified.
pub func file_api_file_last_modified(this: FileApiFile*) -> i64:
    trap("unported (P3): Web::FileAPI::File::last_modified")

## Ported from Libraries/LibWeb/FileAPI/FileList.h:33 Web::FileAPI::FileList::length.
pub func file_api_file_list_length(this: FileApiFileList*) -> u32:
    trap("unported (P4): Web::FileAPI::FileList::length")

## Ported from Libraries/LibWeb/FileAPI/FileList.h:36 Web::FileAPI::FileList::item.
pub func file_api_file_list_item(this: FileApiFileList*, index: usize) -> FileApiFile*?:
    trap("unported (P4): Web::FileAPI::FileList::item")

## Ported from Libraries/LibWeb/XHR/FormData.cpp Web::XHR::FormData::construct_impl(Realm&, ConservativeVector<FormDataEntry>).
pub func xhr_form_data_construct_impl(realm: Realm*, entry_list: ak.Vector[XhrFormDataEntry]) -> XhrFormData*!:
    trap("unported (P3): Web::XHR::FormData::construct_impl")

## Web::HTML::FormDataEventInit (Libraries/LibWeb/HTML/FormDataEvent.h:14).
pub struct HtmlFormDataEventInit:
    pub var event_init: DomEventInit
    pub var form_data: XhrFormData*?

## Ported from Libraries/LibWeb/HTML/FormDataEvent.cpp Web::HTML::FormDataEvent::construct_impl (the event as its DOM::Event).
pub func html_form_data_event_construct_impl(realm: Realm*, event_name: ak.FlyString, event_init: HtmlFormDataEventInit) -> DomEvent*!:
    trap("unported (P3): Web::HTML::FormDataEvent::construct_impl")

## Ported from Libraries/LibWeb/DOMURL/URLSearchParams.cpp Web::DOMURL::url_encode.
pub func domurl_url_encode(tuples: const ak.Vector[DomurlQueryParam]*, encoding: ak.StringView) -> ak.String:
    trap("unported (P3): Web::DOMURL::url_encode")

## Web::HTML::SubmitEventInit (Libraries/LibWeb/HTML/SubmitEvent.h:14).
pub struct HtmlSubmitEventInit:
    pub var event_init: DomEventInit
    pub var submitter: HtmlElement*?

## Ported from Libraries/LibWeb/HTML/SubmitEvent.cpp Web::HTML::SubmitEvent::create (the event as its DOM::Event).
pub func html_submit_event_create(realm: Realm*, event_name: ak.FlyString, event_init: HtmlSubmitEventInit) -> DomEvent*:
    trap("unported (P3): Web::HTML::SubmitEvent::create")

# mark: CSS Typed OM (phase 3; added by region r36 for GeneratedCSSNumericFactoryMethods)

## Ported from Libraries/LibWeb/CSS/CSSUnitValue.cpp Web::CSS::CSSUnitValue::create.
pub func css_unit_value_create(realm: Realm*, value: f64, unit_: ak.FlyString) -> CssUnitValue*:
    trap("unported (P3): Web::CSS::CSSUnitValue::create")

# mark: Declarations outside the phase-1 closure that region r38 calls ========================

## Ported from Libraries/LibWeb/HTML/CustomElements/CustomStateSet.cpp Web::HTML::CustomStateSet::has_state.
# The states set is a JS::Set (ElementInternals.states, P3): no element has one before then.
pub func html_custom_state_set_has_state(this: HtmlCustomStateSet*, state: ak.FlyString) -> bool:
    trap("unported (P3): Web::HTML::CustomStateSet::has_state")

# mark: CSS Typed OM (phase 3; added by region r34 for StyleValue::reify and its overrides) ====

## Web::CSS::CSSKeywordValue (Libraries/LibWeb/CSS/CSSKeywordValue.h:17): phase 3, opaque until then.
pub struct CssKeywordValue:
    pub var opaque_: u8

## Web::CSS::CSSImageValue (Libraries/LibWeb/CSS/CSSImageValue.h:15): phase 3, opaque until then.
pub struct CssImageValue:
    pub var opaque_: u8

## Web::CSS::CSSTransformValue (Libraries/LibWeb/CSS/CSSTransformValue.h:15): phase 3, opaque until then.
pub struct CssTransformValue:
    pub var opaque_: u8

## Ported from Libraries/LibWeb/CSS/CSSStyleValue.cpp Web::CSS::CSSStyleValue::create.
pub func css_css_style_value_create(realm: Realm*, associated_property: ak.FlyString, source_value: CssStyleValue*) -> CssCssStyleValue*:
    trap("unported (P3): Web::CSS::CSSStyleValue::create")

## Ported from Libraries/LibWeb/CSS/CSSKeywordValue.cpp Web::CSS::CSSKeywordValue::create.
pub func css_keyword_value_create(realm: Realm*, value: ak.FlyString) -> CssKeywordValue*:
    trap("unported (P3): Web::CSS::CSSKeywordValue::create")

## Ported from Libraries/LibWeb/CSS/CSSImageValue.cpp Web::CSS::CSSImageValue::create.
pub func css_image_value_create(realm: Realm*, source_value: CssStyleValue*) -> CssImageValue*:
    trap("unported (P3): Web::CSS::CSSImageValue::create")

## Ported from Libraries/LibWeb/CSS/CSSUnparsedValue.cpp Web::CSS::CSSUnparsedValue::create.
pub func css_unparsed_value_create(realm: Realm*, tokens: ak.Vector[CssGcRootCssUnparsedSegment]) -> CssUnparsedValue*:
    trap("unported (P3): Web::CSS::CSSUnparsedValue::create")

## Ported from Libraries/LibWeb/CSS/CSSVariableReferenceValue.cpp Web::CSS::CSSVariableReferenceValue::create.
pub func css_variable_reference_value_create(realm: Realm*, variable: ak.FlyString, fallback: CssUnparsedValue*? = none) -> CssVariableReferenceValue*:
    trap("unported (P3): Web::CSS::CSSVariableReferenceValue::create")

## Ported from Libraries/LibWeb/CSS/CSSTransformValue.cpp Web::CSS::CSSTransformValue::create.
pub func css_transform_value_create(realm: Realm*, transforms: ak.Vector[CssTransformComponent*]) -> CssTransformValue*:
    trap("unported (P3): Web::CSS::CSSTransformValue::create")

# mark: CSS Typed OM math values (phase 3; added by region r35 for CalculationNode::reify) ======
# The CSSMath* classes are outside the phase-1 closure: each create answers the new value as its
# CSSNumericValue base, which is all CalculationNode::reify does with it.

## Ported from Libraries/LibWeb/CSS/CSSNumericArray.cpp Web::CSS::CSSNumericArray::create.
pub func css_numeric_array_create(realm: Realm*, values: ak.Vector[CssNumericValue*]) -> CssNumericArray*:
    trap("unported (P3): Web::CSS::CSSNumericArray::create")

## Ported from Libraries/LibWeb/CSS/CSSMathSum.cpp Web::CSS::CSSMathSum::create.
pub func css_math_sum_create(realm: Realm*, type_: CssNumericType, values: CssNumericArray*) -> CssNumericValue*:
    trap("unported (P3): Web::CSS::CSSMathSum::create")

## Ported from Libraries/LibWeb/CSS/CSSMathProduct.cpp Web::CSS::CSSMathProduct::create.
pub func css_math_product_create(realm: Realm*, type_: CssNumericType, values: CssNumericArray*) -> CssNumericValue*:
    trap("unported (P3): Web::CSS::CSSMathProduct::create")

## Ported from Libraries/LibWeb/CSS/CSSMathNegate.cpp Web::CSS::CSSMathNegate::create.
pub func css_math_negate_create(realm: Realm*, type_: CssNumericType, value: CssNumericValue*) -> CssNumericValue*:
    trap("unported (P3): Web::CSS::CSSMathNegate::create")

## Ported from Libraries/LibWeb/CSS/CSSMathInvert.cpp Web::CSS::CSSMathInvert::create.
pub func css_math_invert_create(realm: Realm*, type_: CssNumericType, value: CssNumericValue*) -> CssNumericValue*:
    trap("unported (P3): Web::CSS::CSSMathInvert::create")

## Ported from Libraries/LibWeb/CSS/CSSMathMin.cpp Web::CSS::CSSMathMin::create.
pub func css_math_min_create(realm: Realm*, type_: CssNumericType, values: CssNumericArray*) -> CssNumericValue*:
    trap("unported (P3): Web::CSS::CSSMathMin::create")

## Ported from Libraries/LibWeb/CSS/CSSMathMax.cpp Web::CSS::CSSMathMax::create.
pub func css_math_max_create(realm: Realm*, type_: CssNumericType, values: CssNumericArray*) -> CssNumericValue*:
    trap("unported (P3): Web::CSS::CSSMathMax::create")

## Ported from Libraries/LibWeb/CSS/CSSMathClamp.cpp Web::CSS::CSSMathClamp::create.
pub func css_math_clamp_create(realm: Realm*, type_: CssNumericType, lower: CssNumericValue*, value: CssNumericValue*, upper: CssNumericValue*) -> CssNumericValue*:
    trap("unported (P3): Web::CSS::CSSMathClamp::create")

# mark: CSS Typed OM transform components (phase 3; added by region r35 for reify_a_transform_function)
# The CSSTransformComponent subclasses are outside the phase-1 closure: each create answers the new
# component as its CSSTransformComponent base, which is all reify_a_transform_function does with it.

## Web::CSS::CSSTransformComponent::Is2D (Libraries/LibWeb/CSS/CSSTransformComponent.h:19).
pub enum CssTransformComponentIs2d as u8:
    no = 0
    yes = 1

## Web::CSS::CSSPerspectiveValueInternal (Libraries/LibWeb/CSS/CSSPerspective.h): a keyword or a numeric value.
pub enum CssPerspectiveValueInternal:
    css_keyword_value(value: CssKeywordValue*)
    css_numeric_value(value: CssNumericValue*)

## as_if<CSSKeywordValue>(CSSStyleValue&) (phase 3: no Typed OM value exists before then).
pub func as_if_css_keyword_value(value: CssCssStyleValue*) -> CssKeywordValue*?:
    trap("unported (P3): as_if<Web::CSS::CSSKeywordValue>")

## as_if<CSSNumericValue>(CSSStyleValue&) (phase 3: no Typed OM value exists before then).
pub func as_if_css_numeric_value(value: CssCssStyleValue*) -> CssNumericValue*?:
    trap("unported (P3): as_if<Web::CSS::CSSNumericValue>")

## Ported from Libraries/LibWeb/CSS/CSSMatrixComponent.cpp Web::CSS::CSSMatrixComponent::create.
pub func css_matrix_component_create(realm: Realm*, is_2d: CssTransformComponentIs2d, matrix: GeometryDomMatrix*) -> CssTransformComponent*:
    trap("unported (P3): Web::CSS::CSSMatrixComponent::create")

## Ported from Libraries/LibWeb/CSS/CSSTranslate.cpp Web::CSS::CSSTranslate::create.
pub func css_translate_create(realm: Realm*, is_2d: CssTransformComponentIs2d, x: CssNumericValue*, y: CssNumericValue*, z: CssNumericValue*) -> CssTransformComponent*:
    trap("unported (P3): Web::CSS::CSSTranslate::create")

## Ported from Libraries/LibWeb/CSS/CSSScale.cpp Web::CSS::CSSScale::create.
pub func css_scale_create(realm: Realm*, is_2d: CssTransformComponentIs2d, x: CssNumericValue*, y: CssNumericValue*, z: CssNumericValue*) -> CssTransformComponent*:
    trap("unported (P3): Web::CSS::CSSScale::create")

## Ported from Libraries/LibWeb/CSS/CSSRotate.cpp Web::CSS::CSSRotate::create.
pub func css_rotate_create(realm: Realm*, is_2d: CssTransformComponentIs2d, x: CssNumericValue*, y: CssNumericValue*, z: CssNumericValue*, angle: CssNumericValue*) -> CssTransformComponent*:
    trap("unported (P3): Web::CSS::CSSRotate::create")

## Ported from Libraries/LibWeb/CSS/CSSSkew.cpp Web::CSS::CSSSkew::create.
pub func css_skew_create(realm: Realm*, ax: CssNumericValue*, ay: CssNumericValue*) -> CssTransformComponent*:
    trap("unported (P3): Web::CSS::CSSSkew::create")

## Ported from Libraries/LibWeb/CSS/CSSSkewX.cpp Web::CSS::CSSSkewX::create.
pub func css_skew_x_create(realm: Realm*, ax: CssNumericValue*) -> CssTransformComponent*:
    trap("unported (P3): Web::CSS::CSSSkewX::create")

## Ported from Libraries/LibWeb/CSS/CSSSkewY.cpp Web::CSS::CSSSkewY::create.
pub func css_skew_y_create(realm: Realm*, ay: CssNumericValue*) -> CssTransformComponent*:
    trap("unported (P3): Web::CSS::CSSSkewY::create")

## Ported from Libraries/LibWeb/CSS/CSSPerspective.cpp Web::CSS::CSSPerspective::create.
pub func css_perspective_create(realm: Realm*, length: CssPerspectiveValueInternal) -> CssTransformComponent*:
    trap("unported (P3): Web::CSS::CSSPerspective::create")

## Ported from Libraries/LibWeb/Geometry/DOMMatrix.cpp Web::Geometry::DOMMatrix::create.
pub func geometry_dom_matrix_create(realm: Realm*) -> GeometryDomMatrix*:
    trap("unported (P3): Web::Geometry::DOMMatrix::create")

## Ported from Libraries/LibWeb/Geometry/DOMMatrix.cpp Web::Geometry::DOMMatrix::set_m11.
pub func geometry_dom_matrix_set_m11(this: GeometryDomMatrix*, value: f64):
    trap("unported (P3): Web::Geometry::DOMMatrix::set_m11")

## Ported from Libraries/LibWeb/Geometry/DOMMatrix.cpp Web::Geometry::DOMMatrix::set_m12.
pub func geometry_dom_matrix_set_m12(this: GeometryDomMatrix*, value: f64):
    trap("unported (P3): Web::Geometry::DOMMatrix::set_m12")

## Ported from Libraries/LibWeb/Geometry/DOMMatrix.cpp Web::Geometry::DOMMatrix::set_m13.
pub func geometry_dom_matrix_set_m13(this: GeometryDomMatrix*, value: f64):
    trap("unported (P3): Web::Geometry::DOMMatrix::set_m13")

## Ported from Libraries/LibWeb/Geometry/DOMMatrix.cpp Web::Geometry::DOMMatrix::set_m14.
pub func geometry_dom_matrix_set_m14(this: GeometryDomMatrix*, value: f64):
    trap("unported (P3): Web::Geometry::DOMMatrix::set_m14")

## Ported from Libraries/LibWeb/Geometry/DOMMatrix.cpp Web::Geometry::DOMMatrix::set_m21.
pub func geometry_dom_matrix_set_m21(this: GeometryDomMatrix*, value: f64):
    trap("unported (P3): Web::Geometry::DOMMatrix::set_m21")

## Ported from Libraries/LibWeb/Geometry/DOMMatrix.cpp Web::Geometry::DOMMatrix::set_m22.
pub func geometry_dom_matrix_set_m22(this: GeometryDomMatrix*, value: f64):
    trap("unported (P3): Web::Geometry::DOMMatrix::set_m22")

## Ported from Libraries/LibWeb/Geometry/DOMMatrix.cpp Web::Geometry::DOMMatrix::set_m23.
pub func geometry_dom_matrix_set_m23(this: GeometryDomMatrix*, value: f64):
    trap("unported (P3): Web::Geometry::DOMMatrix::set_m23")

## Ported from Libraries/LibWeb/Geometry/DOMMatrix.cpp Web::Geometry::DOMMatrix::set_m24.
pub func geometry_dom_matrix_set_m24(this: GeometryDomMatrix*, value: f64):
    trap("unported (P3): Web::Geometry::DOMMatrix::set_m24")

## Ported from Libraries/LibWeb/Geometry/DOMMatrix.cpp Web::Geometry::DOMMatrix::set_m31.
pub func geometry_dom_matrix_set_m31(this: GeometryDomMatrix*, value: f64):
    trap("unported (P3): Web::Geometry::DOMMatrix::set_m31")

## Ported from Libraries/LibWeb/Geometry/DOMMatrix.cpp Web::Geometry::DOMMatrix::set_m32.
pub func geometry_dom_matrix_set_m32(this: GeometryDomMatrix*, value: f64):
    trap("unported (P3): Web::Geometry::DOMMatrix::set_m32")

## Ported from Libraries/LibWeb/Geometry/DOMMatrix.cpp Web::Geometry::DOMMatrix::set_m33.
pub func geometry_dom_matrix_set_m33(this: GeometryDomMatrix*, value: f64):
    trap("unported (P3): Web::Geometry::DOMMatrix::set_m33")

## Ported from Libraries/LibWeb/Geometry/DOMMatrix.cpp Web::Geometry::DOMMatrix::set_m34.
pub func geometry_dom_matrix_set_m34(this: GeometryDomMatrix*, value: f64):
    trap("unported (P3): Web::Geometry::DOMMatrix::set_m34")

## Ported from Libraries/LibWeb/Geometry/DOMMatrix.cpp Web::Geometry::DOMMatrix::set_m41.
pub func geometry_dom_matrix_set_m41(this: GeometryDomMatrix*, value: f64):
    trap("unported (P3): Web::Geometry::DOMMatrix::set_m41")

## Ported from Libraries/LibWeb/Geometry/DOMMatrix.cpp Web::Geometry::DOMMatrix::set_m42.
pub func geometry_dom_matrix_set_m42(this: GeometryDomMatrix*, value: f64):
    trap("unported (P3): Web::Geometry::DOMMatrix::set_m42")

## Ported from Libraries/LibWeb/Geometry/DOMMatrix.cpp Web::Geometry::DOMMatrix::set_m43.
pub func geometry_dom_matrix_set_m43(this: GeometryDomMatrix*, value: f64):
    trap("unported (P3): Web::Geometry::DOMMatrix::set_m43")

## Ported from Libraries/LibWeb/Geometry/DOMMatrix.cpp Web::Geometry::DOMMatrix::set_m44.
pub func geometry_dom_matrix_set_m44(this: GeometryDomMatrix*, value: f64):
    trap("unported (P3): Web::Geometry::DOMMatrix::set_m44")


# mark: Region r41 (CSS fonts): fetch controllers, Core::Promise, FontFaceSetLoadEvent (JS::Set is in external/lib_js/set)

## Web::CSS::FontFaceSetLoadEventInit (Libraries/LibWeb/CSS/FontFaceSetLoadEvent.h:14).
pub struct CssFontFaceSetLoadEventInit:
    pub var event_init: DomEventInit
    pub var fontfaces: ak.Vector[CssFontFace*]

## Ported from Libraries/LibWeb/CSS/FontFaceSetLoadEvent.cpp Web::CSS::FontFaceSetLoadEvent::create.
## Phase 1 (region r51b: FontFaceSet::ready fires `loadingdone` before a test page paints): the class is outside the
## phase-1 closure, so the event is a plain DOM::Event of the name and init; its `fontfaces` (only script can read
## them) are not kept.
pub func css_font_face_set_load_event_create(realm: Realm*, event_name: ak.FlyString, event_init: CssFontFaceSetLoadEventInit) -> DomEvent*:
    return dom_event_create(realm, event_name, event_init.event_init)

# mark: Screen orientation (phase 3; added by region r42 for Screen::orientation) ==============

## Ported from Libraries/LibWeb/CSS/ScreenOrientation.cpp Web::CSS::ScreenOrientation::create.
pub func css_screen_orientation_create(realm: Realm*) -> CssScreenOrientation*:
    trap("unported (P3): Web::CSS::ScreenOrientation::create")

# mark: Declarations outside the phase-1 closure that region r27 calls ==========================

## Ported from Libraries/LibWeb/HTML/UserNavigationInvolvement.cpp:15 Web::HTML::user_navigation_involvement (ported whole).
# https://html.spec.whatwg.org/multipage/browsing-the-web.html#event-uni
pub func html_user_navigation_involvement(event: DomEvent*) -> HtmlUserNavigationInvolvement:
    # For convenience at certain call sites, the user navigation involvement for an Event event is defined as follows:

    # 1. Assert: this algorithm is being called as part of an activation behavior definition.
    # 2. Assert: event's type is "click".
    let type_ = dom_event_type(event)
    assert(ak.fly_string_eq_fly_string(&type_, &ui_events_event_names_click))

    # 3. If event's isTrusted is initialized to true, then return "activation".
    # 4. Return "none".
    return HtmlUserNavigationInvolvement.activation if dom_event_is_trusted(event) else HtmlUserNavigationInvolvement.none_

## Web::TrustedTypes::Script (Libraries/LibWeb/TrustedTypes/RequireTrustedTypesForDirective.h:17,
## ENUMERATE_REQUIRE_KEYWORD_TRUSTED_TYPES_FOR): the keyword "'script'".
pub var trusted_types_script: ak.FlyString

## Interns Web::TrustedTypes::Script (web_initialize_strings calls it).
pub func trusted_types_initialize_strings():
    trusted_types_script = ak.fly_string_from_str("'script'")

## as<Web::HTML::ClassicScript> of a script element's result (HTML::Script is phase 3).
pub func as_html_classic_script(script: HtmlScript*) -> HtmlClassicScript*:
    trap("unported (P3): as<Web::HTML::ClassicScript>")

## Ported from Libraries/LibWeb/HTML/Scripting/ClassicScript.h Web::HTML::ClassicScript::run (its
## completion is discarded where HTMLScriptElement::execute_script calls it).
pub func html_classic_script_run(this: HtmlClassicScript*):
    trap("unported (P3): Web::HTML::ClassicScript::run")

## Web::HTML::ModuleScript (Libraries/LibWeb/HTML/Scripting/ModuleScript.h): opaque in this phase (not
## in the phase-1 closure; added by region r27 for HTMLScriptElement::execute_script).
pub struct HtmlModuleScript:
    pub var opaque_: u8

## as<Web::HTML::ModuleScript> of a script element's result (HTML::Script is phase 3).
pub func as_html_module_script(script: HtmlScript*) -> HtmlModuleScript*:
    trap("unported (P3): as<Web::HTML::ModuleScript>")

## Ported from Libraries/LibWeb/HTML/Scripting/ModuleScript.h Web::HTML::JavaScriptModuleScript::run (its
## promise is discarded where HTMLScriptElement::execute_script calls it).
pub func html_module_script_run(this: HtmlModuleScript*):
    trap("unported (P3): Web::HTML::ModuleScript::run")

## Ported from Libraries/LibWeb/HTML/Scripting/ImportMapParseResult.h Web::HTML::ImportMapParseResult::register_import_map.
pub func html_import_map_parse_result_register_import_map(this: HtmlImportMapParseResult*, global: HtmlWindow*):
    trap("unported (P3): Web::HTML::ImportMapParseResult::register_import_map")

# mark: Canvas rendering contexts and bitmap serialization (phase 4; added by region r27 for HTMLCanvasElement)

## Ported from Libraries/LibWeb/HTML/CanvasRenderingContext2D.h:60 Web::HTML::CanvasRenderingContext2D::create.
pub func html_canvas_rendering_context2_d_create(realm: Realm*, canvas_element: HtmlCanvasElement*, options: JsValue) -> HtmlCanvasRenderingContext2D*!:
    trap("unported (P4): Web::HTML::CanvasRenderingContext2D::create")

## Ported from Libraries/LibWeb/HTML/CanvasRenderingContext2D.h Web::HTML::CanvasRenderingContext2D::reset_to_default_state.
pub func html_canvas_rendering_context2_d_reset_to_default_state(this: HtmlCanvasRenderingContext2D*):
    trap("unported (P4): Web::HTML::CanvasRenderingContext2D::reset_to_default_state")

## Ported from Libraries/LibWeb/HTML/CanvasRenderingContext2D.h Web::HTML::CanvasRenderingContext2D::set_size.
pub func html_canvas_rendering_context2_d_set_size(this: HtmlCanvasRenderingContext2D*, size: gfx.IntSize):
    trap("unported (P4): Web::HTML::CanvasRenderingContext2D::set_size")

## Ported from Libraries/LibWeb/HTML/CanvasRenderingContext2D.h Web::HTML::CanvasRenderingContext2D::surface.
pub func html_canvas_rendering_context2_d_surface(this: HtmlCanvasRenderingContext2D*) -> gfx.PaintingSurface*?:
    trap("unported (P4): Web::HTML::CanvasRenderingContext2D::surface")

## Ported from Libraries/LibWeb/HTML/CanvasRenderingContext2D.h Web::HTML::CanvasRenderingContext2D::allocate_painting_surface_if_needed.
pub func html_canvas_rendering_context2_d_allocate_painting_surface_if_needed(this: HtmlCanvasRenderingContext2D*):
    trap("unported (P4): Web::HTML::CanvasRenderingContext2D::allocate_painting_surface_if_needed")

## Ported from Libraries/LibWeb/WebGL/WebGLRenderingContext.h:24 Web::WebGL::WebGLRenderingContext::create.
pub func web_gl_web_gl_rendering_context_create(realm: Realm*, canvas_element: HtmlCanvasElement*, options: JsValue) -> WebGlWebGlRenderingContext*?!:
    trap("unported (P4): Web::WebGL::WebGLRenderingContext::create")

## Ported from Libraries/LibWeb/WebGL/WebGLRenderingContext.h Web::WebGL::WebGLRenderingContext::reset_to_default_state.
pub func web_gl_web_gl_rendering_context_reset_to_default_state(this: WebGlWebGlRenderingContext*):
    trap("unported (P4): Web::WebGL::WebGLRenderingContext::reset_to_default_state")

## Ported from Libraries/LibWeb/WebGL/WebGLRenderingContext.h Web::WebGL::WebGLRenderingContext::set_size.
pub func web_gl_web_gl_rendering_context_set_size(this: WebGlWebGlRenderingContext*, size: gfx.IntSize):
    trap("unported (P4): Web::WebGL::WebGLRenderingContext::set_size")

## Ported from Libraries/LibWeb/WebGL/WebGLRenderingContext.h Web::WebGL::WebGLRenderingContext::surface.
pub func web_gl_web_gl_rendering_context_surface(this: WebGlWebGlRenderingContext*) -> gfx.PaintingSurface*?:
    trap("unported (P4): Web::WebGL::WebGLRenderingContext::surface")

## Ported from Libraries/LibWeb/WebGL/WebGLRenderingContext.h Web::WebGL::WebGLRenderingContext::allocate_painting_surface_if_needed.
pub func web_gl_web_gl_rendering_context_allocate_painting_surface_if_needed(this: WebGlWebGlRenderingContext*):
    trap("unported (P4): Web::WebGL::WebGLRenderingContext::allocate_painting_surface_if_needed")

## Ported from Libraries/LibWeb/WebGL/WebGLRenderingContext.h Web::WebGL::WebGLRenderingContext::present.
pub func web_gl_web_gl_rendering_context_present(this: WebGlWebGlRenderingContext*):
    trap("unported (P4): Web::WebGL::WebGLRenderingContext::present")

## Ported from Libraries/LibWeb/WebGL/WebGL2RenderingContext.h:25 Web::WebGL::WebGL2RenderingContext::create.
pub func web_gl_web_gl2_rendering_context_create(realm: Realm*, canvas_element: HtmlCanvasElement*, options: JsValue) -> WebGlWebGl2RenderingContext*?!:
    trap("unported (P4): Web::WebGL::WebGL2RenderingContext::create")

## Ported from Libraries/LibWeb/WebGL/WebGL2RenderingContext.h Web::WebGL::WebGL2RenderingContext::reset_to_default_state.
pub func web_gl_web_gl2_rendering_context_reset_to_default_state(this: WebGlWebGl2RenderingContext*):
    trap("unported (P4): Web::WebGL::WebGL2RenderingContext::reset_to_default_state")

## Ported from Libraries/LibWeb/WebGL/WebGL2RenderingContext.h Web::WebGL::WebGL2RenderingContext::set_size.
pub func web_gl_web_gl2_rendering_context_set_size(this: WebGlWebGl2RenderingContext*, size: gfx.IntSize):
    trap("unported (P4): Web::WebGL::WebGL2RenderingContext::set_size")

## Ported from Libraries/LibWeb/WebGL/WebGL2RenderingContext.h Web::WebGL::WebGL2RenderingContext::surface.
pub func web_gl_web_gl2_rendering_context_surface(this: WebGlWebGl2RenderingContext*) -> gfx.PaintingSurface*?:
    trap("unported (P4): Web::WebGL::WebGL2RenderingContext::surface")

## Ported from Libraries/LibWeb/WebGL/WebGL2RenderingContext.h Web::WebGL::WebGL2RenderingContext::allocate_painting_surface_if_needed.
pub func web_gl_web_gl2_rendering_context_allocate_painting_surface_if_needed(this: WebGlWebGl2RenderingContext*):
    trap("unported (P4): Web::WebGL::WebGL2RenderingContext::allocate_painting_surface_if_needed")

## Ported from Libraries/LibWeb/WebGL/WebGL2RenderingContext.h Web::WebGL::WebGL2RenderingContext::present.
pub func web_gl_web_gl2_rendering_context_present(this: WebGlWebGl2RenderingContext*):
    trap("unported (P4): Web::WebGL::WebGL2RenderingContext::present")

## Web::HTML::SerializeBitmapResult (Libraries/LibWeb/HTML/Canvas/SerializeBitmap.h:14).
pub struct HtmlSerializeBitmapResult:
    pub var buffer: ak.ByteBuffer
    pub var mime_type: ak.StringView

## Ported from Libraries/LibWeb/HTML/Canvas/SerializeBitmap.cpp Web::HTML::serialize_bitmap.
pub func html_serialize_bitmap(bitmap: gfx.Bitmap*, type_: ak.StringView, quality: f64?) -> HtmlSerializeBitmapResult!:
    trap("unported (P4): Web::HTML::serialize_bitmap")

## Ported from Libraries/LibWeb/FileAPI/Blob.h:42 Web::FileAPI::Blob::create.
pub func file_api_blob_create(realm: Realm*, byte_buffer: ak.ByteBuffer, type_: ak.String) -> FileApiBlob*:
    trap("unported (P3): Web::FileAPI::Blob::create")

# mark: Region p2a (Fetch infrastructure): StructuredSerialize, Requests::Request, Uint8Array chunks ==

## Ported from Libraries/LibWeb/HTML/StructuredSerialize.cpp Web::HTML::structured_serialize (the serialization record
## as bytes). (Added by region p2a for FetchController::abort, which serializes an "AbortError" DOMException.)
pub func html_structured_serialize(vm: Vm*, value: JsValue) -> ak.Vector[u8]!:
    trap("unported (P3): Web::HTML::structured_serialize")

# mark: Region r27 media: LibMedia's displaying video sinks (phase 4) ============================

## Media::DisplayingVideoSinkUpdateResult (Libraries/LibMedia/Sinks/DisplayingVideoSink.h:20).
pub enum MediaDisplayingVideoSinkUpdateResult as u8:
    new_frame_available = 0
    no_change = 1

## Ported from Libraries/LibMedia/Sinks/DisplayingVideoSink.cpp Media::DisplayingVideoSink::update.
pub func media_displaying_video_sink_update(this: MediaDisplayingVideoSink*) -> MediaDisplayingVideoSinkUpdateResult:
    trap("unported (P4): Media::DisplayingVideoSink::update")

## Ported from Libraries/LibMedia/Sinks/DisplayingVideoSink.h Media::DisplayingVideoSink::current_frame.
pub func media_displaying_video_sink_current_frame(this: MediaDisplayingVideoSink*) -> gfx.ImmutableBitmap*?:
    trap("unported (P4): Media::DisplayingVideoSink::current_frame")

# mark: Region r27 media: MediaSource, FileAPI blob URLs, Fetch and UI events (phases 2-4) =====

## Ported from Libraries/LibWeb/MediaSourceExtensions/MediaSource.cpp Web::MediaSourceExtensions::MediaSource::ready_state_is_closed.
pub func media_source_extensions_media_source_ready_state_is_closed(this: MediaSourceExtensionsMediaSource*) -> bool:
    trap("unported (P4): Web::MediaSourceExtensions::MediaSource::ready_state_is_closed")

## Ported from Libraries/LibWeb/MediaSourceExtensions/MediaSource.h Web::MediaSourceExtensions::MediaSource::set_has_ever_been_attached.
pub func media_source_extensions_media_source_set_has_ever_been_attached(this: MediaSourceExtensionsMediaSource*):
    trap("unported (P4): Web::MediaSourceExtensions::MediaSource::set_has_ever_been_attached")

## Ported from Libraries/LibWeb/MediaSourceExtensions/MediaSource.cpp Web::MediaSourceExtensions::MediaSource::set_assigned_to_media_element.
pub func media_source_extensions_media_source_set_assigned_to_media_element(this: MediaSourceExtensionsMediaSource*, media_element: HtmlMediaElement*):
    trap("unported (P4): Web::MediaSourceExtensions::MediaSource::set_assigned_to_media_element")

## Ported from Libraries/LibWeb/MediaSourceExtensions/MediaSource.cpp Web::MediaSourceExtensions::MediaSource::set_ready_state_to_open_and_fire_sourceopen_event.
pub func media_source_extensions_media_source_set_ready_state_to_open_and_fire_sourceopen_event(this: MediaSourceExtensionsMediaSource*):
    trap("unported (P4): Web::MediaSourceExtensions::MediaSource::set_ready_state_to_open_and_fire_sourceopen_event")

## Variant<GC::Ref<HTML::Environment>, FileAPI::TopLevelNavigation, FileAPI::TopLevelSelfFetch> (FileAPI/BlobURLStore.h;
## region p2c added top_level_navigation, which Fetch's scheme fetch passes).
pub enum FileApiEnvironmentOrTopLevelSelfFetch:
    environment(value: HtmlEnvironment*)
    top_level_navigation
    top_level_self_fetch

## The object of a blob URL entry: Variant<GC::Root<FileAPI::Blob>, GC::Root<MediaSourceExtensions::MediaSource>> (FileAPI/BlobURLStore.h).
pub enum FileApiBlobOrMediaSource:
    blob(value: FileApiBlob*)
    media_source(value: MediaSourceExtensionsMediaSource*)

## Ported from Libraries/LibWeb/FileAPI/BlobURLStore.cpp:100 Web::FileAPI::obtain_a_blob_object: the entry's
## URL::BlobURLEntry::Object (region p2c corrected the result from FileAPI's Object to URL's, as C++).
pub func file_api_obtain_a_blob_object(blob_url_entry: web_url.BlobUrlEntry, environment: FileApiEnvironmentOrTopLevelSelfFetch) -> web_url.BlobUrlEntryObject?:
    trap("unported (P3): Web::FileAPI::obtain_a_blob_object")

## Ported from Libraries/LibWeb/FileAPI/BlobURLStore.cpp Web::FileAPI::resolve_a_blob_url (the entry's object).
pub func file_api_resolve_a_blob_url(url: web_url.Url) -> FileApiBlobOrMediaSource?:
    trap("unported (P3): Web::FileAPI::resolve_a_blob_url")

# mark: Declarations outside the phase-1 closure that HTMLLinkElement calls (region r26) =======

## `Variant<Empty, Optional<Fetch::Infrastructure::Request::Destination>>` (translate_a_preload_destination's result).
pub enum EmptyOrOptionalFetchRequestDestination:
    empty
    destination(value: FetchRequestDestination?)

# mark: Declarations outside the phase-1 closure that region r28 calls ==========================

## Ported from Libraries/LibWeb/HTML/WorkerGlobalScope.h Web::HTML::WorkerGlobalScope (is<WorkerGlobalScope>).
## (Added by region r28 for PolicyList::from_object.) Workers are phase 4: no cell is a
## WorkerGlobalScope before then, so the answer is false.
pub func is_html_worker_global_scope(cell: gc.Cell*) -> bool:
    return false

## Ported from Libraries/LibWeb/Crypto/Crypto.cpp Web::Crypto::generate_random_uuid.
## (Added by region r28: SessionHistoryEntry's constructor generates its navigation API key and id.)
pub func crypto_generate_random_uuid() -> ak.String:
    return ak.generate_random_uuid()

## Ported from Libraries/LibWeb/HTML/NavigationObserver.h:24 Web::HTML::NavigationObserver::navigation_complete.
## (Added by region r28: a Navigable calls its observers' callbacks.)
pub func html_navigation_observer_navigation_complete(this: HtmlNavigationObserver*) -> gc.Function0[unit]*?:
    return this.m_navigation_complete

## Ported from Libraries/LibWeb/HTML/NavigationObserver.h:27 Web::HTML::NavigationObserver::ongoing_navigation_changed.
## (Added by region r28: a Navigable calls its observers' callbacks.)
pub func html_navigation_observer_ongoing_navigation_changed(this: HtmlNavigationObserver*) -> gc.Function0[unit]*?:
    return this.m_ongoing_navigation_changed

## Ported from Libraries/LibWeb/HTML/WebViewHints.cpp Web::HTML::WebViewHints::from_tokenised_features.
## (Added by region r28 for Navigable::choose_a_navigable: opening a new web view.)
pub func html_web_view_hints_from_tokenised_features(features: const ak.OrderedHashMap[ak.String, ak.String, ak.StringTraits]*, page: Page*) -> HtmlWebViewHints:
    trap("unported (P4): Web::HTML::WebViewHints::from_tokenised_features")

## Ported from Libraries/LibWeb/HTML/Navigation.cpp:192 Web::HTML::to_history_handling_behavior.
## (Added by region r28 for Navigable's navigations; ported whole.)
pub func html_to_history_handling_behavior(b: BindNavigationHistoryBehavior) -> HtmlHistoryHandlingBehavior:
    # A history handling behavior is a NavigationHistoryBehavior that is either "push" or "replace",
    # i.e., that has been resolved away from any initial "auto" value.
    assert(b != BindNavigationHistoryBehavior.auto)

    match b:
        .push:
            return HtmlHistoryHandlingBehavior.push
        .replace:
            return HtmlHistoryHandlingBehavior.replace
        _:
            trap("VERIFY_NOT_REACHED")

## Ported from Libraries/LibWeb/HTML/Scripting/ClassicScript.cpp Web::HTML::ClassicScript::create.
## (Added by region r28 for Navigable::evaluate_javascript_url.)
pub func html_classic_script_create(filename: ak.StringView, source: ak.StringView, settings: HtmlEnvironmentSettingsObject*, base_url: web_url.Url) -> HtmlClassicScript*:
    trap("unported (P3): Web::HTML::ClassicScript::create")

## `script->run()` read as evaluate_javascript_url reads it: the completion's value when the
## completion is normal and its value is a String, otherwise null (Navigable.cpp:2318-2326).
## (Added by region r28 for Navigable::evaluate_javascript_url.)
pub func html_classic_script_run_for_string_result(this: HtmlClassicScript*) -> ak.String?:
    trap("unported (P3): Web::HTML::ClassicScript::run")

## Ported from Libraries/LibWeb/StorageAPI/StorageShed.h:27 Web::StorageAPI::StorageShed::create.
## (Added by region r28: TraversableNavigable's constructor makes one.)
pub func storage_api_storage_shed_create(heap: gc.Heap*) -> StorageApiStorageShed*:
    return (StorageApiStorageShed*)web_heap_allocate_cell(heap, &storage_api_storage_shed_class)

## Ported from Libraries/LibWeb/StorageAPI/StorageShed.cpp Web::StorageAPI::StorageShed::visit_edges (override).
## (Added by region r28. m_data, the storage shelves, is phase 4: there is nothing to visit yet.)
pub func storage_api_storage_shed_visit_edges_impl(base: gc.Cell*, visitor: gc.CellVisitor*):
    gc.cell_visit_edges_impl(base, visitor)

## realm.create<Web::Geolocation::GeolocationCoordinates>(realm, CoordinatesData) (Libraries/LibWeb/Geolocation/GeolocationCoordinates.cpp).
## (Added by region r28 for TraversableNavigable::create_a_fresh_top_level_traversable.)
pub func realm_create_geolocation_coordinates(realm: Realm*, realm_: Realm*, accuracy: f64, latitude: f64, longitude: f64, altitude: f64?, altitude_accuracy: f64?, heading: f64?, speed: f64?) -> GeolocationCoordinates*:
    trap("unported (P4): Web::Geolocation::GeolocationCoordinates")

## Ported from Libraries/LibWeb/HTML/Timer.cpp Web::HTML::Timer::stop.
## (Added by region r28 for WindowOrWorkerGlobalScopeMixin::clear_map_of_active_timers.)
pub func html_timer_stop(this: HtmlTimer*):
    trap("unported (P3): Web::HTML::Timer::stop")

## Ported from Libraries/LibJS/Runtime/PropertyDescriptor.cpp JS::PropertyDescriptor::visit_edges.
## (Added by region r28 for Window::visit_edges; the cross-origin descriptor map is phase 3.)
pub func js_property_descriptor_visit_edges(this: JsPropertyDescriptor*, visitor: gc.CellVisitor*):
    trap("unported (P3): JS::PropertyDescriptor::visit_edges")

## Web::StorageAPI::StorageKey (Libraries/LibWeb/StorageAPI/StorageKey.h:17): opaque in this phase (P2).
## (Added by region r28 for Window::local_storage.)
pub struct StorageApiStorageKey:
    pub var opaque_: u8

## Web::StorageAPI::StorageBottle (Libraries/LibWeb/StorageAPI/StorageBottle.h): opaque in this phase (P2).
## (Added by region r28 for Window::local_storage and session_storage.)
pub struct StorageApiStorageBottle:
    pub var opaque_: u8

## Web::StorageAPI::LocalStorageBottle (Libraries/LibWeb/StorageAPI/StorageBottle.h:55): opaque in this phase (P2).
## (Added by region r28 for Window::local_storage.)
pub struct StorageApiLocalStorageBottle:
    pub var opaque_: u8

## Web::StorageAPI::StorageEndpoint::LOCAL_STORAGE_QUOTA (Libraries/LibWeb/StorageAPI/StorageEndpoint.h:32).
## (Added by region r28 for Window::local_storage.)
pub let storage_api_storage_endpoint_local_storage_quota: u64 = 5 * 1024 * 1024

## Ported from Libraries/LibWeb/StorageAPI/StorageKey.cpp Web::StorageAPI::obtain_a_storage_key.
## (Added by region r28 for Window::local_storage.)
pub func storage_api_obtain_a_storage_key(environment: HtmlEnvironment*) -> StorageApiStorageKey?:
    trap("unported (P3): Web::StorageAPI::obtain_a_storage_key")

## Ported from Libraries/LibWeb/StorageAPI/StorageBottle.h:57 Web::StorageAPI::LocalStorageBottle::create.
## (Added by region r28 for Window::local_storage.)
pub func storage_api_local_storage_bottle_create(heap: gc.Heap*, page: Page*, key: StorageApiStorageKey, quota: u64?) -> StorageApiLocalStorageBottle*:
    trap("unported (P3): Web::StorageAPI::LocalStorageBottle::create")

## Ported from Libraries/LibWeb/StorageAPI/StorageBottle.cpp Web::StorageAPI::obtain_a_session_storage_bottle_map.
## (Added by region r28 for Window::session_storage.)
pub func storage_api_obtain_a_session_storage_bottle_map(environment: HtmlEnvironmentSettingsObject*, endpoint_type: StorageApiStorageEndpointType) -> StorageApiStorageBottle*?:
    trap("unported (P3): Web::StorageAPI::obtain_a_session_storage_bottle_map")

## Web::HTML::Storage::Type (Libraries/LibWeb/HTML/Storage.h:25).
## (Added by region r28 for Window::local_storage and session_storage.)
pub enum HtmlStorageType as i32:
    local_ = 0
    session = 1

## Ported from Libraries/LibWeb/HTML/Storage.cpp Web::HTML::Storage::create.
## (Added by region r28 for Window::local_storage and session_storage.)
pub func html_storage_create(realm: Realm*, type_: HtmlStorageType, map: StorageApiStorageBottle*) -> HtmlStorage*:
    trap("unported (P3): Web::HTML::Storage::create")

## realm.create<Web::HTML::Plugin>(realm, name) (Libraries/LibWeb/HTML/Plugin.cpp).
## (Added by region r28 for Window::pdf_viewer_plugin_objects.)
pub func realm_create_html_plugin(realm: Realm*, realm_: Realm*, name: ak.String) -> HtmlPlugin*:
    trap("unported (P3): Web::HTML::Plugin")

## realm.create<Web::HTML::MimeType>(realm, type) (Libraries/LibWeb/HTML/MimeType.cpp).
## (Added by region r28 for Window::pdf_viewer_mime_type_objects.)
pub func realm_create_html_mime_type(realm: Realm*, realm_: Realm*, type_: ak.String) -> HtmlMimeType*:
    trap("unported (P3): Web::HTML::MimeType")

## Ported from Libraries/LibWeb/RequestIdleCallback/IdleDeadline.cpp Web::RequestIdleCallback::IdleDeadline::create.
## (Added by region r28 for Window::invoke_idle_callbacks.)
pub func request_idle_callback_idle_deadline_create(realm: Realm*) -> RequestIdleCallbackIdleDeadline*:
    trap("unported (P3): Web::RequestIdleCallback::IdleDeadline::create")

## realm.create<Web::HTML::Location>(realm) (Libraries/LibWeb/HTML/Location.cpp).
## (Added by region r28 for Window::location.)
pub func realm_create_html_html_location(realm: Realm*, realm_: Realm*) -> HtmlHtmlLocation*:
    trap("unported (P3): Web::HTML::Location")

## Ported from Libraries/LibWeb/HTML/BarProp.cpp Web::HTML::BarProp::create.
## (Added by region r28 for Window's bar props.)
pub func html_bar_prop_create(realm: Realm*) -> HtmlBarProp*:
    trap("unported (P3): Web::HTML::BarProp::create")

## realm.create<Web::CookieStore::CookieStore>(realm, client) (Libraries/LibWeb/CookieStore/CookieStore.cpp).
## (Added by region r28 for Window::cookie_store.)
pub func realm_create_cookie_store_cookie_store(realm: Realm*, realm_: Realm*, client: PageClient*) -> CookieStoreCookieStore*:
    trap("unported (P4): Web::CookieStore::CookieStore")

## Ported from Libraries/LibWeb/Speech/SpeechSynthesis.cpp Web::Speech::SpeechSynthesis::create.
## (Added by region r28 for Window::speech_synthesis.)
pub func speech_synthesis_create(realm: Realm*) -> SpeechSynthesis*:
    trap("unported (P4): Web::Speech::SpeechSynthesis::create")

## Ported from Libraries/LibWeb/ViewTransition/ViewTransition.cpp Web::ViewTransition::ViewTransition::update_pseudo_element_styles.
## (Added by region r28 for Window::get_computed_style.)
pub func view_transition_view_transition_update_pseudo_element_styles(this: ViewTransitionViewTransition*) -> !:
    trap("unported (P4): Web::ViewTransition::ViewTransition::update_pseudo_element_styles")

## realm.create<Web::HTML::External>(realm) (Libraries/LibWeb/HTML/External.cpp).
## (Added by region r28 for Window::external.)
pub func realm_create_html_external(realm: Realm*, realm_: Realm*) -> HtmlExternal*:
    trap("unported (P3): Web::HTML::External")

## Ported from Libraries/LibCore/System.cpp Core::System::hardware_concurrency.
## (Added by region r28 for NavigatorConcurrentHardwareMixin.)
pub func core_system_hardware_concurrency() -> u64:
    trap("unported (P3): Core::System::hardware_concurrency (LibCore)")

## Ported from Libraries/LibCore/System.cpp Core::System::physical_memory_bytes.
## (Added by region r28 for NavigatorDeviceMemoryMixin.)
pub func core_system_physical_memory_bytes() -> u64:
    trap("unported (P3): Core::System::physical_memory_bytes (LibCore)")

## Ported from Libraries/LibWeb/Gamepad/NavigatorGamepad.cpp:231 Web::Gamepad::NavigatorGamepadPartial::check_for_connected_gamepads.
## (Added by region r28 for Navigator::initialize.) Gamepads are SDL devices (phase 4).
pub func gamepad_navigator_gamepad_partial_check_for_connected_gamepads(this: GamepadNavigatorGamepadPartial*):
    trap("unported (P4): Web::Gamepad::NavigatorGamepadPartial::check_for_connected_gamepads")

## Ported from Libraries/LibWeb/Gamepad/NavigatorGamepad.cpp:71 Web::Gamepad::NavigatorGamepadPartial::visit_edges.
## (Added by region r28 for Navigator::visit_edges.)
pub func gamepad_navigator_gamepad_partial_visit_edges(this: GamepadNavigatorGamepadPartial*, visitor: gc.CellVisitor*):
    for gamepad in ak.vector_span(&this.m_gamepads):
        gc.cell_visitor_visit_cell(visitor, (gc.Cell*?)gamepad)  # opaque in phase 1

## realm.create<Web::HTML::MimeTypeArray>(realm) (Libraries/LibWeb/HTML/MimeTypeArray.cpp).
## (Added by region r28 for Navigator::mime_types.)
pub func realm_create_html_mime_type_array(realm: Realm*, realm_: Realm*) -> HtmlMimeTypeArray*:
    trap("unported (P3): Web::HTML::MimeTypeArray")

## realm.create<Web::HTML::PluginArray>(realm) (Libraries/LibWeb/HTML/PluginArray.cpp).
## (Added by region r28 for Navigator::plugins.)
pub func realm_create_html_plugin_array(realm: Realm*, realm_: Realm*) -> HtmlPluginArray*:
    trap("unported (P3): Web::HTML::PluginArray")

## realm.create<Web::Clipboard::Clipboard>(realm) (Libraries/LibWeb/Clipboard/Clipboard.cpp).
## (Added by region r28 for Navigator::clipboard.)
pub func realm_create_clipboard_clipboard(realm: Realm*, realm_: Realm*) -> ClipboardClipboard*:
    trap("unported (P4): Web::Clipboard::Clipboard")

## realm.create<Web::Geolocation::Geolocation>(realm) (Libraries/LibWeb/Geolocation/Geolocation.cpp).
## (Added by region r28 for Navigator::geolocation.)
pub func realm_create_geolocation_geolocation(realm: Realm*, realm_: Realm*) -> GeolocationGeolocation*:
    trap("unported (P4): Web::Geolocation::Geolocation")

## realm.create<Web::Serial::Serial>(realm) (Libraries/LibWeb/Serial/Serial.cpp).
## (Added by region r28 for Navigator::serial.)
pub func realm_create_serial_serial(realm: Realm*, realm_: Realm*) -> SerialSerial*:
    trap("unported (P4): Web::Serial::Serial")

## realm.create<Web::HTML::UserActivation>(realm) (Libraries/LibWeb/HTML/UserActivation.cpp).
## (Added by region r28 for Navigator::user_activation.)
pub func realm_create_html_user_activation(realm: Realm*, realm_: Realm*) -> HtmlUserActivation*:
    trap("unported (P3): Web::HTML::UserActivation")

## realm.create<Web::CredentialManagement::CredentialsContainer>(realm) (Libraries/LibWeb/CredentialManagement/CredentialsContainer.cpp).
## (Added by region r28 for Navigator::credentials.)
pub func realm_create_credential_management_credentials_container(realm: Realm*, realm_: Realm*) -> CredentialManagementCredentialsContainer*:
    trap("unported (P4): Web::CredentialManagement::CredentialsContainer")

## realm.create<Web::WebXR::XRSystem>(realm) (Libraries/LibWeb/WebXR/XRSystem.cpp).
## (Added by region r28 for Navigator::xr.)
pub func realm_create_web_xr_xr_system(realm: Realm*, realm_: Realm*) -> WebXrXrSystem*:
    trap("unported (P4): Web::WebXR::XRSystem")

## realm.create<Web::ServiceWorker::ServiceWorkerContainer>(realm) (Libraries/LibWeb/ServiceWorker/ServiceWorkerContainer.cpp).
## (Added by region r28 for Navigator::service_worker.)
pub func realm_create_service_worker_service_worker_container(realm: Realm*, realm_: Realm*) -> ServiceWorkerServiceWorkerContainer*:
    trap("unported (P4): Web::ServiceWorker::ServiceWorkerContainer")

## realm.create<Web::MediaCapabilitiesAPI::MediaCapabilities>(realm) (Libraries/LibWeb/MediaCapabilitiesAPI/MediaCapabilities.cpp).
## (Added by region r28 for Navigator::media_capabilities.)
pub func realm_create_media_capabilities_api_media_capabilities(realm: Realm*, realm_: Realm*) -> MediaCapabilitiesApiMediaCapabilities*:
    trap("unported (P4): Web::MediaCapabilitiesAPI::MediaCapabilities")

## realm.create<Web::MediaCapture::MediaDevices>(realm) (Libraries/LibWeb/MediaCapture/MediaDevices.cpp).
## (Added by region r28 for Navigator::media_devices.)
pub func realm_create_media_capture_media_devices(realm: Realm*, realm_: Realm*) -> MediaCaptureMediaDevices*:
    trap("unported (P4): Web::MediaCapture::MediaDevices")

## Ported from Libraries/LibWeb/HTML/AudioPlayState.h:23 Web::HTML::invert_mute_state.
## (Added by region r28 for Page::toggle_page_mute_state; the header is outside the phase-1 files.)
pub func html_invert_mute_state(mute_state: HtmlMuteState) -> HtmlMuteState:
    match mute_state:
        .muted:
            return HtmlMuteState.unmuted
        .unmuted:
            return HtmlMuteState.muted
        _:
            trap("VERIFY_NOT_REACHED")

## Ported from Libraries/LibWeb/Editing/Internal/Algorithms.cpp Web::Editing::is_block_start_point.
## (Added by region r28 for EventHandler's find_paragraph_range.)
pub func editing_is_block_start_point(boundary_point: DomBoundaryPoint) -> bool:
    trap("unported (P3): Web::Editing::is_block_start_point")

## Ported from Libraries/LibWeb/Editing/Internal/Algorithms.cpp Web::Editing::is_block_end_point.
## (Added by region r28 for EventHandler's find_paragraph_range.)
pub func editing_is_block_end_point(boundary_point: DomBoundaryPoint) -> bool:
    trap("unported (P3): Web::Editing::is_block_end_point")

## Ported from Libraries/LibWeb/Editing/Internal/Algorithms.cpp Web::Editing::is_block_boundary_point.
## (Added by region r28 for EventHandler's find_paragraph_range.)
pub func editing_is_block_boundary_point(boundary_point: DomBoundaryPoint) -> bool:
    trap("unported (P3): Web::Editing::is_block_boundary_point")

## Ported from Libraries/LibWeb/Gamepad/NavigatorGamepad.cpp Web::Gamepad::NavigatorGamepadPartial::handle_gamepad_connected.
## (Added by region r28 for EventHandler.)
pub func gamepad_navigator_gamepad_partial_handle_gamepad_connected(this: GamepadNavigatorGamepadPartial*, sdl_joystick_id: u32):
    trap("unported (P4): Web::Gamepad::NavigatorGamepadPartial::handle_gamepad_connected")

## Ported from Libraries/LibWeb/Gamepad/NavigatorGamepad.cpp Web::Gamepad::NavigatorGamepadPartial::handle_gamepad_updated.
## (Added by region r28 for EventHandler.)
pub func gamepad_navigator_gamepad_partial_handle_gamepad_updated(this: GamepadNavigatorGamepadPartial*, sdl_joystick_id: u32):
    trap("unported (P4): Web::Gamepad::NavigatorGamepadPartial::handle_gamepad_updated")

## Ported from Libraries/LibWeb/Gamepad/NavigatorGamepad.cpp Web::Gamepad::NavigatorGamepadPartial::handle_gamepad_disconnected.
## (Added by region r28 for EventHandler.)
pub func gamepad_navigator_gamepad_partial_handle_gamepad_disconnected(this: GamepadNavigatorGamepadPartial*, sdl_joystick_id: u32):
    trap("unported (P4): Web::Gamepad::NavigatorGamepadPartial::handle_gamepad_disconnected")

## The SDL event types EventHandler::handle_sdl_input_events handles (SDL_EventType).
## (Added by region r28.)
pub enum SdlEventType as u32:
    other = 0
    gamepad_added = 0x653
    gamepad_removed = 0x654
    gamepad_update_complete = 0x65a

## What EventHandler::handle_sdl_input_events reads of an SDL_Event: its type and gdevice.which.
## (Added by region r28.)
pub struct SdlEvent:
    pub var type_: SdlEventType
    pub var which: u32

## SDL_PollEvent (SDL3): the next pending SDL event. Gamepads (SDL) are phase 4: SDL is never
## initialized in phase 1, so there is never an event to poll, as SDL_PollEvent answers then.
## (Added by region r28 for EventHandler::handle_sdl_input_events.)
pub func sdl_poll_event() -> SdlEvent?:
    return none

## Web::HTML::DragDataStoreItem::Kind (Libraries/LibWeb/HTML/DragDataStore.h:22).
## (Added by region r28 for DragAndDropEventHandler.)
pub enum HtmlDragDataStoreItemKind as i32:
    text = 0
    file = 1

## Web::HTML::DragDataStoreItem (Libraries/LibWeb/HTML/DragDataStore.h:21).
## (Added by region r28 for DragAndDropEventHandler.)
pub struct HtmlDragDataStoreItem:
    pub var kind: HtmlDragDataStoreItemKind
    pub var type_string: ak.String
    pub var data: ak.ByteBuffer
    pub var file_name: ak.ByteString

## Web::HTML::DragDataStore::Mode (Libraries/LibWeb/HTML/DragDataStore.h:40).
## (Added by region r28 for DragAndDropEventHandler.)
pub enum HtmlDragDataStoreMode as i32:
    read_write = 0
    read_only = 1
    protected = 2

## Ported from Libraries/LibWeb/HTML/DragDataStore.cpp Web::HTML::DragDataStore::create.
## (Added by region r28 for DragAndDropEventHandler.)
pub func html_drag_data_store_create() -> HtmlDragDataStore*:
    trap("unported (P4): Web::HTML::DragDataStore::create")

## Ported from Libraries/LibWeb/HTML/DragDataStore.cpp Web::HTML::DragDataStore::add_item.
## (Added by region r28 for DragAndDropEventHandler.)
pub func html_drag_data_store_add_item(this: HtmlDragDataStore*, item: HtmlDragDataStoreItem):
    trap("unported (P4): Web::HTML::DragDataStore::add_item")

## Ported from Libraries/LibWeb/HTML/DragDataStore.h Web::HTML::DragDataStore::set_mode.
## (Added by region r28 for DragAndDropEventHandler.)
pub func html_drag_data_store_set_mode(this: HtmlDragDataStore*, mode: HtmlDragDataStoreMode):
    trap("unported (P4): Web::HTML::DragDataStore::set_mode")

## Ported from Libraries/LibWeb/HTML/DragDataStore.h Web::HTML::DragDataStore::allowed_effects_state.
## (Added by region r28 for DragAndDropEventHandler.)
pub func html_drag_data_store_allowed_effects_state(this: HtmlDragDataStore*) -> ak.FlyString:
    trap("unported (P4): Web::HTML::DragDataStore::allowed_effects_state")

## Ported from Libraries/LibWeb/HTML/DragDataStore.h Web::HTML::DragDataStore::set_allowed_effects_state.
## (Added by region r28 for DragAndDropEventHandler.)
pub func html_drag_data_store_set_allowed_effects_state(this: HtmlDragDataStore*, allowed_effects_state: ak.FlyString):
    trap("unported (P4): Web::HTML::DragDataStore::set_allowed_effects_state")

## Ported from Libraries/LibWeb/HTML/DragDataStore.cpp Web::HTML::DragDataStore::has_text_item.
## (Added by region r28 for DragAndDropEventHandler.)
pub func html_drag_data_store_has_text_item(this: HtmlDragDataStore*) -> bool:
    trap("unported (P4): Web::HTML::DragDataStore::has_text_item")

## Web::HTML::DataTransfer (Libraries/LibWeb/HTML/DataTransfer.h:36): opaque in this phase (P4).
## (Added by region r28 for DragAndDropEventHandler.)
pub struct HtmlDataTransfer:
    pub var opaque_: u8

## Ported from Libraries/LibWeb/HTML/DataTransfer.cpp Web::HTML::DataTransfer::create.
## (Added by region r28 for DragAndDropEventHandler.)
pub func html_data_transfer_create(realm: Realm*, drag_data_store: HtmlDragDataStore*) -> HtmlDataTransfer*:
    trap("unported (P4): Web::HTML::DataTransfer::create")

## Ported from Libraries/LibWeb/HTML/DataTransfer.h Web::HTML::DataTransfer::effect_allowed.
## (Added by region r28 for DragAndDropEventHandler.)
pub func html_data_transfer_effect_allowed(this: HtmlDataTransfer*) -> ak.FlyString:
    trap("unported (P4): Web::HTML::DataTransfer::effect_allowed")

## Ported from Libraries/LibWeb/HTML/DataTransfer.h Web::HTML::DataTransfer::set_effect_allowed_internal.
## (Added by region r28 for DragAndDropEventHandler.)
pub func html_data_transfer_set_effect_allowed_internal(this: HtmlDataTransfer*, effect_allowed: ak.FlyString):
    trap("unported (P4): Web::HTML::DataTransfer::set_effect_allowed_internal")

## Ported from Libraries/LibWeb/HTML/DataTransfer.h Web::HTML::DataTransfer::drop_effect.
## (Added by region r28 for DragAndDropEventHandler.)
pub func html_data_transfer_drop_effect(this: HtmlDataTransfer*) -> ak.FlyString:
    trap("unported (P4): Web::HTML::DataTransfer::drop_effect")

## Ported from Libraries/LibWeb/HTML/DataTransfer.cpp Web::HTML::DataTransfer::set_drop_effect.
## (Added by region r28 for DragAndDropEventHandler.)
pub func html_data_transfer_set_drop_effect(this: HtmlDataTransfer*, drop_effect: ak.FlyString):
    trap("unported (P4): Web::HTML::DataTransfer::set_drop_effect")

## Ported from Libraries/LibWeb/HTML/DataTransfer.cpp Web::HTML::DataTransfer::disassociate_with_drag_data_store.
## (Added by region r28 for DragAndDropEventHandler.)
pub func html_data_transfer_disassociate_with_drag_data_store(this: HtmlDataTransfer*):
    trap("unported (P4): Web::HTML::DataTransfer::disassociate_with_drag_data_store")

## Web::HTML::DataTransferEffect::none (Libraries/LibWeb/HTML/DataTransfer.h:29; zero until interned).
## (Added by region r28 for DragAndDropEventHandler, as the effects that follow.)
pub var html_data_transfer_effect_none: ak.FlyString
## Web::HTML::DataTransferEffect::copy.
pub var html_data_transfer_effect_copy: ak.FlyString
## Web::HTML::DataTransferEffect::copyLink.
pub var html_data_transfer_effect_copy_link: ak.FlyString
## Web::HTML::DataTransferEffect::copyMove.
pub var html_data_transfer_effect_copy_move: ak.FlyString
## Web::HTML::DataTransferEffect::link.
pub var html_data_transfer_effect_link: ak.FlyString
## Web::HTML::DataTransferEffect::linkMove.
pub var html_data_transfer_effect_link_move: ak.FlyString
## Web::HTML::DataTransferEffect::move.
pub var html_data_transfer_effect_move: ak.FlyString
## Web::HTML::DataTransferEffect::all.
pub var html_data_transfer_effect_all: ak.FlyString
## Web::HTML::DataTransferEffect::uninitialized.
pub var html_data_transfer_effect_uninitialized: ak.FlyString

## Web::HTML::DragEventInit (Libraries/LibWeb/HTML/DragEvent.h:16).
## (Added by region r28 for DragAndDropEventHandler.)
pub struct HtmlDragEventInit:
    pub var mouse_event_init: UiEventsMouseEventInit
    pub var data_transfer: HtmlDataTransfer*?

## Ported from Libraries/LibWeb/HTML/DragEvent.cpp Web::HTML::DragEvent::create (with its init and offsets).
## (Added by region r28 for DragAndDropEventHandler.)
pub func html_drag_event_create_html_drag_event_init(realm: Realm*, event_name: ak.FlyString, event_init: HtmlDragEventInit, page_x: f64, page_y: f64, offset_x: f64, offset_y: f64) -> HtmlDragEvent*:
    trap("unported (P4): Web::HTML::DragEvent::create")

## Ported from Libraries/LibWeb/HTML/DragEvent.h Web::HTML::DragEvent::data_transfer.
## (Added by region r28 for DragAndDropEventHandler.)
pub func html_drag_event_data_transfer(this: HtmlDragEvent*) -> HtmlDataTransfer*?:
    trap("unported (P4): Web::HTML::DragEvent::data_transfer")

## Ported from Libraries/LibWeb/HTML/SelectedFile.h:30 Web::HTML::SelectedFile::name.
## (Added by region r28 for DragAndDropEventHandler.)
pub func html_selected_file_name(this: HtmlSelectedFile*) -> ak.ByteString:
    trap("unported (P4): Web::HTML::SelectedFile::name")

## Ported from Libraries/LibWeb/HTML/SelectedFile.cpp Web::HTML::SelectedFile::take_contents.
## (Added by region r28 for DragAndDropEventHandler.)
pub func html_selected_file_take_contents(this: HtmlSelectedFile*) -> ak.ByteBuffer:
    trap("unported (P4): Web::HTML::SelectedFile::take_contents")

# mark: Declarations outside the phase-1 closure that regions r24/r25 call ===============

## Ported from Libraries/LibJS/Runtime/Date.h:24 JS::Date::date_value.
pub func js_date_date_value(this: JsDate*) -> f64:
    trap("unported (P3): JS::Date::date_value")

## is<JS::Date> of a JS object.
pub func is_js_date(object: JsObject*) -> bool:
    trap("unported (P3): is<JS::Date>")

## Ported from Libraries/LibJS/Runtime/Value.cpp JS::Value::get(VM&, PropertyKey const&).
pub func js_value_get(this: JsValue, vm: Vm*, property_key: ak.Utf16FlyString) -> JsValue!:
    trap("unported (P3): JS::Value::get")

## Ported from Libraries/LibWeb/FileAPI/FileList.cpp Web::FileAPI::FileList::create.
pub func file_api_file_list_create(realm: Realm*) -> FileApiFileList*:
    trap("unported (P4): Web::FileAPI::FileList::create")

## Ported from Libraries/LibWeb/FileAPI/FileList.h Web::FileAPI::FileList::add_file.
pub func file_api_file_list_add_file(this: FileApiFileList*, file: FileApiFile*):
    trap("unported (P4): Web::FileAPI::FileList::add_file")

## Web::HTML::CommandEventInit (Libraries/LibWeb/HTML/CommandEvent.h): the event init of a command event.
pub struct HtmlCommandEventInit:
    pub var event_init: DomEventInit
    pub var command: ak.String
    pub var source: DomElement*?

## Ported from Libraries/LibWeb/HTML/CommandEvent.cpp Web::HTML::CommandEvent::create (the event as its DOM::Event).
pub func html_command_event_create(realm: Realm*, event_name: ak.FlyString, event_init: HtmlCommandEventInit) -> DomEvent*:
    trap("unported (P4): Web::HTML::CommandEvent::create")

## Ported from Libraries/LibWeb/Geometry/DOMPointReadOnly.h:34 Web::Geometry::DOMPointReadOnly::create.
## (Added by region r55 for SVGSVGElement::current_translate.)
pub func geometry_dom_point_read_only_create(realm: Realm*) -> GeometryDomPointReadOnly*:
    trap("unported (P3): Web::Geometry::DOMPointReadOnly::create")

## Ported from Libraries/LibWeb/Geometry/DOMPoint.h:24 Web::Geometry::DOMPoint::from_point, with the default
## (all-zero) DOMPointInit, whose dictionary is phase 3. (Added by region r55 for SVGSVGElement::create_svg_point.)
pub func geometry_dom_point_from_point(vm: Vm*) -> GeometryDomPoint*:
    trap("unported (P3): Web::Geometry::DOMPoint::from_point")

## Ported from Libraries/LibWeb/Geometry/DOMPoint.h:21 Web::Geometry::DOMPoint::construct_impl.
## (Added by region r55 for SVGGeometryElement::get_point_at_length.)
pub func geometry_dom_point_construct_impl(realm: Realm*, x: f64 = 0.0, y: f64 = 0.0, z: f64 = 0.0, w: f64 = 1.0) -> GeometryDomPoint*:
    trap("unported (P3): Web::Geometry::DOMPoint::construct_impl")

# mark: Region p2e (CSP): TrustedTypes and WebAssembly declarations outside the phase-2 closure ==

## `value.as_if<TrustedTypes::TrustedScript>()` of a JS value (TrustedScript is phase 3).
pub func js_value_as_if_trusted_types_trusted_script(value: JsValue) -> TrustedTypesTrustedScript*?:
    trap("unported (P3): JS::Value::as_if<Web::TrustedTypes::TrustedScript>")

## Ported from Libraries/LibWeb/TrustedTypes/TrustedScript.h Web::TrustedTypes::TrustedScript::to_string.
pub func trusted_types_trusted_script_to_string(this: TrustedTypesTrustedScript*) -> ak.Utf16String:
    trap("unported (P3): Web::TrustedTypes::TrustedScript::to_string")

## realm.create<Web::TrustedTypes::TrustedScript>(realm, data).
pub func realm_create_trusted_types_trusted_script(realm: Realm*, data: ak.Utf16String) -> TrustedTypesTrustedScript*:
    trap("unported (P3): Web::TrustedTypes::TrustedScript::TrustedScript")

## `vm.throw_completion<WebAssembly::CompileError>(message)` (WebAssembly is phase 4).
pub func vm_throw_completion_web_assembly_compile_error(vm: Vm*, message: ak.StringView) -> never!:
    trap("unported (P4): WebAssembly::CompileError")

## Ported from Libraries/LibWeb/HTML/WorkerGlobalScope.h Web::HTML::WorkerGlobalScope::url (workers are phase 4).
pub func html_worker_global_scope_url(this: HtmlWorkerGlobalScope*) -> web_url.Url:
    trap("unported (P4): Web::HTML::WorkerGlobalScope::url")

# mark: Region p2c (Fetch::Fetching): ResourceTiming and a Blob body source outside the phase-2 closure ==

## Ported from Libraries/LibWeb/Fetch/BodyInit.cpp:26 Web::Fetch::safely_extract_body (of a Blob, the GC::Ref<FileAPI::Blob>
## alternative of BodyInitOrReadableBytes; Blobs are phase 3).
pub func fetch_safely_extract_body_blob(realm: Realm*, blob: FileApiBlob*) -> FetchBodyWithType:
    trap("unported (P3): Web::Fetch::safely_extract_body (of a Blob)")

# mark: Region p2r: what destroying a document reaches of messaging (phase 4) ==================

## Ported from Libraries/LibWeb/HTML/EventSource.cpp Web::HTML::EventSource::forcibly_close.
pub func html_event_source_forcibly_close(this: HtmlEventSource*):
    trap("unported (P4): Web::HTML::EventSource::forcibly_close")

## Ported from Libraries/LibWeb/WebSockets/WebSocket.cpp Web::WebSockets::WebSocket::make_disappear.
pub func web_sockets_web_socket_make_disappear(this: WebSocketsWebSocket*):
    trap("unported (P4): Web::WebSockets::WebSocket::make_disappear")