2023-06-12 14:55:43 -03: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 03:14:45 -03:00
|
|
|
#include <LibWeb/Painting/PaintableBox.h>
|
2023-06-12 14:55:43 -03:00
|
|
|
|
|
|
|
|
namespace Web::Layout {
|
|
|
|
|
|
2024-11-14 12:01:23 -03:00
|
|
|
GC_DEFINE_ALLOCATOR(AudioBox);
|
2024-04-06 14:16:04 -03:00
|
|
|
|
2024-12-20 12:35:12 -03:00
|
|
|
AudioBox::AudioBox(DOM::Document& document, DOM::Element& element, GC::Ref<CSS::ComputedProperties> style)
|
2026-02-20 22:54:03 -03:00
|
|
|
: ReplacedBox(document, element, style)
|
2023-06-12 14:55:43 -03:00
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
HTML::HTMLAudioElement& AudioBox::dom_node()
|
|
|
|
|
{
|
2025-07-26 09:22:50 -03:00
|
|
|
return static_cast<HTML::HTMLAudioElement&>(*ReplacedBox::dom_node());
|
2023-06-12 14:55:43 -03:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
HTML::HTMLAudioElement const& AudioBox::dom_node() const
|
|
|
|
|
{
|
2025-07-26 09:22:50 -03:00
|
|
|
return static_cast<HTML::HTMLAudioElement const&>(*ReplacedBox::dom_node());
|
2023-06-12 14:55:43 -03:00
|
|
|
}
|
|
|
|
|
|
2026-02-21 03:14:45 -03:00
|
|
|
bool AudioBox::can_have_children() const
|
2023-06-12 14:55:43 -03:00
|
|
|
{
|
2026-02-21 03:14:45 -03:00
|
|
|
// If we allow children when controls are disabled, innerText may be non-empty.
|
|
|
|
|
return dom_node().shadow_root() != nullptr;
|
2023-06-12 14:55:43 -03:00
|
|
|
}
|
|
|
|
|
|
2026-05-07 08:38:05 -03:00
|
|
|
RefPtr<Painting::Paintable> AudioBox::create_paintable() const
|
2025-01-04 08:13:40 -03:00
|
|
|
{
|
2026-02-21 03:14:45 -03:00
|
|
|
return Painting::PaintableBox::create(*this);
|
2025-01-04 08:13:40 -03:00
|
|
|
}
|
|
|
|
|
|
2023-06-12 14:55:43 -03:00
|
|
|
}
|