mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-06-05 09:52:54 +00:00
Everywhere: Hoist the Libraries folder to the top-level
This commit is contained in:
parent
950e819ee7
commit
93712b24bf
Notes:
github-actions[bot]
2024-11-10 11:51:52 +00:00
Author: https://github.com/trflynn89
Commit: 93712b24bf
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/2256
Reviewed-by: https://github.com/sideshowbarker
4547 changed files with 104 additions and 113 deletions
74
Libraries/LibWeb/HTML/HTMLAudioElement.cpp
Normal file
74
Libraries/LibWeb/HTML/HTMLAudioElement.cpp
Normal file
|
@ -0,0 +1,74 @@
|
|||
/*
|
||||
* Copyright (c) 2020, the SerenityOS developers.
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#include <LibWeb/Bindings/HTMLAudioElementPrototype.h>
|
||||
#include <LibWeb/HTML/AudioTrack.h>
|
||||
#include <LibWeb/HTML/AudioTrackList.h>
|
||||
#include <LibWeb/HTML/HTMLAudioElement.h>
|
||||
#include <LibWeb/HTML/Window.h>
|
||||
#include <LibWeb/Layout/AudioBox.h>
|
||||
|
||||
namespace Web::HTML {
|
||||
|
||||
JS_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)
|
||||
{
|
||||
Base::initialize(realm);
|
||||
WEB_SET_PROTOTYPE_FOR_INTERFACE(HTMLAudioElement);
|
||||
}
|
||||
|
||||
JS::GCPtr<Layout::Node> HTMLAudioElement::create_layout_node(CSS::StyleProperties style)
|
||||
{
|
||||
return heap().allocate_without_realm<Layout::AudioBox>(document(), *this, move(style));
|
||||
}
|
||||
|
||||
Layout::AudioBox* HTMLAudioElement::layout_node()
|
||||
{
|
||||
return static_cast<Layout::AudioBox*>(Node::layout_node());
|
||||
}
|
||||
|
||||
Layout::AudioBox const* HTMLAudioElement::layout_node() const
|
||||
{
|
||||
return static_cast<Layout::AudioBox const*>(Node::layout_node());
|
||||
}
|
||||
|
||||
void HTMLAudioElement::on_playing()
|
||||
{
|
||||
audio_tracks()->for_each_enabled_track([](auto& audio_track) {
|
||||
audio_track.play({});
|
||||
});
|
||||
}
|
||||
|
||||
void HTMLAudioElement::on_paused()
|
||||
{
|
||||
audio_tracks()->for_each_enabled_track([](auto& audio_track) {
|
||||
audio_track.pause({});
|
||||
});
|
||||
}
|
||||
|
||||
void HTMLAudioElement::on_seek(double position, MediaSeekMode seek_mode)
|
||||
{
|
||||
audio_tracks()->for_each_enabled_track([&](auto& audio_track) {
|
||||
audio_track.seek(position, seek_mode);
|
||||
});
|
||||
}
|
||||
|
||||
void HTMLAudioElement::on_volume_change()
|
||||
{
|
||||
audio_tracks()->for_each_enabled_track([&](auto& audio_track) {
|
||||
audio_track.update_volume();
|
||||
});
|
||||
}
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue