diff --git a/components/script/dom/audiobuffersourcenode.rs b/components/script/dom/audiobuffersourcenode.rs index 6eefe8c9ad5..3a1bcf6e914 100644 --- a/components/script/dom/audiobuffersourcenode.rs +++ b/components/script/dom/audiobuffersourcenode.rs @@ -17,7 +17,7 @@ use dom::bindings::error::{Error, Fallible}; use dom::bindings::inheritance::Castable; use dom::bindings::num::Finite; use dom::bindings::reflector::reflect_dom_object; -use dom::bindings::root::{DomRoot, MutNullableDom}; +use dom::bindings::root::{Dom, DomRoot, MutNullableDom}; use dom::window::Window; use dom_struct::dom_struct; use servo_media::audio::buffer_source_node::AudioBufferSourceNodeMessage; @@ -37,8 +37,8 @@ audio_param_impl!(Detune, AudioBufferSourceNode, AudioBufferSourceNodeMessage, S pub struct AudioBufferSourceNode { source_node: AudioScheduledSourceNode, buffer: MutNullableDom, - playback_rate: DomRoot, - detune: DomRoot, + playback_rate: Dom, + detune: Dom, loop_enabled: Cell, loop_start: Cell, loop_end: Cell, @@ -79,8 +79,8 @@ impl AudioBufferSourceNode { AudioBufferSourceNode { source_node, buffer: Default::default(), - playback_rate, - detune, + playback_rate: Dom::from_ref(&playback_rate), + detune: Dom::from_ref(&detune), loop_enabled: Cell::new(options.loop_), loop_start: Cell::new(*options.loopStart), loop_end: Cell::new(*options.loopEnd), diff --git a/components/script/dom/audionode.rs b/components/script/dom/audionode.rs index f3b26937497..a4b0dfecc34 100644 --- a/components/script/dom/audionode.rs +++ b/components/script/dom/audionode.rs @@ -6,7 +6,7 @@ use dom::baseaudiocontext::BaseAudioContext; use dom::bindings::codegen::Bindings::AudioNodeBinding::{AudioNodeMethods, AudioNodeOptions}; use dom::bindings::codegen::Bindings::AudioNodeBinding::{ChannelCountMode, ChannelInterpretation}; use dom::bindings::error::{Error, ErrorResult, Fallible}; -use dom::bindings::root::DomRoot; +use dom::bindings::root::{Dom, DomRoot}; use dom::audioparam::AudioParam; use dom::eventtarget::EventTarget; use dom_struct::dom_struct; @@ -24,7 +24,7 @@ pub struct AudioNode { eventtarget: EventTarget, #[ignore_malloc_size_of = "servo_media"] node_id: NodeId, - context: DomRoot, + context: Dom, number_of_inputs: u32, number_of_outputs: u32, channel_count: Cell, @@ -45,7 +45,7 @@ impl AudioNode { AudioNode { eventtarget: EventTarget::new_inherited(), node_id, - context: DomRoot::from_ref(context), + context: Dom::from_ref(context), number_of_inputs, number_of_outputs, channel_count: Cell::new(options.channelCount.unwrap_or(2)), @@ -96,31 +96,36 @@ impl AudioNodeMethods for AudioNode { // https://webaudio.github.io/web-audio-api/#dom-audionode-disconnect fn Disconnect(&self) -> ErrorResult { - // TODO + self.context.audio_context_impl() + .disconnect_all_from(self.node_id()); Ok(()) } - // https://webaudio.github.io/web-audio-api/#dom-audionode-disconnect - fn Disconnect_(&self, _: u32) -> ErrorResult { - // TODO + // https://webaudio.github.io/web-audio-api/#dom-audionode-disconnect-output + fn Disconnect_(&self, out: u32) -> ErrorResult { + self.context.audio_context_impl() + .disconnect_output(self.node_id().output(out)); Ok(()) } - // https://webaudio.github.io/web-audio-api/#dom-audionode-disconnect - fn Disconnect__(&self, _: &AudioNode) -> ErrorResult { - // TODO + // https://webaudio.github.io/web-audio-api/#dom-audionode-disconnect-destinationnode + fn Disconnect__(&self, to: &AudioNode) -> ErrorResult { + self.context.audio_context_impl() + .disconnect_between(self.node_id(), to.node_id()); Ok(()) } - // https://webaudio.github.io/web-audio-api/#dom-audionode-disconnect - fn Disconnect___(&self, _: &AudioNode, _: u32) -> ErrorResult{ - // TODO + // https://webaudio.github.io/web-audio-api/#dom-audionode-disconnect-destinationnode-output + fn Disconnect___(&self, to: &AudioNode, out: u32) -> ErrorResult{ + self.context.audio_context_impl() + .disconnect_output_between(self.node_id().output(out), to.node_id()); Ok(()) } - // https://webaudio.github.io/web-audio-api/#dom-audionode-disconnect - fn Disconnect____(&self, _: &AudioNode, _: u32, _: u32) -> ErrorResult { - // TODO + // https://webaudio.github.io/web-audio-api/#dom-audionode-disconnect-destinationnode-output-input + fn Disconnect____(&self, to: &AudioNode, out: u32, inp: u32) -> ErrorResult { + self.context.audio_context_impl() + .disconnect_output_between_to(self.node_id().output(out), to.node_id().input(inp)); Ok(()) } diff --git a/components/script/dom/gainnode.rs b/components/script/dom/gainnode.rs index ab146b42a4f..6b43651231d 100644 --- a/components/script/dom/gainnode.rs +++ b/components/script/dom/gainnode.rs @@ -11,7 +11,7 @@ use dom::bindings::codegen::Bindings::AudioNodeBinding::{ChannelCountMode, Chann use dom::bindings::codegen::Bindings::GainNodeBinding::{self, GainNodeMethods, GainOptions}; use dom::bindings::error::Fallible; use dom::bindings::reflector::reflect_dom_object; -use dom::bindings::root::DomRoot; +use dom::bindings::root::{Dom, DomRoot}; use dom::window::Window; use dom_struct::dom_struct; use servo_media::audio::context::AudioContext; @@ -27,7 +27,7 @@ audio_param_impl!(Gain, GainNode, GainNodeMessage, SetGain); #[dom_struct] pub struct GainNode { node: AudioNode, - gain: DomRoot, + gain: Dom, } impl GainNode { @@ -60,7 +60,7 @@ impl GainNode { ); GainNode { node, - gain + gain: Dom::from_ref(&gain), } } diff --git a/components/script/dom/oscillatornode.rs b/components/script/dom/oscillatornode.rs index 71580e20e17..0440111410a 100644 --- a/components/script/dom/oscillatornode.rs +++ b/components/script/dom/oscillatornode.rs @@ -12,7 +12,7 @@ use dom::bindings::codegen::Bindings::OscillatorNodeBinding::{self, OscillatorOp use dom::bindings::codegen::Bindings::OscillatorNodeBinding::OscillatorNodeMethods; use dom::bindings::error::Fallible; use dom::bindings::reflector::reflect_dom_object; -use dom::bindings::root::DomRoot; +use dom::bindings::root::{Dom, DomRoot}; use dom::window::Window; use dom_struct::dom_struct; use servo_media::audio::context::AudioContext; @@ -32,8 +32,8 @@ audio_param_impl!(Detune, OscillatorNode, OscillatorNodeMessage, SetDetune); pub struct OscillatorNode { source_node: AudioScheduledSourceNode, oscillator_type: OscillatorType, - frequency: DomRoot, - detune: DomRoot, + frequency: Dom, + detune: Dom, } impl OscillatorNode { @@ -70,8 +70,8 @@ impl OscillatorNode { OscillatorNode { source_node, oscillator_type: oscillator_options.type_, - frequency, - detune, + frequency: Dom::from_ref(&frequency), + detune: Dom::from_ref(&detune), } }