mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
Support arbitrary protos when wrapping DOM objects with constructors.
This commit is contained in:
parent
d9600ff50f
commit
dbff26bce0
197 changed files with 2028 additions and 586 deletions
|
@ -13,10 +13,11 @@ use crate::dom::bindings::codegen::Bindings::AudioScheduledSourceNodeBinding::Au
|
|||
use crate::dom::bindings::error::{Error, Fallible};
|
||||
use crate::dom::bindings::inheritance::Castable;
|
||||
use crate::dom::bindings::num::Finite;
|
||||
use crate::dom::bindings::reflector::reflect_dom_object;
|
||||
use crate::dom::bindings::reflector::reflect_dom_object2;
|
||||
use crate::dom::bindings::root::{Dom, DomRoot, MutNullableDom};
|
||||
use crate::dom::window::Window;
|
||||
use dom_struct::dom_struct;
|
||||
use js::rust::HandleObject;
|
||||
use servo_media::audio::buffer_source_node::AudioBufferSourceNodeMessage;
|
||||
use servo_media::audio::buffer_source_node::AudioBufferSourceNodeOptions;
|
||||
use servo_media::audio::node::{AudioNodeInit, AudioNodeMessage};
|
||||
|
@ -92,23 +93,33 @@ impl AudioBufferSourceNode {
|
|||
Ok(node)
|
||||
}
|
||||
|
||||
#[allow(unrooted_must_root)]
|
||||
pub fn new(
|
||||
window: &Window,
|
||||
context: &BaseAudioContext,
|
||||
options: &AudioBufferSourceOptions,
|
||||
) -> Fallible<DomRoot<AudioBufferSourceNode>> {
|
||||
Self::new_with_proto(window, None, context, options)
|
||||
}
|
||||
|
||||
#[allow(unrooted_must_root)]
|
||||
fn new_with_proto(
|
||||
window: &Window,
|
||||
proto: Option<HandleObject>,
|
||||
context: &BaseAudioContext,
|
||||
options: &AudioBufferSourceOptions,
|
||||
) -> Fallible<DomRoot<AudioBufferSourceNode>> {
|
||||
let node = AudioBufferSourceNode::new_inherited(window, context, options)?;
|
||||
Ok(reflect_dom_object(Box::new(node), window))
|
||||
Ok(reflect_dom_object2(Box::new(node), window, proto))
|
||||
}
|
||||
|
||||
#[allow(non_snake_case)]
|
||||
pub fn Constructor(
|
||||
window: &Window,
|
||||
proto: Option<HandleObject>,
|
||||
context: &BaseAudioContext,
|
||||
options: &AudioBufferSourceOptions,
|
||||
) -> Fallible<DomRoot<AudioBufferSourceNode>> {
|
||||
AudioBufferSourceNode::new(window, context, options)
|
||||
AudioBufferSourceNode::new_with_proto(window, proto, context, options)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue