mirror of
https://github.com/servo/servo.git
synced 2025-08-03 12:40:06 +01:00
Cleanups for future script crate split (#35987)
* script: Avoid direct impl blocks on generated dicts and unions. Signed-off-by: Josh Matthews <josh@joshmatthews.net> * script: Remove references to codegen-specific import module. Signed-off-by: Josh Matthews <josh@joshmatthews.net> * Fix tidy. Signed-off-by: Josh Matthews <josh@joshmatthews.net> --------- Signed-off-by: Josh Matthews <josh@joshmatthews.net>
This commit is contained in:
parent
3ecd1c0699
commit
d35da38a2f
43 changed files with 211 additions and 146 deletions
|
@ -13,6 +13,7 @@ use servo_media::audio::buffer_source_node::{
|
|||
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;
|
||||
|
@ -52,7 +53,7 @@ impl AudioBufferSourceNode {
|
|||
) -> Fallible<AudioBufferSourceNode> {
|
||||
let node_options = Default::default();
|
||||
let source_node = AudioScheduledSourceNode::new_inherited(
|
||||
AudioNodeInit::AudioBufferSourceNode(options.into()),
|
||||
AudioNodeInit::AudioBufferSourceNode(options.convert()),
|
||||
context,
|
||||
node_options,
|
||||
0, /* inputs */
|
||||
|
@ -274,18 +275,18 @@ impl AudioBufferSourceNodeMethods<crate::DomTypeHolder> for AudioBufferSourceNod
|
|||
}
|
||||
}
|
||||
|
||||
impl<'a> From<&'a AudioBufferSourceOptions> for AudioBufferSourceNodeOptions {
|
||||
fn from(options: &'a AudioBufferSourceOptions) -> Self {
|
||||
Self {
|
||||
buffer: options
|
||||
impl Convert<AudioBufferSourceNodeOptions> for &AudioBufferSourceOptions {
|
||||
fn convert(self) -> AudioBufferSourceNodeOptions {
|
||||
AudioBufferSourceNodeOptions {
|
||||
buffer: self
|
||||
.buffer
|
||||
.as_ref()
|
||||
.and_then(|b| (*b.as_ref()?.get_channels()).clone()),
|
||||
detune: *options.detune,
|
||||
loop_enabled: options.loop_,
|
||||
loop_end: Some(*options.loopEnd),
|
||||
loop_start: Some(*options.loopStart),
|
||||
playback_rate: *options.playbackRate,
|
||||
detune: *self.detune,
|
||||
loop_enabled: self.loop_,
|
||||
loop_end: Some(*self.loopEnd),
|
||||
loop_start: Some(*self.loopStart),
|
||||
playback_rate: *self.playbackRate,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue