Luce packages
LuceLuce BaseLuciaOS

dymokomi/luce-browser-engine

Source of release 0.6.1

0.6.1 / src / web / generated / html / media_controls_dom.lucb

#==============================================================================================
#
#   media_controls_dom - HTML::MediaControlsDOM: the DOM of MediaControls.html
#
#   DESCRIPTION:
#       Generated by tools/gen_dom_tree from data/html/MediaControls.html; do not edit.
#       The C++ it stands for, at Ladybird 47c82b38d0, is
#       Build/Libraries/LibWeb/HTML/MediaControlsDOM.cpp,
#       written by Meta/Generators/generate_dom_tree.py.
#
#       Copyright (c) 2026, the Ladybird developers.
#       SPDX-License-Identifier: BSD-2-Clause (see data/html/LICENSE)
#
#==============================================================================================

## The style sheet MediaControls.css, stripped (MediaControlsDOM.cpp's `html_media_controls_dom_stylesheet_source_1`).
let html_media_controls_dom_stylesheet_source_1: str = """

.container {
    --accent-color: #9d7cf2;
    --dark-accent-color: #8a64e5;
    --light-accent-color: #e0d4ff;
    --foreground-color: white;
    --track-color: rgb(20, 20, 20);
    --panel-color: rgb(38, 38, 38);

    overflow: hidden;
}

.container.video {
    position: relative;
    width: 100%;
    height: 100%;
}

.controls {
    display: flex;
    flex-direction: column;
    font-family: sans-serif;
    font-size: 12px;
    color: var(--foreground-color);
    user-select: none;
}

.container.video > .controls {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: color-mix(in srgb, var(--panel-color) 82%, transparent);
    opacity: 0;
    pointer-events: none;
    transition: opacity 150ms ease-in-out;
}

.container.video > .controls.visible {
    opacity: 1;
    pointer-events: auto;
}

.container.audio > .controls {
    inset: 0;
    background: var(--panel-color);
    justify-content: center;
}

.timeline {
    z-index: 1;
    height: 5px;
    padding: 5px 0;
    margin: -5px 0;
    background: var(--track-color);
    background-clip: content-box;
    cursor: pointer;
    flex-shrink: 0;
    text-align: left;
}

.timeline-fill {
    height: 100%;
    background: var(--accent-color);
    width: 0%;
    pointer-events: none;
}

.button-bar {
    display: flex;
    align-items: center;
    padding: 4px 8px;
    gap: 8px;
    min-height: 30px;
}

.control-button {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
}

.icon {
    width: 24px;
    height: 24px;
}

.control-button .icon path {
    fill: var(--foreground-color);
}

.control-button:hover .icon path {
    fill: var(--light-accent-color);
}

.play-pause-icon path {
    display: none;
}
.play-pause-icon:not(.playing) .play-path {
    display: inline;
}
.play-pause-icon.playing .pause-path {
    display: inline;
}

.mute-button {
    margin-left: auto;
}

.mute-button:not(.low, .high) > .icon > .volume-low {
    display: none;
}
.mute-button:not(.high) > .icon > .volume-high {
    display: none;
}

.mute-button.muted > .icon > .volume-low,
.mute-button.muted > .icon > .volume-high,
.mute-button.muted > .icon > .speaker {
    clip-path: url(#muted-clip);
}
.mute-button:not(.muted) > .icon > .muted-line {
    display: none;
}

.timestamp {
    min-width: 0;
    overflow: clip;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

.volume-area {
    max-width: 60px;
    flex-grow: 1;
    padding: 5px;
    margin: -5px;
    cursor: pointer;
}

.volume-area.hidden {
    display: none;
}

.volume {
    height: 6px;
    background: var(--track-color);
    border-radius: 3px;
    overflow: hidden;
    position: relative;
}

.volume-fill {
    height: 100%;
    width: 100%;
    background: var(--accent-color);
    pointer-events: none;
}

.video-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.fullscreen-icon path {
    display: none;
}
.fullscreen-icon:not(.fullscreen) .fullscreen-maximize-path {
    display: inline;
}
.fullscreen-icon.fullscreen .fullscreen-minimize-path {
    display: inline;
}

.placeholder-circle {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: var(--panel-color);
    opacity: 80%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.placeholder-circle:hover {
    background: var(--panel-color);
    opacity: 100%;
}

.placeholder-circle path {
    fill: var(--light-accent-color);
}

.placeholder-icon {
    width: 36px;
    height: 36px;
    margin-left: 4px;
}
"""

