mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-04-25 17:25:08 +02:00
Previously, the LibWeb bindings generator would output multiple per interface files like Prototype/Constructor/Namespace/GlobalMixin depending on the contents of that IDL file. This complicates the build system as it means that it does not know what files will be generated without knowledge of the contents of that IDL file. Instead, for each IDL file only generate a single Bindings/<IDLFile>.h and Bindings/<IDLFile>.cpp.
61 lines
1.7 KiB
C++
61 lines
1.7 KiB
C++
/*
|
|
* Copyright (c) 2020, the SerenityOS developers.
|
|
*
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
*/
|
|
|
|
#include <LibWeb/Bindings/HTMLAudioElement.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);
|
|
}
|
|
|
|
void HTMLAudioElement::adjust_computed_style(CSS::ComputedProperties& style)
|
|
{
|
|
Base::adjust_computed_style(style);
|
|
|
|
// https://html.spec.whatwg.org/multipage/rendering.html#embedded-content-rendering-rules
|
|
if (!has_attribute(AttributeNames::controls))
|
|
style.set_property(CSS::PropertyID::Display, CSS::DisplayStyleValue::create(CSS::Display::from_short(CSS::Display::Short::None)));
|
|
}
|
|
|
|
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());
|
|
}
|
|
|
|
}
|