Move ComputedProperties and CascadedProperties out of the GC. They no longer contain strong references to GC-managed data. Keep computed styles alive from DOM elements and animation updates with RefPtr. Pass style into layout constructors by reference, since layout only copies the values it needs while building nodes. Use GC::Weak for cascade source links, so entries no longer keep the style declaration or shadow root alive.
41 lines
1,010 B
C++
41 lines
1,010 B
C++
/*
|
|
* Copyright (c) 2023, Tim Flynn <trflynn89@serenityos.org>
|
|
*
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
*/
|
|
|
|
#include <LibWeb/HTML/HTMLAudioElement.h>
|
|
#include <LibWeb/Layout/AudioBox.h>
|
|
#include <LibWeb/Painting/PaintableBox.h>
|
|
|
|
namespace Web::Layout {
|
|
|
|
GC_DEFINE_ALLOCATOR(AudioBox);
|
|
|
|
AudioBox::AudioBox(DOM::Document& document, DOM::Element& element, CSS::ComputedProperties const& style)
|
|
: ReplacedBox(document, element, style)
|
|
{
|
|
}
|
|
|
|
HTML::HTMLAudioElement& AudioBox::dom_node()
|
|
{
|
|
return static_cast<HTML::HTMLAudioElement&>(*ReplacedBox::dom_node());
|
|
}
|
|
|
|
HTML::HTMLAudioElement const& AudioBox::dom_node() const
|
|
{
|
|
return static_cast<HTML::HTMLAudioElement const&>(*ReplacedBox::dom_node());
|
|
}
|
|
|
|
bool AudioBox::can_have_children() const
|
|
{
|
|
// If we allow children when controls are disabled, innerText may be non-empty.
|
|
return dom_node().shadow_root() != nullptr;
|
|
}
|
|
|
|
RefPtr<Painting::Paintable> AudioBox::create_paintable() const
|
|
{
|
|
return Painting::PaintableBox::create(*this);
|
|
}
|
|
|
|
}
|