## Web::HTML::MediaControlsDOM::MediaControlsDOM(DOM::Document&, DOM::Node& parent, Options): builds the
## template's DOM under `parent`, naming its data-name elements in `this`.
pub func html_media_controls_dom_construct(this: HtmlMediaControlsDom*, document: DomDocument*, parent: DomNode*, options: HtmlMediaControlsDomOptions = HtmlMediaControlsDomOptions.none_):
    # The fields' default member initializers: every GC::Weak starts null.
    let no_element: DomElement*? = none
    this.container = gc.make_weak(no_element)
    this.video_overlay = gc.make_weak(no_element)
    this.placeholder_circle = gc.make_weak(no_element)
    this.control_bar = gc.make_weak(no_element)
    this.timeline_element = gc.make_weak(no_element)
    this.timeline_fill = gc.make_weak(no_element)
    this.play_button = gc.make_weak(no_element)
    this.play_pause_icon = gc.make_weak(no_element)
    this.timestamp_element = gc.make_weak(no_element)
    this.mute_button = gc.make_weak(no_element)
    this.volume_area = gc.make_weak(no_element)
    this.volume_element = gc.make_weak(no_element)
    this.volume_fill = gc.make_weak(no_element)
    this.fullscreen_button = gc.make_weak(no_element)
    this.fullscreen_icon = gc.make_weak(no_element)

    let element_1 = dom_create_element(document, html_tag_names_style, namespace_html) else trap("MUST: DOM::create_element")
    dom_node_set_text_content(element_1.dom_node(), ak.utf16_string_from_str(html_media_controls_dom_stylesheet_source_1)) else trap("MUST: set_text_content")
    _ = dom_node_append_child(parent, element_1.dom_node()) else trap("MUST: append_child")

    let container = dom_create_element(document, html_tag_names_div, namespace_html) else trap("MUST: DOM::create_element")
    this.container = gc.make_weak(container)
    dom_element_set_attribute_value(container, html_attribute_names_class, ak.string_from_str("container"))
    _ = dom_node_append_child(parent, container.dom_node()) else trap("MUST: append_child")

    if ((u8)options & (u8)HtmlMediaControlsDomOptions.video) != 0:
        let video_overlay = dom_create_element(document, html_tag_names_div, namespace_html) else trap("MUST: DOM::create_element")
        this.video_overlay = gc.make_weak(video_overlay)
        dom_element_set_attribute_value(video_overlay, html_attribute_names_class, ak.string_from_str("video-overlay"))
        _ = dom_node_append_child(container.dom_node(), video_overlay.dom_node()) else trap("MUST: append_child")

        let placeholder_circle = dom_create_element(document, html_tag_names_div, namespace_html) else trap("MUST: DOM::create_element")
        this.placeholder_circle = gc.make_weak(placeholder_circle)
        dom_element_set_attribute_value(placeholder_circle, html_attribute_names_class, ak.string_from_str("placeholder-circle"))
        _ = dom_node_append_child(video_overlay.dom_node(), placeholder_circle.dom_node()) else trap("MUST: append_child")

        let element_2 = dom_create_element(document, svg_tag_names_svg, namespace_svg) else trap("MUST: DOM::create_element")
        dom_element_set_attribute_value(element_2, svg_attribute_names_class, ak.string_from_str("placeholder-icon"))
        dom_element_set_attribute_value(element_2, svg_attribute_names_view_box, ak.string_from_str("0 0 24 24"))
        _ = dom_node_append_child(placeholder_circle.dom_node(), element_2.dom_node()) else trap("MUST: append_child")

        let element_3 = dom_create_element(document, svg_tag_names_path, namespace_svg) else trap("MUST: DOM::create_element")
        dom_element_set_attribute_value(element_3, svg_attribute_names_class, ak.string_from_str("play-path"))
        dom_element_set_attribute_value(element_3, svg_attribute_names_d, ak.string_from_str("m6 5 13 7-13 7Z"))
        _ = dom_node_append_child(element_2.dom_node(), element_3.dom_node()) else trap("MUST: append_child")
    # Options::Video

    let control_bar = dom_create_element(document, html_tag_names_div, namespace_html) else trap("MUST: DOM::create_element")
    this.control_bar = gc.make_weak(control_bar)
    dom_element_set_attribute_value(control_bar, html_attribute_names_class, ak.string_from_str("controls"))
    _ = dom_node_append_child(container.dom_node(), control_bar.dom_node()) else trap("MUST: append_child")

    let timeline_element = dom_create_element(document, html_tag_names_div, namespace_html) else trap("MUST: DOM::create_element")
    this.timeline_element = gc.make_weak(timeline_element)
    dom_element_set_attribute_value(timeline_element, html_attribute_names_class, ak.string_from_str("timeline"))
    _ = dom_node_append_child(control_bar.dom_node(), timeline_element.dom_node()) else trap("MUST: append_child")

    let timeline_fill = dom_create_element(document, html_tag_names_div, namespace_html) else trap("MUST: DOM::create_element")
    this.timeline_fill = gc.make_weak(timeline_fill)
    dom_element_set_attribute_value(timeline_fill, html_attribute_names_class, ak.string_from_str("timeline-fill"))
    _ = dom_node_append_child(timeline_element.dom_node(), timeline_fill.dom_node()) else trap("MUST: append_child")

    let element_4 = dom_create_element(document, html_tag_names_div, namespace_html) else trap("MUST: DOM::create_element")
    dom_element_set_attribute_value(element_4, html_attribute_names_class, ak.string_from_str("button-bar"))
    _ = dom_node_append_child(control_bar.dom_node(), element_4.dom_node()) else trap("MUST: append_child")

    let play_button = dom_create_element(document, html_tag_names_button, namespace_html) else trap("MUST: DOM::create_element")
    this.play_button = gc.make_weak(play_button)
    dom_element_set_attribute_value(play_button, html_attribute_names_class, ak.string_from_str("control-button play-pause-button"))
    _ = dom_node_append_child(element_4.dom_node(), play_button.dom_node()) else trap("MUST: append_child")

    let play_pause_icon = dom_create_element(document, svg_tag_names_svg, namespace_svg) else trap("MUST: DOM::create_element")
    this.play_pause_icon = gc.make_weak(play_pause_icon)
    dom_element_set_attribute_value(play_pause_icon, svg_attribute_names_class, ak.string_from_str("icon play-pause-icon"))
    dom_element_set_attribute_value(play_pause_icon, svg_attribute_names_view_box, ak.string_from_str("0 0 24 24"))
    _ = dom_node_append_child(play_button.dom_node(), play_pause_icon.dom_node()) else trap("MUST: append_child")

    let element_5 = dom_create_element(document, svg_tag_names_path, namespace_svg) else trap("MUST: DOM::create_element")
    dom_element_set_attribute_value(element_5, svg_attribute_names_class, ak.string_from_str("play-path"))
    dom_element_set_attribute_value(element_5, svg_attribute_names_d, ak.string_from_str("m6 5 13 7-13 7Z"))
    _ = dom_node_append_child(play_pause_icon.dom_node(), element_5.dom_node()) else trap("MUST: append_child")

    let element_6 = dom_create_element(document, svg_tag_names_path, namespace_svg) else trap("MUST: DOM::create_element")
    dom_element_set_attribute_value(element_6, svg_attribute_names_class, ak.string_from_str("pause-path"))
    dom_element_set_attribute_value(element_6, svg_attribute_names_d, ak.string_from_str("M14 5h4v14h-4Zm-4 0H6v14h4z"))
    _ = dom_node_append_child(play_pause_icon.dom_node(), element_6.dom_node()) else trap("MUST: append_child")

    let timestamp_element = dom_create_element(document, html_tag_names_span, namespace_html) else trap("MUST: DOM::create_element")
    this.timestamp_element = gc.make_weak(timestamp_element)
    dom_element_set_attribute_value(timestamp_element, html_attribute_names_class, ak.string_from_str("timestamp"))
    _ = dom_node_append_child(element_4.dom_node(), timestamp_element.dom_node()) else trap("MUST: append_child")

    dom_node_set_text_content(timestamp_element.dom_node(), ak.utf16_string_from_str("0:00 / 0:00")) else trap("MUST: set_text_content")

    let mute_button = dom_create_element(document, html_tag_names_button, namespace_html) else trap("MUST: DOM::create_element")
    this.mute_button = gc.make_weak(mute_button)
    dom_element_set_attribute_value(mute_button, html_attribute_names_class, ak.string_from_str("control-button mute-button"))
    _ = dom_node_append_child(element_4.dom_node(), mute_button.dom_node()) else trap("MUST: append_child")

    let element_7 = dom_create_element(document, svg_tag_names_svg, namespace_svg) else trap("MUST: DOM::create_element")
    dom_element_set_attribute_value(element_7, svg_attribute_names_class, ak.string_from_str("icon"))
    dom_element_set_attribute_value(element_7, svg_attribute_names_view_box, ak.string_from_str("0 0 24 24"))
    _ = dom_node_append_child(mute_button.dom_node(), element_7.dom_node()) else trap("MUST: append_child")

    let element_8 = dom_create_element(document, svg_tag_names_defs, namespace_svg) else trap("MUST: DOM::create_element")
    _ = dom_node_append_child(element_7.dom_node(), element_8.dom_node()) else trap("MUST: append_child")

    let element_9 = dom_create_element(document, svg_tag_names_clip_path, namespace_svg) else trap("MUST: DOM::create_element")
    dom_element_set_attribute_value(element_9, html_attribute_names_id, ak.string_from_str("muted-clip"))
    _ = dom_node_append_child(element_8.dom_node(), element_9.dom_node()) else trap("MUST: append_child")

    let element_10 = dom_create_element(document, svg_tag_names_path, namespace_svg) else trap("MUST: DOM::create_element")
    dom_element_set_attribute_value(element_10, svg_attribute_names_d, ak.string_from_str("M3 0h21v21ZM0 0v24h24z"))
    _ = dom_node_append_child(element_9.dom_node(), element_10.dom_node()) else trap("MUST: append_child")

    let element_11 = dom_create_element(document, svg_tag_names_path, namespace_svg) else trap("MUST: DOM::create_element")
    dom_element_set_attribute_value(element_11, svg_attribute_names_class, ak.string_from_str("muted-line"))
    dom_element_set_attribute_value(element_11, svg_attribute_names_d, ak.string_from_str("m5 5 14 14-1.5 1.5-14-14z"))
    _ = dom_node_append_child(element_7.dom_node(), element_11.dom_node()) else trap("MUST: append_child")

    let element_12 = dom_create_element(document, svg_tag_names_path, namespace_svg) else trap("MUST: DOM::create_element")
    dom_element_set_attribute_value(element_12, svg_attribute_names_class, ak.string_from_str("volume-high"))
    dom_element_set_attribute_value(element_12, svg_attribute_names_d, ak.string_from_str("M14 4.08v2.04c2.23.55 4 2.9 4 5.88 0 2.97-1.77 5.33-4 5.88v2.04c3.45-.56 6-3.96 6-7.92s-2.55-7.36-6-7.92Z"))
    _ = dom_node_append_child(element_7.dom_node(), element_12.dom_node()) else trap("MUST: append_child")

    let element_13 = dom_create_element(document, svg_tag_names_path, namespace_svg) else trap("MUST: DOM::create_element")
    dom_element_set_attribute_value(element_13, svg_attribute_names_class, ak.string_from_str("volume-low"))
    dom_element_set_attribute_value(element_13, svg_attribute_names_d, ak.string_from_str("M14 7.67v8.66c.35-.25.66-.55.92-.9A5.7 5.7 0 0 0 16 12c0-1.3-.39-2.5-1.08-3.43a4.24 4.24 0 0 0-.92-.9Z"))
    _ = dom_node_append_child(element_7.dom_node(), element_13.dom_node()) else trap("MUST: append_child")

    let element_14 = dom_create_element(document, svg_tag_names_path, namespace_svg) else trap("MUST: DOM::create_element")
    dom_element_set_attribute_value(element_14, svg_attribute_names_class, ak.string_from_str("speaker"))
    dom_element_set_attribute_value(element_14, svg_attribute_names_d, ak.string_from_str("M4 9v6h4l4 5V4L8 9Z"))
    _ = dom_node_append_child(element_7.dom_node(), element_14.dom_node()) else trap("MUST: append_child")

    let volume_area = dom_create_element(document, html_tag_names_div, namespace_html) else trap("MUST: DOM::create_element")
    this.volume_area = gc.make_weak(volume_area)
    dom_element_set_attribute_value(volume_area, html_attribute_names_class, ak.string_from_str("volume-area"))
    _ = dom_node_append_child(element_4.dom_node(), volume_area.dom_node()) else trap("MUST: append_child")

    let volume_element = dom_create_element(document, html_tag_names_div, namespace_html) else trap("MUST: DOM::create_element")
    this.volume_element = gc.make_weak(volume_element)
    dom_element_set_attribute_value(volume_element, html_attribute_names_class, ak.string_from_str("volume"))
    _ = dom_node_append_child(volume_area.dom_node(), volume_element.dom_node()) else trap("MUST: append_child")

    let volume_fill = dom_create_element(document, html_tag_names_div, namespace_html) else trap("MUST: DOM::create_element")
    this.volume_fill = gc.make_weak(volume_fill)
    dom_element_set_attribute_value(volume_fill, html_attribute_names_class, ak.string_from_str("volume-fill"))
    _ = dom_node_append_child(volume_element.dom_node(), volume_fill.dom_node()) else trap("MUST: append_child")

    if ((u8)options & (u8)HtmlMediaControlsDomOptions.video) != 0:
        let fullscreen_button = dom_create_element(document, html_tag_names_div, namespace_html) else trap("MUST: DOM::create_element")
        this.fullscreen_button = gc.make_weak(fullscreen_button)
        dom_element_set_attribute_value(fullscreen_button, html_attribute_names_class, ak.string_from_str("control-button fullscreen-button"))
        _ = dom_node_append_child(element_4.dom_node(), fullscreen_button.dom_node()) else trap("MUST: append_child")

        let fullscreen_icon = dom_create_element(document, svg_tag_names_svg, namespace_svg) else trap("MUST: DOM::create_element")
        this.fullscreen_icon = gc.make_weak(fullscreen_icon)
        dom_element_set_attribute_value(fullscreen_icon, svg_attribute_names_class, ak.string_from_str("icon fullscreen-icon"))
        dom_element_set_attribute_value(fullscreen_icon, svg_attribute_names_view_box, ak.string_from_str("0 0 24 24"))
        _ = dom_node_append_child(fullscreen_button.dom_node(), fullscreen_icon.dom_node()) else trap("MUST: append_child")

        let element_15 = dom_create_element(document, svg_tag_names_path, namespace_svg) else trap("MUST: DOM::create_element")
        dom_element_set_attribute_value(element_15, svg_attribute_names_class, ak.string_from_str("fullscreen-maximize-path"))
        dom_element_set_attribute_value(element_15, svg_attribute_names_d, ak.string_from_str("M3 3h6v2H5v4H3Zm12 0h6v6h-2V5h-4Zm6 12v6h-6v-2h4v-4ZM3 15v6h6v-2H5v-4Z"))
        _ = dom_node_append_child(fullscreen_icon.dom_node(), element_15.dom_node()) else trap("MUST: append_child")

        let element_16 = dom_create_element(document, svg_tag_names_path, namespace_svg) else trap("MUST: DOM::create_element")
        dom_element_set_attribute_value(element_16, svg_attribute_names_class, ak.string_from_str("fullscreen-minimize-path"))
        dom_element_set_attribute_value(element_16, svg_attribute_names_d, ak.string_from_str("M9 3v6H3V7h4V3Zm6 0v6h6V7h-4V3ZM3 15h6v6H7v-4H3Zm12 0v6h2v-4h4v-2Z"))
        _ = dom_node_append_child(fullscreen_icon.dom_node(), element_16.dom_node()) else trap("MUST: append_child")
    # Options::Video