From b4a454aaea87098b86b1419086c5b6cc6b56da39 Mon Sep 17 00:00:00 2001 From: Ashwin Naren Date: Sat, 23 Aug 2025 22:15:44 -0700 Subject: [PATCH] script: Move webaudio DOM interfaces to `script/dom/audio/` (#38894) Moves interfaces defined by the webaudio spec (27 files) to the new `script/dom/audio/` module from the `script/dom/` module. Testing: Just a refactor shouldn't need any testing Fixes: N/A Signed-off-by: Ashwin Naren --- .../script/dom/{ => audio}/analysernode.rs | 4 +-- .../script/dom/{ => audio}/audiobuffer.rs | 4 +-- .../dom/{ => audio}/audiobuffersourcenode.rs | 8 ++--- .../script/dom/{ => audio}/audiocontext.rs | 10 +++--- .../dom/{ => audio}/audiodestinationnode.rs | 4 +-- .../script/dom/{ => audio}/audiolistener.rs | 4 +-- .../script/dom/{ => audio}/audionode.rs | 4 +-- .../script/dom/{ => audio}/audioparam.rs | 2 +- .../{ => audio}/audioscheduledsourcenode.rs | 4 +-- .../script/dom/{ => audio}/audiotrack.rs | 2 +- .../script/dom/{ => audio}/audiotracklist.rs | 2 +- .../dom/{ => audio}/baseaudiocontext.rs | 30 +++++++++--------- .../dom/{ => audio}/biquadfilternode.rs | 6 ++-- .../dom/{ => audio}/channelmergernode.rs | 4 +-- .../dom/{ => audio}/channelsplitternode.rs | 4 +-- .../dom/{ => audio}/constantsourcenode.rs | 6 ++-- components/script/dom/{ => audio}/gainnode.rs | 6 ++-- .../script/dom/{ => audio}/iirfilternode.rs | 4 +-- .../mediaelementaudiosourcenode.rs | 4 +-- .../mediastreamaudiodestinationnode.rs | 4 +-- .../{ => audio}/mediastreamaudiosourcenode.rs | 4 +-- .../mediastreamtrackaudiosourcenode.rs | 4 +-- components/script/dom/audio/mod.rs | 31 +++++++++++++++++++ .../offlineaudiocompletionevent.rs | 2 +- .../dom/{ => audio}/offlineaudiocontext.rs | 8 ++--- .../script/dom/{ => audio}/oscillatornode.rs | 8 ++--- .../script/dom/{ => audio}/pannernode.rs | 6 ++-- .../dom/{ => audio}/stereopannernode.rs | 8 ++--- components/script/dom/htmlmediaelement.rs | 4 +-- components/script/dom/mod.rs | 29 ++--------------- components/script/dom/trackevent.rs | 2 +- 31 files changed, 114 insertions(+), 108 deletions(-) rename components/script/dom/{ => audio}/analysernode.rs (98%) rename components/script/dom/{ => audio}/audiobuffer.rs (99%) rename components/script/dom/{ => audio}/audiobuffersourcenode.rs (97%) rename components/script/dom/{ => audio}/audiocontext.rs (96%) rename components/script/dom/{ => audio}/audiodestinationnode.rs (92%) rename components/script/dom/{ => audio}/audiolistener.rs (98%) rename components/script/dom/{ => audio}/audionode.rs (99%) rename components/script/dom/{ => audio}/audioparam.rs (99%) rename components/script/dom/{ => audio}/audioscheduledsourcenode.rs (96%) rename components/script/dom/{ => audio}/audiotrack.rs (98%) rename components/script/dom/{ => audio}/audiotracklist.rs (99%) rename components/script/dom/{ => audio}/baseaudiocontext.rs (96%) rename components/script/dom/{ => audio}/biquadfilternode.rs (97%) rename components/script/dom/{ => audio}/channelmergernode.rs (95%) rename components/script/dom/{ => audio}/channelsplitternode.rs (95%) rename components/script/dom/{ => audio}/constantsourcenode.rs (95%) rename components/script/dom/{ => audio}/gainnode.rs (95%) rename components/script/dom/{ => audio}/iirfilternode.rs (97%) rename components/script/dom/{ => audio}/mediaelementaudiosourcenode.rs (97%) rename components/script/dom/{ => audio}/mediastreamaudiodestinationnode.rs (96%) rename components/script/dom/{ => audio}/mediastreamaudiosourcenode.rs (97%) rename components/script/dom/{ => audio}/mediastreamtrackaudiosourcenode.rs (96%) create mode 100644 components/script/dom/audio/mod.rs rename components/script/dom/{ => audio}/offlineaudiocompletionevent.rs (98%) rename components/script/dom/{ => audio}/offlineaudiocontext.rs (96%) rename components/script/dom/{ => audio}/oscillatornode.rs (96%) rename components/script/dom/{ => audio}/pannernode.rs (98%) rename components/script/dom/{ => audio}/stereopannernode.rs (94%) diff --git a/components/script/dom/analysernode.rs b/components/script/dom/audio/analysernode.rs similarity index 98% rename from components/script/dom/analysernode.rs rename to components/script/dom/audio/analysernode.rs index 85d6a18af9f..ab571159325 100644 --- a/components/script/dom/analysernode.rs +++ b/components/script/dom/audio/analysernode.rs @@ -11,8 +11,8 @@ use servo_media::audio::analyser_node::AnalysisEngine; use servo_media::audio::block::Block; use servo_media::audio::node::AudioNodeInit; -use crate::dom::audionode::{AudioNode, AudioNodeOptionsHelper}; -use crate::dom::baseaudiocontext::BaseAudioContext; +use crate::dom::audio::audionode::{AudioNode, AudioNodeOptionsHelper}; +use crate::dom::audio::baseaudiocontext::BaseAudioContext; use crate::dom::bindings::cell::DomRefCell; use crate::dom::bindings::codegen::Bindings::AnalyserNodeBinding::{ AnalyserNodeMethods, AnalyserOptions, diff --git a/components/script/dom/audiobuffer.rs b/components/script/dom/audio/audiobuffer.rs similarity index 99% rename from components/script/dom/audiobuffer.rs rename to components/script/dom/audio/audiobuffer.rs index 025a608bacd..7b323e25141 100644 --- a/components/script/dom/audiobuffer.rs +++ b/components/script/dom/audio/audiobuffer.rs @@ -9,8 +9,8 @@ use js::rust::{CustomAutoRooterGuard, HandleObject}; use js::typedarray::{Float32, Float32Array}; use servo_media::audio::buffer_source_node::AudioBuffer as ServoMediaAudioBuffer; -use super::bindings::buffer_source::HeapBufferSource; -use crate::dom::audionode::MAX_CHANNEL_COUNT; +use crate::dom::audio::audionode::MAX_CHANNEL_COUNT; +use crate::dom::bindings::buffer_source::HeapBufferSource; use crate::dom::bindings::cell::{DomRefCell, Ref}; use crate::dom::bindings::codegen::Bindings::AudioBufferBinding::{ AudioBufferMethods, AudioBufferOptions, diff --git a/components/script/dom/audiobuffersourcenode.rs b/components/script/dom/audio/audiobuffersourcenode.rs similarity index 97% rename from components/script/dom/audiobuffersourcenode.rs rename to components/script/dom/audio/audiobuffersourcenode.rs index a0a5226cd6a..f4c2c7627e0 100644 --- a/components/script/dom/audiobuffersourcenode.rs +++ b/components/script/dom/audio/audiobuffersourcenode.rs @@ -14,10 +14,10 @@ use servo_media::audio::node::{AudioNodeInit, AudioNodeMessage, AudioNodeType}; use servo_media::audio::param::ParamType; use crate::conversions::Convert; -use crate::dom::audiobuffer::AudioBuffer; -use crate::dom::audioparam::AudioParam; -use crate::dom::audioscheduledsourcenode::AudioScheduledSourceNode; -use crate::dom::baseaudiocontext::BaseAudioContext; +use crate::dom::audio::audiobuffer::AudioBuffer; +use crate::dom::audio::audioparam::AudioParam; +use crate::dom::audio::audioscheduledsourcenode::AudioScheduledSourceNode; +use crate::dom::audio::baseaudiocontext::BaseAudioContext; use crate::dom::bindings::codegen::Bindings::AudioBufferSourceNodeBinding::{ AudioBufferSourceNodeMethods, AudioBufferSourceOptions, }; diff --git a/components/script/dom/audiocontext.rs b/components/script/dom/audio/audiocontext.rs similarity index 96% rename from components/script/dom/audiocontext.rs rename to components/script/dom/audio/audiocontext.rs index 97b2c27c92f..2d00441e910 100644 --- a/components/script/dom/audiocontext.rs +++ b/components/script/dom/audio/audiocontext.rs @@ -10,7 +10,11 @@ use js::rust::HandleObject; use servo_media::audio::context::{LatencyCategory, ProcessingState, RealTimeAudioContextOptions}; use crate::conversions::Convert; -use crate::dom::baseaudiocontext::{BaseAudioContext, BaseAudioContextOptions}; +use crate::dom::audio::baseaudiocontext::{BaseAudioContext, BaseAudioContextOptions}; +use crate::dom::audio::mediaelementaudiosourcenode::MediaElementAudioSourceNode; +use crate::dom::audio::mediastreamaudiodestinationnode::MediaStreamAudioDestinationNode; +use crate::dom::audio::mediastreamaudiosourcenode::MediaStreamAudioSourceNode; +use crate::dom::audio::mediastreamtrackaudiosourcenode::MediaStreamTrackAudioSourceNode; use crate::dom::bindings::codegen::Bindings::AudioContextBinding::{ AudioContextLatencyCategory, AudioContextMethods, AudioContextOptions, AudioTimestamp, }; @@ -25,12 +29,8 @@ use crate::dom::bindings::refcounted::{Trusted, TrustedPromise}; use crate::dom::bindings::reflector::{DomGlobal, reflect_dom_object_with_proto}; use crate::dom::bindings::root::DomRoot; use crate::dom::htmlmediaelement::HTMLMediaElement; -use crate::dom::mediaelementaudiosourcenode::MediaElementAudioSourceNode; use crate::dom::mediastream::MediaStream; -use crate::dom::mediastreamaudiodestinationnode::MediaStreamAudioDestinationNode; -use crate::dom::mediastreamaudiosourcenode::MediaStreamAudioSourceNode; use crate::dom::mediastreamtrack::MediaStreamTrack; -use crate::dom::mediastreamtrackaudiosourcenode::MediaStreamTrackAudioSourceNode; use crate::dom::promise::Promise; use crate::dom::window::Window; use crate::realms::InRealm; diff --git a/components/script/dom/audiodestinationnode.rs b/components/script/dom/audio/audiodestinationnode.rs similarity index 92% rename from components/script/dom/audiodestinationnode.rs rename to components/script/dom/audio/audiodestinationnode.rs index c20620336d0..c07156ed1a6 100644 --- a/components/script/dom/audiodestinationnode.rs +++ b/components/script/dom/audio/audiodestinationnode.rs @@ -4,8 +4,8 @@ use dom_struct::dom_struct; -use crate::dom::audionode::{AudioNode, AudioNodeOptionsHelper, MAX_CHANNEL_COUNT}; -use crate::dom::baseaudiocontext::BaseAudioContext; +use crate::dom::audio::audionode::{AudioNode, AudioNodeOptionsHelper, MAX_CHANNEL_COUNT}; +use crate::dom::audio::baseaudiocontext::BaseAudioContext; use crate::dom::bindings::codegen::Bindings::AudioDestinationNodeBinding::AudioDestinationNodeMethods; use crate::dom::bindings::codegen::Bindings::AudioNodeBinding::{ AudioNodeOptions, ChannelCountMode, ChannelInterpretation, diff --git a/components/script/dom/audiolistener.rs b/components/script/dom/audio/audiolistener.rs similarity index 98% rename from components/script/dom/audiolistener.rs rename to components/script/dom/audio/audiolistener.rs index a832560c06f..b28a787f57f 100644 --- a/components/script/dom/audiolistener.rs +++ b/components/script/dom/audio/audiolistener.rs @@ -8,8 +8,8 @@ use dom_struct::dom_struct; use servo_media::audio::node::AudioNodeType; use servo_media::audio::param::{ParamDir, ParamType}; -use crate::dom::audioparam::AudioParam; -use crate::dom::baseaudiocontext::BaseAudioContext; +use crate::dom::audio::audioparam::AudioParam; +use crate::dom::audio::baseaudiocontext::BaseAudioContext; use crate::dom::bindings::codegen::Bindings::AudioListenerBinding::AudioListenerMethods; use crate::dom::bindings::codegen::Bindings::AudioParamBinding::{ AudioParamMethods, AutomationRate, diff --git a/components/script/dom/audionode.rs b/components/script/dom/audio/audionode.rs similarity index 99% rename from components/script/dom/audionode.rs rename to components/script/dom/audio/audionode.rs index 4e572dda437..aa54c7697b7 100644 --- a/components/script/dom/audionode.rs +++ b/components/script/dom/audio/audionode.rs @@ -15,8 +15,8 @@ use servo_media::audio::node::{ }; use crate::conversions::Convert; -use crate::dom::audioparam::AudioParam; -use crate::dom::baseaudiocontext::BaseAudioContext; +use crate::dom::audio::audioparam::AudioParam; +use crate::dom::audio::baseaudiocontext::BaseAudioContext; use crate::dom::bindings::codegen::Bindings::AudioNodeBinding::{ AudioNodeMethods, AudioNodeOptions, ChannelCountMode, ChannelInterpretation, }; diff --git a/components/script/dom/audioparam.rs b/components/script/dom/audio/audioparam.rs similarity index 99% rename from components/script/dom/audioparam.rs rename to components/script/dom/audio/audioparam.rs index 23edd78d39a..a79afb3f303 100644 --- a/components/script/dom/audioparam.rs +++ b/components/script/dom/audio/audioparam.rs @@ -11,7 +11,7 @@ use servo_media::audio::node::{AudioNodeMessage, AudioNodeType}; use servo_media::audio::param::{ParamRate, ParamType, RampKind, UserAutomationEvent}; use crate::conversions::Convert; -use crate::dom::baseaudiocontext::BaseAudioContext; +use crate::dom::audio::baseaudiocontext::BaseAudioContext; use crate::dom::bindings::codegen::Bindings::AudioParamBinding::{ AudioParamMethods, AutomationRate, }; diff --git a/components/script/dom/audioscheduledsourcenode.rs b/components/script/dom/audio/audioscheduledsourcenode.rs similarity index 96% rename from components/script/dom/audioscheduledsourcenode.rs rename to components/script/dom/audio/audioscheduledsourcenode.rs index 5c7976dda09..f3bd935f8f6 100644 --- a/components/script/dom/audioscheduledsourcenode.rs +++ b/components/script/dom/audio/audioscheduledsourcenode.rs @@ -9,8 +9,8 @@ use servo_media::audio::node::{ AudioNodeInit, AudioNodeMessage, AudioScheduledSourceNodeMessage, OnEndedCallback, }; -use crate::dom::audionode::{AudioNode, UnwrappedAudioNodeOptions}; -use crate::dom::baseaudiocontext::BaseAudioContext; +use crate::dom::audio::audionode::{AudioNode, UnwrappedAudioNodeOptions}; +use crate::dom::audio::baseaudiocontext::BaseAudioContext; use crate::dom::bindings::codegen::Bindings::AudioScheduledSourceNodeBinding::AudioScheduledSourceNodeMethods; use crate::dom::bindings::error::{Error, Fallible}; use crate::dom::bindings::inheritance::Castable; diff --git a/components/script/dom/audiotrack.rs b/components/script/dom/audio/audiotrack.rs similarity index 98% rename from components/script/dom/audiotrack.rs rename to components/script/dom/audio/audiotrack.rs index 919d6d98060..dd3d8cc528e 100644 --- a/components/script/dom/audiotrack.rs +++ b/components/script/dom/audio/audiotrack.rs @@ -6,7 +6,7 @@ use std::cell::Cell; use dom_struct::dom_struct; -use crate::dom::audiotracklist::AudioTrackList; +use crate::dom::audio::audiotracklist::AudioTrackList; use crate::dom::bindings::cell::DomRefCell; use crate::dom::bindings::codegen::Bindings::AudioTrackBinding::AudioTrackMethods; use crate::dom::bindings::reflector::{Reflector, reflect_dom_object}; diff --git a/components/script/dom/audiotracklist.rs b/components/script/dom/audio/audiotracklist.rs similarity index 99% rename from components/script/dom/audiotracklist.rs rename to components/script/dom/audio/audiotracklist.rs index 570ca9f8644..0b17b195401 100644 --- a/components/script/dom/audiotracklist.rs +++ b/components/script/dom/audio/audiotracklist.rs @@ -4,7 +4,7 @@ use dom_struct::dom_struct; -use crate::dom::audiotrack::AudioTrack; +use crate::dom::audio::audiotrack::AudioTrack; use crate::dom::bindings::cell::DomRefCell; use crate::dom::bindings::codegen::Bindings::AudioTrackListBinding::AudioTrackListMethods; use crate::dom::bindings::inheritance::Castable; diff --git a/components/script/dom/baseaudiocontext.rs b/components/script/dom/audio/baseaudiocontext.rs similarity index 96% rename from components/script/dom/baseaudiocontext.rs rename to components/script/dom/audio/baseaudiocontext.rs index 0e24c8c2fcd..c375b705a3a 100644 --- a/components/script/dom/baseaudiocontext.rs +++ b/components/script/dom/audio/baseaudiocontext.rs @@ -22,12 +22,21 @@ use servo_media::{ClientContextId, ServoMedia}; use uuid::Uuid; use crate::conversions::Convert; -use crate::dom::analysernode::AnalyserNode; -use crate::dom::audiobuffer::AudioBuffer; -use crate::dom::audiobuffersourcenode::AudioBufferSourceNode; -use crate::dom::audiodestinationnode::AudioDestinationNode; -use crate::dom::audiolistener::AudioListener; -use crate::dom::audionode::MAX_CHANNEL_COUNT; +use crate::dom::audio::analysernode::AnalyserNode; +use crate::dom::audio::audiobuffer::AudioBuffer; +use crate::dom::audio::audiobuffersourcenode::AudioBufferSourceNode; +use crate::dom::audio::audiodestinationnode::AudioDestinationNode; +use crate::dom::audio::audiolistener::AudioListener; +use crate::dom::audio::audionode::MAX_CHANNEL_COUNT; +use crate::dom::audio::biquadfilternode::BiquadFilterNode; +use crate::dom::audio::channelmergernode::ChannelMergerNode; +use crate::dom::audio::channelsplitternode::ChannelSplitterNode; +use crate::dom::audio::constantsourcenode::ConstantSourceNode; +use crate::dom::audio::gainnode::GainNode; +use crate::dom::audio::iirfilternode::IIRFilterNode; +use crate::dom::audio::oscillatornode::OscillatorNode; +use crate::dom::audio::pannernode::PannerNode; +use crate::dom::audio::stereopannernode::StereoPannerNode; use crate::dom::bindings::callback::ExceptionHandling; use crate::dom::bindings::cell::DomRefCell; use crate::dom::bindings::codegen::Bindings::AnalyserNodeBinding::AnalyserOptions; @@ -53,18 +62,9 @@ use crate::dom::bindings::num::Finite; use crate::dom::bindings::refcounted::Trusted; use crate::dom::bindings::reflector::DomGlobal; use crate::dom::bindings::root::{DomRoot, MutNullableDom}; -use crate::dom::biquadfilternode::BiquadFilterNode; -use crate::dom::channelmergernode::ChannelMergerNode; -use crate::dom::channelsplitternode::ChannelSplitterNode; -use crate::dom::constantsourcenode::ConstantSourceNode; use crate::dom::domexception::{DOMErrorName, DOMException}; use crate::dom::eventtarget::EventTarget; -use crate::dom::gainnode::GainNode; -use crate::dom::iirfilternode::IIRFilterNode; -use crate::dom::oscillatornode::OscillatorNode; -use crate::dom::pannernode::PannerNode; use crate::dom::promise::Promise; -use crate::dom::stereopannernode::StereoPannerNode; use crate::realms::InRealm; use crate::script_runtime::CanGc; diff --git a/components/script/dom/biquadfilternode.rs b/components/script/dom/audio/biquadfilternode.rs similarity index 97% rename from components/script/dom/biquadfilternode.rs rename to components/script/dom/audio/biquadfilternode.rs index 635dddd92c6..68ceb90041e 100644 --- a/components/script/dom/biquadfilternode.rs +++ b/components/script/dom/audio/biquadfilternode.rs @@ -14,9 +14,9 @@ use servo_media::audio::node::{AudioNodeInit, AudioNodeMessage, AudioNodeType}; use servo_media::audio::param::ParamType; use crate::conversions::Convert; -use crate::dom::audionode::{AudioNode, AudioNodeOptionsHelper}; -use crate::dom::audioparam::AudioParam; -use crate::dom::baseaudiocontext::BaseAudioContext; +use crate::dom::audio::audionode::{AudioNode, AudioNodeOptionsHelper}; +use crate::dom::audio::audioparam::AudioParam; +use crate::dom::audio::baseaudiocontext::BaseAudioContext; use crate::dom::bindings::codegen::Bindings::AudioNodeBinding::{ ChannelCountMode, ChannelInterpretation, }; diff --git a/components/script/dom/channelmergernode.rs b/components/script/dom/audio/channelmergernode.rs similarity index 95% rename from components/script/dom/channelmergernode.rs rename to components/script/dom/audio/channelmergernode.rs index e39bf69dbb4..97df72858fa 100644 --- a/components/script/dom/channelmergernode.rs +++ b/components/script/dom/audio/channelmergernode.rs @@ -8,8 +8,8 @@ use servo_media::audio::channel_node::ChannelNodeOptions; use servo_media::audio::node::AudioNodeInit; use crate::conversions::Convert; -use crate::dom::audionode::{AudioNode, AudioNodeOptionsHelper, MAX_CHANNEL_COUNT}; -use crate::dom::baseaudiocontext::BaseAudioContext; +use crate::dom::audio::audionode::{AudioNode, AudioNodeOptionsHelper, MAX_CHANNEL_COUNT}; +use crate::dom::audio::baseaudiocontext::BaseAudioContext; use crate::dom::bindings::codegen::Bindings::AudioNodeBinding::{ ChannelCountMode, ChannelInterpretation, }; diff --git a/components/script/dom/channelsplitternode.rs b/components/script/dom/audio/channelsplitternode.rs similarity index 95% rename from components/script/dom/channelsplitternode.rs rename to components/script/dom/audio/channelsplitternode.rs index 67ac479efeb..7417918041f 100644 --- a/components/script/dom/channelsplitternode.rs +++ b/components/script/dom/audio/channelsplitternode.rs @@ -6,8 +6,8 @@ use dom_struct::dom_struct; use js::rust::HandleObject; use servo_media::audio::node::AudioNodeInit; -use crate::dom::audionode::{AudioNode, AudioNodeOptionsHelper, MAX_CHANNEL_COUNT}; -use crate::dom::baseaudiocontext::BaseAudioContext; +use crate::dom::audio::audionode::{AudioNode, AudioNodeOptionsHelper, MAX_CHANNEL_COUNT}; +use crate::dom::audio::baseaudiocontext::BaseAudioContext; use crate::dom::bindings::codegen::Bindings::AudioNodeBinding::{ ChannelCountMode, ChannelInterpretation, }; diff --git a/components/script/dom/constantsourcenode.rs b/components/script/dom/audio/constantsourcenode.rs similarity index 95% rename from components/script/dom/constantsourcenode.rs rename to components/script/dom/audio/constantsourcenode.rs index 308cff83345..1c1e94b10da 100644 --- a/components/script/dom/constantsourcenode.rs +++ b/components/script/dom/audio/constantsourcenode.rs @@ -11,9 +11,9 @@ use servo_media::audio::node::{AudioNodeInit, AudioNodeType}; use servo_media::audio::param::ParamType; use crate::conversions::Convert; -use crate::dom::audioparam::AudioParam; -use crate::dom::audioscheduledsourcenode::AudioScheduledSourceNode; -use crate::dom::baseaudiocontext::BaseAudioContext; +use crate::dom::audio::audioparam::AudioParam; +use crate::dom::audio::audioscheduledsourcenode::AudioScheduledSourceNode; +use crate::dom::audio::baseaudiocontext::BaseAudioContext; use crate::dom::bindings::codegen::Bindings::AudioParamBinding::AutomationRate; use crate::dom::bindings::codegen::Bindings::ConstantSourceNodeBinding::{ ConstantSourceNodeMethods, ConstantSourceOptions, diff --git a/components/script/dom/gainnode.rs b/components/script/dom/audio/gainnode.rs similarity index 95% rename from components/script/dom/gainnode.rs rename to components/script/dom/audio/gainnode.rs index c3854be719a..170a4616172 100644 --- a/components/script/dom/gainnode.rs +++ b/components/script/dom/audio/gainnode.rs @@ -11,9 +11,9 @@ use servo_media::audio::node::{AudioNodeInit, AudioNodeType}; use servo_media::audio::param::ParamType; use crate::conversions::Convert; -use crate::dom::audionode::{AudioNode, AudioNodeOptionsHelper}; -use crate::dom::audioparam::AudioParam; -use crate::dom::baseaudiocontext::BaseAudioContext; +use crate::dom::audio::audionode::{AudioNode, AudioNodeOptionsHelper}; +use crate::dom::audio::audioparam::AudioParam; +use crate::dom::audio::baseaudiocontext::BaseAudioContext; use crate::dom::bindings::codegen::Bindings::AudioNodeBinding::{ ChannelCountMode, ChannelInterpretation, }; diff --git a/components/script/dom/iirfilternode.rs b/components/script/dom/audio/iirfilternode.rs similarity index 97% rename from components/script/dom/iirfilternode.rs rename to components/script/dom/audio/iirfilternode.rs index 20578ec6d4a..3d7128a4a5b 100644 --- a/components/script/dom/iirfilternode.rs +++ b/components/script/dom/audio/iirfilternode.rs @@ -13,8 +13,8 @@ use servo_media::audio::iir_filter_node::{IIRFilterNode as IIRFilter, IIRFilterN use servo_media::audio::node::AudioNodeInit; use crate::conversions::Convert; -use crate::dom::audionode::{AudioNode, AudioNodeOptionsHelper}; -use crate::dom::baseaudiocontext::BaseAudioContext; +use crate::dom::audio::audionode::{AudioNode, AudioNodeOptionsHelper}; +use crate::dom::audio::baseaudiocontext::BaseAudioContext; use crate::dom::bindings::codegen::Bindings::AudioNodeBinding::{ ChannelCountMode, ChannelInterpretation, }; diff --git a/components/script/dom/mediaelementaudiosourcenode.rs b/components/script/dom/audio/mediaelementaudiosourcenode.rs similarity index 97% rename from components/script/dom/mediaelementaudiosourcenode.rs rename to components/script/dom/audio/mediaelementaudiosourcenode.rs index 7d612a7a26d..656d6287dc9 100644 --- a/components/script/dom/mediaelementaudiosourcenode.rs +++ b/components/script/dom/audio/mediaelementaudiosourcenode.rs @@ -9,8 +9,8 @@ use js::rust::HandleObject; use servo_media::audio::media_element_source_node::MediaElementSourceNodeMessage; use servo_media::audio::node::{AudioNodeInit, AudioNodeMessage}; -use crate::dom::audiocontext::AudioContext; -use crate::dom::audionode::AudioNode; +use crate::dom::audio::audiocontext::AudioContext; +use crate::dom::audio::audionode::AudioNode; use crate::dom::bindings::codegen::Bindings::MediaElementAudioSourceNodeBinding::{ MediaElementAudioSourceNodeMethods, MediaElementAudioSourceOptions, }; diff --git a/components/script/dom/mediastreamaudiodestinationnode.rs b/components/script/dom/audio/mediastreamaudiodestinationnode.rs similarity index 96% rename from components/script/dom/mediastreamaudiodestinationnode.rs rename to components/script/dom/audio/mediastreamaudiodestinationnode.rs index f8d43cd86d6..b761f3568c2 100644 --- a/components/script/dom/mediastreamaudiodestinationnode.rs +++ b/components/script/dom/audio/mediastreamaudiodestinationnode.rs @@ -8,8 +8,8 @@ use servo_media::ServoMedia; use servo_media::audio::node::AudioNodeInit; use servo_media::streams::MediaStreamType; -use crate::dom::audiocontext::AudioContext; -use crate::dom::audionode::{AudioNode, AudioNodeOptionsHelper}; +use crate::dom::audio::audiocontext::AudioContext; +use crate::dom::audio::audionode::{AudioNode, AudioNodeOptionsHelper}; use crate::dom::bindings::codegen::Bindings::AudioNodeBinding::{ AudioNodeOptions, ChannelCountMode, ChannelInterpretation, }; diff --git a/components/script/dom/mediastreamaudiosourcenode.rs b/components/script/dom/audio/mediastreamaudiosourcenode.rs similarity index 97% rename from components/script/dom/mediastreamaudiosourcenode.rs rename to components/script/dom/audio/mediastreamaudiosourcenode.rs index b60dbea377e..6c7b8e5a528 100644 --- a/components/script/dom/mediastreamaudiosourcenode.rs +++ b/components/script/dom/audio/mediastreamaudiosourcenode.rs @@ -7,8 +7,8 @@ use js::rust::HandleObject; use servo_media::audio::node::AudioNodeInit; use servo_media::streams::MediaStreamType; -use crate::dom::audiocontext::AudioContext; -use crate::dom::audionode::AudioNode; +use crate::dom::audio::audiocontext::AudioContext; +use crate::dom::audio::audionode::AudioNode; use crate::dom::bindings::codegen::Bindings::MediaStreamAudioSourceNodeBinding::{ MediaStreamAudioSourceNodeMethods, MediaStreamAudioSourceOptions, }; diff --git a/components/script/dom/mediastreamtrackaudiosourcenode.rs b/components/script/dom/audio/mediastreamtrackaudiosourcenode.rs similarity index 96% rename from components/script/dom/mediastreamtrackaudiosourcenode.rs rename to components/script/dom/audio/mediastreamtrackaudiosourcenode.rs index f8bb9717682..1aa71fe2f29 100644 --- a/components/script/dom/mediastreamtrackaudiosourcenode.rs +++ b/components/script/dom/audio/mediastreamtrackaudiosourcenode.rs @@ -6,8 +6,8 @@ use dom_struct::dom_struct; use js::rust::HandleObject; use servo_media::audio::node::AudioNodeInit; -use crate::dom::audiocontext::AudioContext; -use crate::dom::audionode::AudioNode; +use crate::dom::audio::audiocontext::AudioContext; +use crate::dom::audio::audionode::AudioNode; use crate::dom::bindings::codegen::Bindings::MediaStreamTrackAudioSourceNodeBinding::{ MediaStreamTrackAudioSourceNodeMethods, MediaStreamTrackAudioSourceOptions, }; diff --git a/components/script/dom/audio/mod.rs b/components/script/dom/audio/mod.rs new file mode 100644 index 00000000000..1fa3e119c07 --- /dev/null +++ b/components/script/dom/audio/mod.rs @@ -0,0 +1,31 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ + +pub(crate) mod analysernode; +pub(crate) mod audiobuffer; +pub(crate) mod audiobuffersourcenode; +pub(crate) mod audiocontext; +pub(crate) mod audiodestinationnode; +pub(crate) mod audiolistener; +pub(crate) mod audionode; +pub(crate) mod audioparam; +pub(crate) mod audioscheduledsourcenode; +pub(crate) mod audiotrack; +pub(crate) mod audiotracklist; +pub(crate) mod baseaudiocontext; +pub(crate) mod biquadfilternode; +pub(crate) mod channelmergernode; +pub(crate) mod channelsplitternode; +pub(crate) mod constantsourcenode; +pub(crate) mod gainnode; +pub(crate) mod iirfilternode; +pub(crate) mod mediaelementaudiosourcenode; +pub(crate) mod mediastreamaudiodestinationnode; +pub(crate) mod mediastreamaudiosourcenode; +pub(crate) mod mediastreamtrackaudiosourcenode; +pub(crate) mod offlineaudiocompletionevent; +pub(crate) mod offlineaudiocontext; +pub(crate) mod oscillatornode; +pub(crate) mod pannernode; +pub(crate) mod stereopannernode; diff --git a/components/script/dom/offlineaudiocompletionevent.rs b/components/script/dom/audio/offlineaudiocompletionevent.rs similarity index 98% rename from components/script/dom/offlineaudiocompletionevent.rs rename to components/script/dom/audio/offlineaudiocompletionevent.rs index 5a80892b6ea..22a7012ec86 100644 --- a/components/script/dom/offlineaudiocompletionevent.rs +++ b/components/script/dom/audio/offlineaudiocompletionevent.rs @@ -6,7 +6,7 @@ use dom_struct::dom_struct; use js::rust::HandleObject; use stylo_atoms::Atom; -use crate::dom::audiobuffer::AudioBuffer; +use crate::dom::audio::audiobuffer::AudioBuffer; use crate::dom::bindings::codegen::Bindings::EventBinding::EventMethods; use crate::dom::bindings::codegen::Bindings::OfflineAudioCompletionEventBinding::{ OfflineAudioCompletionEventInit, OfflineAudioCompletionEventMethods, diff --git a/components/script/dom/offlineaudiocontext.rs b/components/script/dom/audio/offlineaudiocontext.rs similarity index 96% rename from components/script/dom/offlineaudiocontext.rs rename to components/script/dom/audio/offlineaudiocontext.rs index 344f523f8fc..b04ea464ddb 100644 --- a/components/script/dom/offlineaudiocontext.rs +++ b/components/script/dom/audio/offlineaudiocontext.rs @@ -12,9 +12,10 @@ use dom_struct::dom_struct; use js::rust::HandleObject; use servo_media::audio::context::OfflineAudioContextOptions as ServoMediaOfflineAudioContextOptions; -use crate::dom::audiobuffer::{AudioBuffer, MAX_SAMPLE_RATE, MIN_SAMPLE_RATE}; -use crate::dom::audionode::MAX_CHANNEL_COUNT; -use crate::dom::baseaudiocontext::{BaseAudioContext, BaseAudioContextOptions}; +use crate::dom::audio::audiobuffer::{AudioBuffer, MAX_SAMPLE_RATE, MIN_SAMPLE_RATE}; +use crate::dom::audio::audionode::MAX_CHANNEL_COUNT; +use crate::dom::audio::baseaudiocontext::{BaseAudioContext, BaseAudioContextOptions}; +use crate::dom::audio::offlineaudiocompletionevent::OfflineAudioCompletionEvent; use crate::dom::bindings::cell::DomRefCell; use crate::dom::bindings::codegen::Bindings::BaseAudioContextBinding::BaseAudioContext_Binding::BaseAudioContextMethods; use crate::dom::bindings::codegen::Bindings::OfflineAudioContextBinding::{ @@ -27,7 +28,6 @@ use crate::dom::bindings::refcounted::Trusted; use crate::dom::bindings::reflector::{DomGlobal, reflect_dom_object_with_proto}; use crate::dom::bindings::root::DomRoot; use crate::dom::event::{Event, EventBubbles, EventCancelable}; -use crate::dom::offlineaudiocompletionevent::OfflineAudioCompletionEvent; use crate::dom::promise::Promise; use crate::dom::window::Window; use crate::realms::InRealm; diff --git a/components/script/dom/oscillatornode.rs b/components/script/dom/audio/oscillatornode.rs similarity index 96% rename from components/script/dom/oscillatornode.rs rename to components/script/dom/audio/oscillatornode.rs index d52cd6b7866..2e3b2218356 100644 --- a/components/script/dom/oscillatornode.rs +++ b/components/script/dom/audio/oscillatornode.rs @@ -15,10 +15,10 @@ use servo_media::audio::oscillator_node::{ use servo_media::audio::param::ParamType; use crate::conversions::Convert; -use crate::dom::audionode::AudioNodeOptionsHelper; -use crate::dom::audioparam::AudioParam; -use crate::dom::audioscheduledsourcenode::AudioScheduledSourceNode; -use crate::dom::baseaudiocontext::BaseAudioContext; +use crate::dom::audio::audionode::AudioNodeOptionsHelper; +use crate::dom::audio::audioparam::AudioParam; +use crate::dom::audio::audioscheduledsourcenode::AudioScheduledSourceNode; +use crate::dom::audio::baseaudiocontext::BaseAudioContext; use crate::dom::bindings::codegen::Bindings::AudioNodeBinding::{ ChannelCountMode, ChannelInterpretation, }; diff --git a/components/script/dom/pannernode.rs b/components/script/dom/audio/pannernode.rs similarity index 98% rename from components/script/dom/pannernode.rs rename to components/script/dom/audio/pannernode.rs index ca9512082c9..074898bcde8 100644 --- a/components/script/dom/pannernode.rs +++ b/components/script/dom/audio/pannernode.rs @@ -14,9 +14,9 @@ use servo_media::audio::panner_node::{ use servo_media::audio::param::{ParamDir, ParamType}; use crate::conversions::Convert; -use crate::dom::audionode::{AudioNode, AudioNodeOptionsHelper}; -use crate::dom::audioparam::AudioParam; -use crate::dom::baseaudiocontext::BaseAudioContext; +use crate::dom::audio::audionode::{AudioNode, AudioNodeOptionsHelper}; +use crate::dom::audio::audioparam::AudioParam; +use crate::dom::audio::baseaudiocontext::BaseAudioContext; use crate::dom::bindings::codegen::Bindings::AudioNodeBinding::{ ChannelCountMode, ChannelInterpretation, }; diff --git a/components/script/dom/stereopannernode.rs b/components/script/dom/audio/stereopannernode.rs similarity index 94% rename from components/script/dom/stereopannernode.rs rename to components/script/dom/audio/stereopannernode.rs index c2643bc90d7..6bdb2abf60b 100644 --- a/components/script/dom/stereopannernode.rs +++ b/components/script/dom/audio/stereopannernode.rs @@ -9,10 +9,10 @@ use servo_media::audio::param::ParamType; use servo_media::audio::stereo_panner::StereoPannerOptions as ServoMediaStereoPannerOptions; use crate::conversions::Convert; -use crate::dom::audionode::AudioNodeOptionsHelper; -use crate::dom::audioparam::AudioParam; -use crate::dom::audioscheduledsourcenode::AudioScheduledSourceNode; -use crate::dom::baseaudiocontext::BaseAudioContext; +use crate::dom::audio::audionode::AudioNodeOptionsHelper; +use crate::dom::audio::audioparam::AudioParam; +use crate::dom::audio::audioscheduledsourcenode::AudioScheduledSourceNode; +use crate::dom::audio::baseaudiocontext::BaseAudioContext; use crate::dom::bindings::codegen::Bindings::AudioNodeBinding::{ ChannelCountMode, ChannelInterpretation, }; diff --git a/components/script/dom/htmlmediaelement.rs b/components/script/dom/htmlmediaelement.rs index 096377dd198..298c66b4d4b 100644 --- a/components/script/dom/htmlmediaelement.rs +++ b/components/script/dom/htmlmediaelement.rs @@ -45,8 +45,8 @@ use webrender_api::{ use crate::document_loader::{LoadBlocker, LoadType}; use crate::dom::attr::Attr; -use crate::dom::audiotrack::AudioTrack; -use crate::dom::audiotracklist::AudioTrackList; +use crate::dom::audio::audiotrack::AudioTrack; +use crate::dom::audio::audiotracklist::AudioTrackList; use crate::dom::bindings::cell::DomRefCell; use crate::dom::bindings::codegen::Bindings::AttrBinding::AttrMethods; use crate::dom::bindings::codegen::Bindings::HTMLMediaElementBinding::{ diff --git a/components/script/dom/mod.rs b/components/script/dom/mod.rs index 1811563b5f9..8389ee77647 100644 --- a/components/script/dom/mod.rs +++ b/components/script/dom/mod.rs @@ -217,23 +217,12 @@ pub(crate) mod abstractrange; pub(crate) mod abstractworker; pub(crate) mod abstractworkerglobalscope; pub(crate) mod activation; -pub(crate) mod analysernode; pub(crate) mod animationevent; pub(crate) mod attr; -pub(crate) mod audiobuffer; -pub(crate) mod audiobuffersourcenode; -pub(crate) mod audiocontext; -pub(crate) mod audiodestinationnode; -pub(crate) mod audiolistener; -pub(crate) mod audionode; -pub(crate) mod audioparam; -pub(crate) mod audioscheduledsourcenode; -pub(crate) mod audiotrack; -pub(crate) mod audiotracklist; -pub(crate) mod baseaudiocontext; +pub(crate) mod audio; +pub(crate) use self::audio::*; pub(crate) mod beforeunloadevent; pub(crate) mod bindings; -pub(crate) mod biquadfilternode; pub(crate) mod blob; #[cfg(feature = "bluetooth")] #[allow(clippy::module_inception)] @@ -247,8 +236,6 @@ pub(crate) mod canvaspattern; #[allow(dead_code)] pub(crate) mod canvasrenderingcontext2d; pub(crate) mod cdatasection; -pub(crate) mod channelmergernode; -pub(crate) mod channelsplitternode; pub(crate) mod characterdata; pub(crate) mod client; pub(crate) mod clipboard; @@ -258,7 +245,6 @@ pub(crate) mod closeevent; pub(crate) mod comment; pub(crate) mod compositionevent; pub(crate) mod console; -pub(crate) mod constantsourcenode; pub(crate) mod cookiestore; pub(crate) mod countqueuingstrategy; mod create; @@ -337,7 +323,6 @@ pub(crate) mod fontface; pub(crate) mod fontfaceset; pub(crate) mod formdata; pub(crate) mod formdataevent; -pub(crate) mod gainnode; pub(crate) mod gamepad; pub(crate) mod gamepadbutton; pub(crate) mod gamepadbuttonlist; @@ -435,7 +420,6 @@ pub(crate) mod idbopendbrequest; pub(crate) mod idbrequest; pub(crate) mod idbtransaction; pub(crate) mod idbversionchangeevent; -pub(crate) mod iirfilternode; pub(crate) mod imagebitmap; pub(crate) mod imagebitmaprenderingcontext; pub(crate) mod imagedata; @@ -446,7 +430,6 @@ pub(crate) mod keyboardevent; pub(crate) mod location; pub(crate) mod mediadeviceinfo; pub(crate) mod mediadevices; -pub(crate) mod mediaelementaudiosourcenode; pub(crate) mod mediaerror; pub(crate) mod mediafragmentparser; pub(crate) mod medialist; @@ -455,10 +438,7 @@ pub(crate) mod mediaquerylist; pub(crate) mod mediaquerylistevent; pub(crate) mod mediasession; pub(crate) mod mediastream; -pub(crate) mod mediastreamaudiodestinationnode; -pub(crate) mod mediastreamaudiosourcenode; pub(crate) mod mediastreamtrack; -pub(crate) mod mediastreamtrackaudiosourcenode; pub(crate) mod messagechannel; pub(crate) mod messageevent; #[allow(dead_code)] @@ -478,16 +458,12 @@ pub(crate) mod nodeiterator; #[allow(dead_code)] pub(crate) mod nodelist; pub(crate) mod notification; -pub(crate) mod offlineaudiocompletionevent; -pub(crate) mod offlineaudiocontext; pub(crate) mod offscreencanvas; pub(crate) mod offscreencanvasrenderingcontext2d; -pub(crate) mod oscillatornode; pub(crate) mod pagetransitionevent; pub(crate) mod paintrenderingcontext2d; pub(crate) mod paintsize; pub(crate) mod paintworkletglobalscope; -pub(crate) mod pannernode; pub(crate) mod path2d; pub(crate) mod performance; #[allow(dead_code)] @@ -559,7 +535,6 @@ pub(crate) mod servointernals; pub(crate) mod servoparser; pub(crate) mod shadowroot; pub(crate) mod staticrange; -pub(crate) mod stereopannernode; pub(crate) mod storage; pub(crate) mod storageevent; pub(crate) mod stylepropertymapreadonly; diff --git a/components/script/dom/trackevent.rs b/components/script/dom/trackevent.rs index dc5cb0bbe24..2444751b992 100644 --- a/components/script/dom/trackevent.rs +++ b/components/script/dom/trackevent.rs @@ -6,7 +6,7 @@ use dom_struct::dom_struct; use js::rust::HandleObject; use stylo_atoms::Atom; -use crate::dom::audiotrack::AudioTrack; +use crate::dom::audio::audiotrack::AudioTrack; use crate::dom::bindings::codegen::Bindings::EventBinding::Event_Binding::EventMethods; use crate::dom::bindings::codegen::Bindings::TrackEventBinding; use crate::dom::bindings::codegen::Bindings::TrackEventBinding::TrackEventMethods;