2023-06-12 13:55:43 -04:00
|
|
|
/*
|
|
|
|
|
* Copyright (c) 2023, Tim Flynn <trflynn89@serenityos.org>
|
|
|
|
|
*
|
|
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#include <LibWeb/HTML/HTMLAudioElement.h>
|
|
|
|
|
#include <LibWeb/Layout/AudioBox.h>
|
2026-02-21 00:14:45 -06:00
|
|
|
#include <LibWeb/Painting/PaintableBox.h>
|
2023-06-12 13:55:43 -04:00
|
|
|
|
|
|
|
|
namespace Web::Layout {
|
|
|
|
|
|
2026-06-06 14:03:41 +02:00
|
|
|
AudioBox::AudioBox(DOM::Document& document, DOM::Element& element, CSS::ComputedProperties const& style)
|
2026-02-20 19:54:03 -06:00
|
|
|
: ReplacedBox(document, element, style)
|
2023-06-12 13:55:43 -04:00
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
HTML::HTMLAudioElement& AudioBox::dom_node()
|
|
|
|
|
{
|
2025-07-26 14:22:50 +02:00
|
|
|
return static_cast<HTML::HTMLAudioElement&>(*ReplacedBox::dom_node());
|
2023-06-12 13:55:43 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
HTML::HTMLAudioElement const& AudioBox::dom_node() const
|
|
|
|
|
{
|
2025-07-26 14:22:50 +02:00
|
|
|
return static_cast<HTML::HTMLAudioElement const&>(*ReplacedBox::dom_node());
|
2023-06-12 13:55:43 -04:00
|
|
|
}
|
|
|
|
|
|
2026-02-21 00:14:45 -06:00
|
|
|
bool AudioBox::can_have_children() const
|
2023-06-12 13:55:43 -04:00
|
|
|
{
|
2026-02-21 00:14:45 -06:00
|
|
|
// If we allow children when controls are disabled, innerText may be non-empty.
|
|
|
|
|
return dom_node().shadow_root() != nullptr;
|
2023-06-12 13:55:43 -04:00
|
|
|
}
|
|
|
|
|
|
2026-05-07 13:38:05 +02:00
|
|
|
RefPtr<Painting::Paintable> AudioBox::create_paintable() const
|
2025-01-04 12:13:40 +01:00
|
|
|
{
|
2026-02-21 00:14:45 -06:00
|
|
|
return Painting::PaintableBox::create(*this);
|
2025-01-04 12:13:40 +01:00
|
|
|
}
|
|
|
|
|
|
2023-06-12 13:55:43 -04:00
|
|
|
}
|