mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2026-04-18 18:00:31 +00:00
These are the same code, so we may as well move them up the chain. This becomes useful in a later commit, where it will be used to rewrite inline-flow to inline-block for layout of shadow DOM.
51 lines
1.3 KiB
C++
51 lines
1.3 KiB
C++
/*
|
|
* Copyright (c) 2020, the SerenityOS developers.
|
|
*
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
*/
|
|
|
|
#include <LibWeb/Bindings/HTMLAudioElementPrototype.h>
|
|
#include <LibWeb/CSS/ComputedProperties.h>
|
|
#include <LibWeb/CSS/StyleValues/DisplayStyleValue.h>
|
|
#include <LibWeb/HTML/HTMLAudioElement.h>
|
|
#include <LibWeb/HTML/Window.h>
|
|
#include <LibWeb/Layout/AudioBox.h>
|
|
|
|
namespace Web::HTML {
|
|
|
|
GC_DEFINE_ALLOCATOR(HTMLAudioElement);
|
|
|
|
HTMLAudioElement::HTMLAudioElement(DOM::Document& document, DOM::QualifiedName qualified_name)
|
|
: HTMLMediaElement(document, move(qualified_name))
|
|
{
|
|
}
|
|
|
|
HTMLAudioElement::~HTMLAudioElement() = default;
|
|
|
|
void HTMLAudioElement::initialize(JS::Realm& realm)
|
|
{
|
|
WEB_SET_PROTOTYPE_FOR_INTERFACE(HTMLAudioElement);
|
|
Base::initialize(realm);
|
|
}
|
|
|
|
GC::Ptr<Layout::Node> HTMLAudioElement::create_layout_node(GC::Ref<CSS::ComputedProperties> style)
|
|
{
|
|
return heap().allocate<Layout::AudioBox>(document(), *this, style);
|
|
}
|
|
|
|
Layout::AudioBox* HTMLAudioElement::layout_node()
|
|
{
|
|
return static_cast<Layout::AudioBox*>(Node::layout_node());
|
|
}
|
|
|
|
bool HTMLAudioElement::should_paint() const
|
|
{
|
|
return has_attribute(HTML::AttributeNames::controls) || is_scripting_disabled();
|
|
}
|
|
|
|
Layout::AudioBox const* HTMLAudioElement::layout_node() const
|
|
{
|
|
return static_cast<Layout::AudioBox const*>(Node::layout_node());
|
|
}
|
|
|
|
}
|