mirror of
https://github.com/servo/servo.git
synced 2025-06-06 16:45:39 +00:00
test-tidy fixes
This commit is contained in:
parent
f0a691e474
commit
21cb160be3
10 changed files with 43 additions and 23 deletions
|
@ -9,11 +9,10 @@ use dom::baseaudiocontext::BaseAudioContext;
|
|||
use dom::bindings::codegen::Bindings::AudioBufferSourceNodeBinding;
|
||||
use dom::bindings::codegen::Bindings::AudioBufferSourceNodeBinding::AudioBufferSourceNodeMethods;
|
||||
use dom::bindings::codegen::Bindings::AudioBufferSourceNodeBinding::AudioBufferSourceOptions;
|
||||
use dom::bindings::codegen::Bindings::AudioParamBinding::AutomationRate;
|
||||
use dom::bindings::codegen::Bindings::AudioNodeBinding::AudioNodeOptions;
|
||||
use dom::bindings::codegen::Bindings::AudioNodeBinding::{ChannelCountMode, ChannelInterpretation};
|
||||
use dom::bindings::codegen::Bindings::AudioScheduledSourceNodeBinding::
|
||||
AudioScheduledSourceNodeBinding::AudioScheduledSourceNodeMethods;
|
||||
use dom::bindings::codegen::Bindings::AudioNodeBinding::AudioNodeOptions;
|
||||
use dom::bindings::codegen::Bindings::AudioParamBinding::AutomationRate;
|
||||
use dom::bindings::codegen::Bindings::AudioScheduledSourceNodeBinding::AudioScheduledSourceNodeMethods;
|
||||
use dom::bindings::error::{Error, Fallible};
|
||||
use dom::bindings::inheritance::Castable;
|
||||
use dom::bindings::num::Finite;
|
||||
|
@ -109,12 +108,12 @@ impl AudioBufferSourceNode {
|
|||
}
|
||||
|
||||
impl AudioBufferSourceNodeMethods for AudioBufferSourceNode {
|
||||
/// https://webaudio.github.io/web-audio-api/#dom-audiobuffersourcenode-buffer
|
||||
// https://webaudio.github.io/web-audio-api/#dom-audiobuffersourcenode-buffer
|
||||
fn GetBuffer(&self) -> Fallible<Option<DomRoot<AudioBuffer>>> {
|
||||
Ok(self.buffer.get())
|
||||
}
|
||||
|
||||
/// https://webaudio.github.io/web-audio-api/#dom-audiobuffersourcenode-buffer
|
||||
// https://webaudio.github.io/web-audio-api/#dom-audiobuffersourcenode-buffer
|
||||
fn SetBuffer(&self, new_buffer: Option<&AudioBuffer>) -> Fallible<()> {
|
||||
if new_buffer.is_some() && self.buffer.get().is_some() {
|
||||
return Err(Error::InvalidState);
|
||||
|
@ -136,38 +135,47 @@ impl AudioBufferSourceNodeMethods for AudioBufferSourceNode {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
// https://webaudio.github.io/web-audio-api/#dom-audiobuffersourcenode-playbackrate
|
||||
fn PlaybackRate(&self) -> DomRoot<AudioParam> {
|
||||
DomRoot::from_ref(&self.playback_rate)
|
||||
}
|
||||
|
||||
// https://webaudio.github.io/web-audio-api/#dom-audiobuffersourcenode-detune
|
||||
fn Detune(&self) -> DomRoot<AudioParam> {
|
||||
DomRoot::from_ref(&self.detune)
|
||||
}
|
||||
|
||||
// https://webaudio.github.io/web-audio-api/#dom-audiobuffersourcenode-loop
|
||||
fn Loop(&self) -> bool {
|
||||
self.loop_enabled.get()
|
||||
}
|
||||
|
||||
// https://webaudio.github.io/web-audio-api/#dom-audiobuffersourcenode-loop
|
||||
fn SetLoop(&self, should_loop: bool) {
|
||||
self.loop_enabled.set(should_loop);
|
||||
}
|
||||
|
||||
// https://webaudio.github.io/web-audio-api/#dom-audiobuffersourcenode-loopstart
|
||||
fn LoopStart(&self) -> Finite<f64> {
|
||||
Finite::wrap(self.loop_start.get())
|
||||
}
|
||||
|
||||
// https://webaudio.github.io/web-audio-api/#dom-audiobuffersourcenode-loopstart
|
||||
fn SetLoopStart(&self, loop_start: Finite<f64>) {
|
||||
self.loop_start.set(*loop_start);
|
||||
}
|
||||
|
||||
// https://webaudio.github.io/web-audio-api/#dom-audiobuffersourcenode-loopend
|
||||
fn LoopEnd(&self) -> Finite<f64> {
|
||||
Finite::wrap(self.loop_end.get())
|
||||
}
|
||||
|
||||
// https://webaudio.github.io/web-audio-api/#dom-audiobuffersourcenode-loopend
|
||||
fn SetLoopEnd(&self, loop_end: Finite<f64>) {
|
||||
self.loop_end.set(*loop_end)
|
||||
}
|
||||
|
||||
// https://webaudio.github.io/web-audio-api/#dom-audiobuffersourcenode-start
|
||||
fn Start(
|
||||
&self,
|
||||
when: Finite<f64>,
|
||||
|
|
|
@ -4,8 +4,8 @@
|
|||
|
||||
use dom::baseaudiocontext::{BaseAudioContext, BaseAudioContextOptions};
|
||||
use dom::bindings::codegen::Bindings::AudioContextBinding;
|
||||
use dom::bindings::codegen::Bindings::AudioContextBinding::{AudioContextMethods, AudioContextOptions};
|
||||
use dom::bindings::codegen::Bindings::AudioContextBinding::{AudioContextLatencyCategory, AudioTimestamp};
|
||||
use dom::bindings::codegen::Bindings::AudioContextBinding::{AudioContextLatencyCategory, AudioContextMethods};
|
||||
use dom::bindings::codegen::Bindings::AudioContextBinding::{AudioContextOptions, AudioTimestamp};
|
||||
use dom::bindings::codegen::Bindings::BaseAudioContextBinding::AudioContextState;
|
||||
use dom::bindings::codegen::Bindings::BaseAudioContextBinding::BaseAudioContextBinding::BaseAudioContextMethods;
|
||||
use dom::bindings::error::{Error, Fallible};
|
||||
|
@ -87,14 +87,17 @@ impl AudioContext {
|
|||
}
|
||||
|
||||
impl AudioContextMethods for AudioContext {
|
||||
// https://webaudio.github.io/web-audio-api/#dom-audiocontext-baselatency
|
||||
fn BaseLatency(&self) -> Finite<f64> {
|
||||
Finite::wrap(self.base_latency)
|
||||
}
|
||||
|
||||
// https://webaudio.github.io/web-audio-api/#dom-audiocontext-outputlatency
|
||||
fn OutputLatency(&self) -> Finite<f64> {
|
||||
Finite::wrap(self.output_latency)
|
||||
}
|
||||
|
||||
// https://webaudio.github.io/web-audio-api/#dom-audiocontext-outputlatency
|
||||
fn GetOutputTimestamp(&self) -> AudioTimestamp {
|
||||
// TODO
|
||||
AudioTimestamp {
|
||||
|
@ -103,7 +106,7 @@ impl AudioContextMethods for AudioContext {
|
|||
}
|
||||
}
|
||||
|
||||
/// https://webaudio.github.io/web-audio-api/#dom-audiocontext-suspend
|
||||
// https://webaudio.github.io/web-audio-api/#dom-audiocontext-suspend
|
||||
#[allow(unrooted_must_root)]
|
||||
fn Suspend(&self) -> Rc<Promise> {
|
||||
// Step 1.
|
||||
|
@ -165,6 +168,7 @@ impl AudioContextMethods for AudioContext {
|
|||
promise
|
||||
}
|
||||
|
||||
// https://webaudio.github.io/web-audio-api/#dom-audiocontext-close
|
||||
#[allow(unrooted_must_root)]
|
||||
fn Close(&self) -> Rc<Promise> {
|
||||
// Step 1.
|
||||
|
|
|
@ -46,6 +46,7 @@ impl AudioDestinationNode {
|
|||
}
|
||||
|
||||
impl AudioDestinationNodeMethods for AudioDestinationNode {
|
||||
// https://webaudio.github.io/web-audio-api/#dom-audiodestinationnode-maxchannelcount
|
||||
fn MaxChannelCount(&self) -> u32 {
|
||||
MAX_CHANNEL_COUNT
|
||||
}
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
use dom::audioparam::AudioParam;
|
||||
use dom::baseaudiocontext::BaseAudioContext;
|
||||
use dom::bindings::codegen::Bindings::AudioNodeBinding::{AudioNodeMethods, AudioNodeOptions};
|
||||
use dom::bindings::codegen::Bindings::AudioNodeBinding::{ChannelCountMode, ChannelInterpretation};
|
||||
|
@ -9,7 +10,6 @@ use dom::bindings::codegen::InheritTypes::{AudioNodeTypeId, EventTargetTypeId};
|
|||
use dom::bindings::error::{Error, ErrorResult, Fallible};
|
||||
use dom::bindings::inheritance::Castable;
|
||||
use dom::bindings::root::{Dom, DomRoot};
|
||||
use dom::audioparam::AudioParam;
|
||||
use dom::eventtarget::EventTarget;
|
||||
use dom_struct::dom_struct;
|
||||
use servo_media::audio::graph::NodeId;
|
||||
|
@ -96,6 +96,7 @@ impl AudioNodeMethods for AudioNode {
|
|||
Ok(DomRoot::from_ref(destination))
|
||||
}
|
||||
|
||||
// https://webaudio.github.io/web-audio-api/#dom-audionode-connect-destinationparam-output
|
||||
fn Connect_(&self, _: &AudioParam, _: u32) -> Fallible<()> {
|
||||
// TODO
|
||||
Ok(())
|
||||
|
|
|
@ -3,8 +3,8 @@
|
|||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
use dom::audionode::AudioNode;
|
||||
use dom::baseaudiocontext::BaseAudioContext;
|
||||
use dom::bindings::codegen::Bindings::AudioScheduledSourceNodeBinding::AudioScheduledSourceNodeMethods;
|
||||
use dom::bindings::codegen::Bindings::AudioNodeBinding::AudioNodeOptions;
|
||||
use dom::bindings::codegen::Bindings::AudioScheduledSourceNodeBinding::AudioScheduledSourceNodeMethods;
|
||||
use dom::bindings::error::{Error, Fallible};
|
||||
use dom::bindings::num::Finite;
|
||||
use dom_struct::dom_struct;
|
||||
|
|
|
@ -9,8 +9,8 @@ use dom::audionode::MAX_CHANNEL_COUNT;
|
|||
use dom::bindings::callback::ExceptionHandling;
|
||||
use dom::bindings::cell::DomRefCell;
|
||||
use dom::bindings::codegen::Bindings::AudioBufferSourceNodeBinding::AudioBufferSourceOptions;
|
||||
use dom::bindings::codegen::Bindings::AudioNodeBinding::AudioNodeOptions;
|
||||
use dom::bindings::codegen::Bindings::AudioNodeBinding::{ChannelCountMode, ChannelInterpretation};
|
||||
use dom::bindings::codegen::Bindings::AudioNodeBinding::AudioNodeOptions;
|
||||
use dom::bindings::codegen::Bindings::BaseAudioContextBinding::AudioContextState;
|
||||
use dom::bindings::codegen::Bindings::BaseAudioContextBinding::BaseAudioContextMethods;
|
||||
use dom::bindings::codegen::Bindings::BaseAudioContextBinding::DecodeErrorCallback;
|
||||
|
@ -338,6 +338,7 @@ impl BaseAudioContextMethods for BaseAudioContext {
|
|||
))
|
||||
}
|
||||
|
||||
// https://webaudio.github.io/web-audio-api/#dom-baseaudiocontext-createbuffersource
|
||||
fn CreateBufferSource(&self) -> DomRoot<AudioBufferSourceNode> {
|
||||
AudioBufferSourceNode::new(
|
||||
&self.global().as_window(),
|
||||
|
@ -346,6 +347,7 @@ impl BaseAudioContextMethods for BaseAudioContext {
|
|||
)
|
||||
}
|
||||
|
||||
// https://webaudio.github.io/web-audio-api/#dom-baseaudiocontext-decodeaudiodata
|
||||
#[allow(unrooted_must_root)]
|
||||
fn DecodeAudioData(
|
||||
&self,
|
||||
|
|
|
@ -80,11 +80,6 @@ use offscreen_gl_context::GLLimits;
|
|||
use parking_lot::RwLock;
|
||||
use profile_traits::mem::ProfilerChan as MemProfilerChan;
|
||||
use profile_traits::time::ProfilerChan as TimeProfilerChan;
|
||||
use servo_media::Backend;
|
||||
use servo_media::audio::buffer_source_node::AudioBuffer;
|
||||
use servo_media::audio::context::AudioContext;
|
||||
use servo_media::audio::graph::NodeId;
|
||||
use servo_media::audio::param::ParamType;
|
||||
use script_layout_interface::OpaqueStyleAndLayoutData;
|
||||
use script_layout_interface::reporter::CSSErrorReporter;
|
||||
use script_layout_interface::rpc::LayoutRPC;
|
||||
|
@ -95,6 +90,11 @@ use selectors::matching::ElementSelectorFlags;
|
|||
use serde::{Deserialize, Serialize};
|
||||
use servo_arc::Arc as ServoArc;
|
||||
use servo_atoms::Atom;
|
||||
use servo_media::Backend;
|
||||
use servo_media::audio::buffer_source_node::AudioBuffer;
|
||||
use servo_media::audio::context::AudioContext;
|
||||
use servo_media::audio::graph::NodeId;
|
||||
use servo_media::audio::param::ParamType;
|
||||
use servo_url::{ImmutableOrigin, MutableOrigin, ServoUrl};
|
||||
use smallvec::SmallVec;
|
||||
use std::cell::{Cell, RefCell, UnsafeCell};
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
/* 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
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
use dom::audionode::AudioNode;
|
||||
use dom::audioparam::AudioParam;
|
||||
use dom::baseaudiocontext::BaseAudioContext;
|
||||
use dom::bindings::codegen::Bindings::AudioParamBinding::AutomationRate;
|
||||
use dom::bindings::codegen::Bindings::AudioNodeBinding::AudioNodeOptions;
|
||||
use dom::bindings::codegen::Bindings::AudioNodeBinding::{ChannelCountMode, ChannelInterpretation};
|
||||
use dom::bindings::codegen::Bindings::AudioNodeBinding::AudioNodeOptions;
|
||||
use dom::bindings::codegen::Bindings::AudioParamBinding::AutomationRate;
|
||||
use dom::bindings::codegen::Bindings::GainNodeBinding::{self, GainNodeMethods, GainOptions};
|
||||
use dom::bindings::error::Fallible;
|
||||
use dom::bindings::reflector::reflect_dom_object;
|
||||
|
@ -80,6 +80,7 @@ impl GainNode {
|
|||
}
|
||||
|
||||
impl GainNodeMethods for GainNode {
|
||||
// https://webaudio.github.io/web-audio-api/#dom-gainnode-gain
|
||||
fn Gain(&self) -> DomRoot<AudioParam> {
|
||||
DomRoot::from_ref(&self.gain)
|
||||
}
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
/* 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
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
use dom::audioparam::AudioParam;
|
||||
use dom::audioscheduledsourcenode::AudioScheduledSourceNode;
|
||||
use dom::baseaudiocontext::BaseAudioContext;
|
||||
use dom::bindings::codegen::Bindings::AudioParamBinding::AutomationRate;
|
||||
use dom::bindings::codegen::Bindings::AudioNodeBinding::AudioNodeOptions;
|
||||
use dom::bindings::codegen::Bindings::AudioNodeBinding::{ChannelCountMode, ChannelInterpretation};
|
||||
use dom::bindings::codegen::Bindings::AudioNodeBinding::AudioNodeOptions;
|
||||
use dom::bindings::codegen::Bindings::AudioParamBinding::AutomationRate;
|
||||
use dom::bindings::codegen::Bindings::OscillatorNodeBinding::{self, OscillatorOptions, OscillatorType};
|
||||
use dom::bindings::codegen::Bindings::OscillatorNodeBinding::OscillatorNodeMethods;
|
||||
use dom::bindings::error::Fallible;
|
||||
|
@ -97,10 +97,12 @@ impl OscillatorNode {
|
|||
}
|
||||
|
||||
impl OscillatorNodeMethods for OscillatorNode {
|
||||
// https://webaudio.github.io/web-audio-api/#dom-oscillatornode-frequency
|
||||
fn Frequency(&self) -> DomRoot<AudioParam> {
|
||||
DomRoot::from_ref(&self.frequency)
|
||||
}
|
||||
|
||||
// https://webaudio.github.io/web-audio-api/#dom-oscillatornode-detune
|
||||
fn Detune(&self) -> DomRoot<AudioParam> {
|
||||
DomRoot::from_ref(&self.detune)
|
||||
}
|
||||
|
|
|
@ -94,6 +94,7 @@ WEBIDL_STANDARDS = [
|
|||
"//webbluetoothcg.github.io/web-bluetooth/",
|
||||
"//svgwg.org/svg2-draft",
|
||||
"//wicg.github.io",
|
||||
"//webaudio.github.io",
|
||||
# Not a URL
|
||||
"// This interface is entirely internal to Servo, and should not be" +
|
||||
" accessible to\n// web pages."
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue