mirror of
https://github.com/servo/servo.git
synced 2025-06-11 01:50:10 +00: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
|
@ -64,8 +64,13 @@ pub(crate) trait CanvasContext {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl HTMLCanvasElementOrOffscreenCanvas {
|
pub(crate) trait CanvasHelpers {
|
||||||
pub(crate) fn size(&self) -> Size2D<u64> {
|
fn size(&self) -> Size2D<u64>;
|
||||||
|
fn canvas(&self) -> Option<&HTMLCanvasElement>;
|
||||||
|
}
|
||||||
|
|
||||||
|
impl CanvasHelpers for HTMLCanvasElementOrOffscreenCanvas {
|
||||||
|
fn size(&self) -> Size2D<u64> {
|
||||||
match self {
|
match self {
|
||||||
HTMLCanvasElementOrOffscreenCanvas::HTMLCanvasElement(canvas) => {
|
HTMLCanvasElementOrOffscreenCanvas::HTMLCanvasElement(canvas) => {
|
||||||
canvas.get_size().cast()
|
canvas.get_size().cast()
|
||||||
|
@ -74,7 +79,7 @@ impl HTMLCanvasElementOrOffscreenCanvas {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn canvas(&self) -> Option<&HTMLCanvasElement> {
|
fn canvas(&self) -> Option<&HTMLCanvasElement> {
|
||||||
match self {
|
match self {
|
||||||
HTMLCanvasElementOrOffscreenCanvas::HTMLCanvasElement(canvas) => Some(canvas),
|
HTMLCanvasElementOrOffscreenCanvas::HTMLCanvasElement(canvas) => Some(canvas),
|
||||||
HTMLCanvasElementOrOffscreenCanvas::OffscreenCanvas(canvas) => canvas.placeholder(),
|
HTMLCanvasElementOrOffscreenCanvas::OffscreenCanvas(canvas) => canvas.placeholder(),
|
||||||
|
|
|
@ -11,7 +11,7 @@ use servo_media::audio::analyser_node::AnalysisEngine;
|
||||||
use servo_media::audio::block::Block;
|
use servo_media::audio::block::Block;
|
||||||
use servo_media::audio::node::AudioNodeInit;
|
use servo_media::audio::node::AudioNodeInit;
|
||||||
|
|
||||||
use crate::dom::audionode::AudioNode;
|
use crate::dom::audionode::{AudioNode, AudioNodeOptionsHelper};
|
||||||
use crate::dom::baseaudiocontext::BaseAudioContext;
|
use crate::dom::baseaudiocontext::BaseAudioContext;
|
||||||
use crate::dom::bindings::cell::DomRefCell;
|
use crate::dom::bindings::cell::DomRefCell;
|
||||||
use crate::dom::bindings::codegen::Bindings::AnalyserNodeBinding::{
|
use crate::dom::bindings::codegen::Bindings::AnalyserNodeBinding::{
|
||||||
|
|
|
@ -13,6 +13,7 @@ use servo_media::audio::buffer_source_node::{
|
||||||
use servo_media::audio::node::{AudioNodeInit, AudioNodeMessage, AudioNodeType};
|
use servo_media::audio::node::{AudioNodeInit, AudioNodeMessage, AudioNodeType};
|
||||||
use servo_media::audio::param::ParamType;
|
use servo_media::audio::param::ParamType;
|
||||||
|
|
||||||
|
use crate::conversions::Convert;
|
||||||
use crate::dom::audiobuffer::AudioBuffer;
|
use crate::dom::audiobuffer::AudioBuffer;
|
||||||
use crate::dom::audioparam::AudioParam;
|
use crate::dom::audioparam::AudioParam;
|
||||||
use crate::dom::audioscheduledsourcenode::AudioScheduledSourceNode;
|
use crate::dom::audioscheduledsourcenode::AudioScheduledSourceNode;
|
||||||
|
@ -52,7 +53,7 @@ impl AudioBufferSourceNode {
|
||||||
) -> Fallible<AudioBufferSourceNode> {
|
) -> Fallible<AudioBufferSourceNode> {
|
||||||
let node_options = Default::default();
|
let node_options = Default::default();
|
||||||
let source_node = AudioScheduledSourceNode::new_inherited(
|
let source_node = AudioScheduledSourceNode::new_inherited(
|
||||||
AudioNodeInit::AudioBufferSourceNode(options.into()),
|
AudioNodeInit::AudioBufferSourceNode(options.convert()),
|
||||||
context,
|
context,
|
||||||
node_options,
|
node_options,
|
||||||
0, /* inputs */
|
0, /* inputs */
|
||||||
|
@ -274,18 +275,18 @@ impl AudioBufferSourceNodeMethods<crate::DomTypeHolder> for AudioBufferSourceNod
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> From<&'a AudioBufferSourceOptions> for AudioBufferSourceNodeOptions {
|
impl Convert<AudioBufferSourceNodeOptions> for &AudioBufferSourceOptions {
|
||||||
fn from(options: &'a AudioBufferSourceOptions) -> Self {
|
fn convert(self) -> AudioBufferSourceNodeOptions {
|
||||||
Self {
|
AudioBufferSourceNodeOptions {
|
||||||
buffer: options
|
buffer: self
|
||||||
.buffer
|
.buffer
|
||||||
.as_ref()
|
.as_ref()
|
||||||
.and_then(|b| (*b.as_ref()?.get_channels()).clone()),
|
.and_then(|b| (*b.as_ref()?.get_channels()).clone()),
|
||||||
detune: *options.detune,
|
detune: *self.detune,
|
||||||
loop_enabled: options.loop_,
|
loop_enabled: self.loop_,
|
||||||
loop_end: Some(*options.loopEnd),
|
loop_end: Some(*self.loopEnd),
|
||||||
loop_start: Some(*options.loopStart),
|
loop_start: Some(*self.loopStart),
|
||||||
playback_rate: *options.playbackRate,
|
playback_rate: *self.playbackRate,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
|
|
||||||
use dom_struct::dom_struct;
|
use dom_struct::dom_struct;
|
||||||
|
|
||||||
use crate::dom::audionode::{AudioNode, MAX_CHANNEL_COUNT};
|
use crate::dom::audionode::{AudioNode, AudioNodeOptionsHelper, MAX_CHANNEL_COUNT};
|
||||||
use crate::dom::baseaudiocontext::BaseAudioContext;
|
use crate::dom::baseaudiocontext::BaseAudioContext;
|
||||||
use crate::dom::bindings::codegen::Bindings::AudioDestinationNodeBinding::AudioDestinationNodeMethods;
|
use crate::dom::bindings::codegen::Bindings::AudioDestinationNodeBinding::AudioDestinationNodeMethods;
|
||||||
use crate::dom::bindings::codegen::Bindings::AudioNodeBinding::{
|
use crate::dom::bindings::codegen::Bindings::AudioNodeBinding::{
|
||||||
|
|
|
@ -387,8 +387,17 @@ impl Convert<ServoMediaChannelInterpretation> for ChannelInterpretation {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl AudioNodeOptions {
|
pub(crate) trait AudioNodeOptionsHelper {
|
||||||
pub(crate) fn unwrap_or(
|
fn unwrap_or(
|
||||||
|
&self,
|
||||||
|
count: u32,
|
||||||
|
mode: ChannelCountMode,
|
||||||
|
interpretation: ChannelInterpretation,
|
||||||
|
) -> UnwrappedAudioNodeOptions;
|
||||||
|
}
|
||||||
|
|
||||||
|
impl AudioNodeOptionsHelper for AudioNodeOptions {
|
||||||
|
fn unwrap_or(
|
||||||
&self,
|
&self,
|
||||||
count: u32,
|
count: u32,
|
||||||
mode: ChannelCountMode,
|
mode: ChannelCountMode,
|
||||||
|
|
|
@ -39,8 +39,7 @@ use js::typedarray::{
|
||||||
TypedArray, TypedArrayElement, TypedArrayElementCreator,
|
TypedArray, TypedArrayElement, TypedArrayElementCreator,
|
||||||
};
|
};
|
||||||
|
|
||||||
use crate::dom::bindings::error::Error;
|
use crate::dom::bindings::error::{Error, Fallible};
|
||||||
use crate::dom::bindings::import::module::Fallible;
|
|
||||||
#[cfg(feature = "webgpu")]
|
#[cfg(feature = "webgpu")]
|
||||||
use crate::dom::globalscope::GlobalScope;
|
use crate::dom::globalscope::GlobalScope;
|
||||||
use crate::script_runtime::{CanGc, JSContext};
|
use crate::script_runtime::{CanGc, JSContext};
|
||||||
|
|
|
@ -36,7 +36,7 @@ macro_rules! native_raw_obj_fn {
|
||||||
#[allow(clippy::macro_metavars_in_unsafe)]
|
#[allow(clippy::macro_metavars_in_unsafe)]
|
||||||
unsafe {
|
unsafe {
|
||||||
let name: &std::ffi::CStr = $name;
|
let name: &std::ffi::CStr = $name;
|
||||||
let raw_fun = $crate::dom::bindings::import::module::jsapi::JS_NewFunction(
|
let raw_fun = js::jsapi::JS_NewFunction(
|
||||||
*$cx,
|
*$cx,
|
||||||
Some(wrapper),
|
Some(wrapper),
|
||||||
$nargs,
|
$nargs,
|
||||||
|
@ -44,7 +44,7 @@ macro_rules! native_raw_obj_fn {
|
||||||
name.as_ptr() as *const std::ffi::c_char,
|
name.as_ptr() as *const std::ffi::c_char,
|
||||||
);
|
);
|
||||||
assert!(!raw_fun.is_null());
|
assert!(!raw_fun.is_null());
|
||||||
$crate::dom::bindings::import::module::jsapi::JS_GetFunctionObject(raw_fun)
|
js::jsapi::JS_GetFunctionObject(raw_fun)
|
||||||
}
|
}
|
||||||
}};
|
}};
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,7 +14,7 @@ use servo_media::audio::node::{AudioNodeInit, AudioNodeMessage, AudioNodeType};
|
||||||
use servo_media::audio::param::ParamType;
|
use servo_media::audio::param::ParamType;
|
||||||
|
|
||||||
use crate::conversions::Convert;
|
use crate::conversions::Convert;
|
||||||
use crate::dom::audionode::AudioNode;
|
use crate::dom::audionode::{AudioNode, AudioNodeOptionsHelper};
|
||||||
use crate::dom::audioparam::AudioParam;
|
use crate::dom::audioparam::AudioParam;
|
||||||
use crate::dom::baseaudiocontext::BaseAudioContext;
|
use crate::dom::baseaudiocontext::BaseAudioContext;
|
||||||
use crate::dom::bindings::codegen::Bindings::AudioNodeBinding::{
|
use crate::dom::bindings::codegen::Bindings::AudioNodeBinding::{
|
||||||
|
|
|
@ -18,7 +18,7 @@ use super::bindings::error::Fallible;
|
||||||
use super::bindings::reflector::{DomGlobal, Reflector, reflect_dom_object_with_proto};
|
use super::bindings::reflector::{DomGlobal, Reflector, reflect_dom_object_with_proto};
|
||||||
use super::bindings::root::DomRoot;
|
use super::bindings::root::DomRoot;
|
||||||
use super::types::GlobalScope;
|
use super::types::GlobalScope;
|
||||||
use crate::dom::bindings::import::module::get_dictionary_property;
|
use crate::dom::bindings::utils::get_dictionary_property;
|
||||||
use crate::native_fn;
|
use crate::native_fn;
|
||||||
use crate::script_runtime::CanGc;
|
use crate::script_runtime::CanGc;
|
||||||
|
|
||||||
|
|
|
@ -10,7 +10,7 @@ use profile_traits::ipc;
|
||||||
use script_layout_interface::HTMLCanvasDataSource;
|
use script_layout_interface::HTMLCanvasDataSource;
|
||||||
use servo_url::ServoUrl;
|
use servo_url::ServoUrl;
|
||||||
|
|
||||||
use crate::canvas_context::{CanvasContext, LayoutCanvasRenderingContextHelpers};
|
use crate::canvas_context::{CanvasContext, CanvasHelpers, LayoutCanvasRenderingContextHelpers};
|
||||||
use crate::canvas_state::CanvasState;
|
use crate::canvas_state::CanvasState;
|
||||||
use crate::dom::bindings::codegen::Bindings::CanvasRenderingContext2DBinding::{
|
use crate::dom::bindings::codegen::Bindings::CanvasRenderingContext2DBinding::{
|
||||||
CanvasDirection, CanvasFillRule, CanvasImageSource, CanvasLineCap, CanvasLineJoin,
|
CanvasDirection, CanvasFillRule, CanvasImageSource, CanvasLineCap, CanvasLineJoin,
|
||||||
|
|
|
@ -7,7 +7,8 @@ use js::rust::HandleObject;
|
||||||
use servo_media::audio::channel_node::ChannelNodeOptions;
|
use servo_media::audio::channel_node::ChannelNodeOptions;
|
||||||
use servo_media::audio::node::AudioNodeInit;
|
use servo_media::audio::node::AudioNodeInit;
|
||||||
|
|
||||||
use crate::dom::audionode::{AudioNode, MAX_CHANNEL_COUNT};
|
use crate::conversions::Convert;
|
||||||
|
use crate::dom::audionode::{AudioNode, AudioNodeOptionsHelper, MAX_CHANNEL_COUNT};
|
||||||
use crate::dom::baseaudiocontext::BaseAudioContext;
|
use crate::dom::baseaudiocontext::BaseAudioContext;
|
||||||
use crate::dom::bindings::codegen::Bindings::AudioNodeBinding::{
|
use crate::dom::bindings::codegen::Bindings::AudioNodeBinding::{
|
||||||
ChannelCountMode, ChannelInterpretation,
|
ChannelCountMode, ChannelInterpretation,
|
||||||
|
@ -47,12 +48,13 @@ impl ChannelMergerNode {
|
||||||
return Err(Error::IndexSize);
|
return Err(Error::IndexSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let num_inputs = options.numberOfInputs;
|
||||||
let node = AudioNode::new_inherited(
|
let node = AudioNode::new_inherited(
|
||||||
AudioNodeInit::ChannelMergerNode(options.into()),
|
AudioNodeInit::ChannelMergerNode(options.convert()),
|
||||||
context,
|
context,
|
||||||
node_options,
|
node_options,
|
||||||
options.numberOfInputs, // inputs
|
num_inputs, // inputs
|
||||||
1, // outputs
|
1, // outputs
|
||||||
)?;
|
)?;
|
||||||
Ok(ChannelMergerNode { node })
|
Ok(ChannelMergerNode { node })
|
||||||
}
|
}
|
||||||
|
@ -97,10 +99,10 @@ impl ChannelMergerNodeMethods<crate::DomTypeHolder> for ChannelMergerNode {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> From<&'a ChannelMergerOptions> for ChannelNodeOptions {
|
impl Convert<ChannelNodeOptions> for ChannelMergerOptions {
|
||||||
fn from(options: &'a ChannelMergerOptions) -> Self {
|
fn convert(self) -> ChannelNodeOptions {
|
||||||
Self {
|
ChannelNodeOptions {
|
||||||
channels: options.numberOfInputs as u8,
|
channels: self.numberOfInputs as u8,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,7 +6,7 @@ use dom_struct::dom_struct;
|
||||||
use js::rust::HandleObject;
|
use js::rust::HandleObject;
|
||||||
use servo_media::audio::node::AudioNodeInit;
|
use servo_media::audio::node::AudioNodeInit;
|
||||||
|
|
||||||
use crate::dom::audionode::{AudioNode, MAX_CHANNEL_COUNT};
|
use crate::dom::audionode::{AudioNode, AudioNodeOptionsHelper, MAX_CHANNEL_COUNT};
|
||||||
use crate::dom::baseaudiocontext::BaseAudioContext;
|
use crate::dom::baseaudiocontext::BaseAudioContext;
|
||||||
use crate::dom::bindings::codegen::Bindings::AudioNodeBinding::{
|
use crate::dom::bindings::codegen::Bindings::AudioNodeBinding::{
|
||||||
ChannelCountMode, ChannelInterpretation,
|
ChannelCountMode, ChannelInterpretation,
|
||||||
|
|
|
@ -10,6 +10,7 @@ use servo_media::audio::constant_source_node::ConstantSourceNodeOptions as Servo
|
||||||
use servo_media::audio::node::{AudioNodeInit, AudioNodeType};
|
use servo_media::audio::node::{AudioNodeInit, AudioNodeType};
|
||||||
use servo_media::audio::param::ParamType;
|
use servo_media::audio::param::ParamType;
|
||||||
|
|
||||||
|
use crate::conversions::Convert;
|
||||||
use crate::dom::audioparam::AudioParam;
|
use crate::dom::audioparam::AudioParam;
|
||||||
use crate::dom::audioscheduledsourcenode::AudioScheduledSourceNode;
|
use crate::dom::audioscheduledsourcenode::AudioScheduledSourceNode;
|
||||||
use crate::dom::baseaudiocontext::BaseAudioContext;
|
use crate::dom::baseaudiocontext::BaseAudioContext;
|
||||||
|
@ -38,8 +39,9 @@ impl ConstantSourceNode {
|
||||||
can_gc: CanGc,
|
can_gc: CanGc,
|
||||||
) -> Fallible<ConstantSourceNode> {
|
) -> Fallible<ConstantSourceNode> {
|
||||||
let node_options = Default::default();
|
let node_options = Default::default();
|
||||||
|
let offset = *options.offset;
|
||||||
let source_node = AudioScheduledSourceNode::new_inherited(
|
let source_node = AudioScheduledSourceNode::new_inherited(
|
||||||
AudioNodeInit::ConstantSourceNode(options.into()),
|
AudioNodeInit::ConstantSourceNode(options.convert()),
|
||||||
context,
|
context,
|
||||||
node_options, /* 2, MAX, Speakers */
|
node_options, /* 2, MAX, Speakers */
|
||||||
0, /* inputs */
|
0, /* inputs */
|
||||||
|
@ -53,7 +55,7 @@ impl ConstantSourceNode {
|
||||||
AudioNodeType::ConstantSourceNode,
|
AudioNodeType::ConstantSourceNode,
|
||||||
ParamType::Offset,
|
ParamType::Offset,
|
||||||
AutomationRate::A_rate,
|
AutomationRate::A_rate,
|
||||||
*options.offset,
|
offset,
|
||||||
f32::MIN,
|
f32::MIN,
|
||||||
f32::MAX,
|
f32::MAX,
|
||||||
can_gc,
|
can_gc,
|
||||||
|
@ -110,10 +112,10 @@ impl ConstantSourceNodeMethods<crate::DomTypeHolder> for ConstantSourceNode {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> From<&'a ConstantSourceOptions> for ServoMediaConstantSourceOptions {
|
impl Convert<ServoMediaConstantSourceOptions> for ConstantSourceOptions {
|
||||||
fn from(options: &'a ConstantSourceOptions) -> Self {
|
fn convert(self) -> ServoMediaConstantSourceOptions {
|
||||||
Self {
|
ServoMediaConstantSourceOptions {
|
||||||
offset: *options.offset,
|
offset: *self.offset,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,7 +12,7 @@ use js::rust::HandleValue as SafeHandleValue;
|
||||||
|
|
||||||
use super::bindings::root::{DomRoot, MutNullableDom};
|
use super::bindings::root::{DomRoot, MutNullableDom};
|
||||||
use super::types::{ReadableStream, ReadableStreamDefaultReader};
|
use super::types::{ReadableStream, ReadableStreamDefaultReader};
|
||||||
use crate::dom::bindings::import::module::Error;
|
use crate::dom::bindings::error::Error;
|
||||||
use crate::dom::bindings::reflector::{DomGlobal, Reflector, reflect_dom_object};
|
use crate::dom::bindings::reflector::{DomGlobal, Reflector, reflect_dom_object};
|
||||||
use crate::dom::bindings::root::Dom;
|
use crate::dom::bindings::root::Dom;
|
||||||
use crate::dom::defaultteereadrequest::DefaultTeeReadRequest;
|
use crate::dom::defaultteereadrequest::DefaultTeeReadRequest;
|
||||||
|
|
|
@ -25,6 +25,7 @@ use servo_url::ServoUrl;
|
||||||
use style::str::HTML_SPACE_CHARACTERS;
|
use style::str::HTML_SPACE_CHARACTERS;
|
||||||
use stylo_atoms::Atom;
|
use stylo_atoms::Atom;
|
||||||
|
|
||||||
|
use crate::conversions::Convert;
|
||||||
use crate::dom::beforeunloadevent::BeforeUnloadEvent;
|
use crate::dom::beforeunloadevent::BeforeUnloadEvent;
|
||||||
use crate::dom::bindings::callback::{CallbackContainer, CallbackFunction, ExceptionHandling};
|
use crate::dom::bindings::callback::{CallbackContainer, CallbackFunction, ExceptionHandling};
|
||||||
use crate::dom::bindings::cell::DomRefCell;
|
use crate::dom::bindings::cell::DomRefCell;
|
||||||
|
@ -384,7 +385,7 @@ impl EventListeners {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[dom_struct]
|
#[dom_struct]
|
||||||
pub(crate) struct EventTarget {
|
pub struct EventTarget {
|
||||||
reflector_: Reflector,
|
reflector_: Reflector,
|
||||||
handlers: DomRefCell<HashMapTracedValues<Atom, EventListeners, BuildHasherDefault<FnvHasher>>>,
|
handlers: DomRefCell<HashMapTracedValues<Atom, EventListeners, BuildHasherDefault<FnvHasher>>>,
|
||||||
}
|
}
|
||||||
|
@ -944,7 +945,7 @@ impl EventTargetMethods<crate::DomTypeHolder> for EventTarget {
|
||||||
listener: Option<Rc<EventListener>>,
|
listener: Option<Rc<EventListener>>,
|
||||||
options: AddEventListenerOptionsOrBoolean,
|
options: AddEventListenerOptionsOrBoolean,
|
||||||
) {
|
) {
|
||||||
self.add_event_listener(ty, listener, options.into())
|
self.add_event_listener(ty, listener, options.convert())
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://dom.spec.whatwg.org/#dom-eventtarget-removeeventlistener
|
// https://dom.spec.whatwg.org/#dom-eventtarget-removeeventlistener
|
||||||
|
@ -954,7 +955,7 @@ impl EventTargetMethods<crate::DomTypeHolder> for EventTarget {
|
||||||
listener: Option<Rc<EventListener>>,
|
listener: Option<Rc<EventListener>>,
|
||||||
options: EventListenerOptionsOrBoolean,
|
options: EventListenerOptionsOrBoolean,
|
||||||
) {
|
) {
|
||||||
self.remove_event_listener(ty, listener, options.into())
|
self.remove_event_listener(ty, listener, options.convert())
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://dom.spec.whatwg.org/#dom-eventtarget-dispatchevent
|
// https://dom.spec.whatwg.org/#dom-eventtarget-dispatchevent
|
||||||
|
@ -976,11 +977,11 @@ impl VirtualMethods for EventTarget {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<AddEventListenerOptionsOrBoolean> for AddEventListenerOptions {
|
impl Convert<AddEventListenerOptions> for AddEventListenerOptionsOrBoolean {
|
||||||
fn from(options: AddEventListenerOptionsOrBoolean) -> Self {
|
fn convert(self) -> AddEventListenerOptions {
|
||||||
match options {
|
match self {
|
||||||
AddEventListenerOptionsOrBoolean::AddEventListenerOptions(options) => options,
|
AddEventListenerOptionsOrBoolean::AddEventListenerOptions(options) => options,
|
||||||
AddEventListenerOptionsOrBoolean::Boolean(capture) => Self {
|
AddEventListenerOptionsOrBoolean::Boolean(capture) => AddEventListenerOptions {
|
||||||
parent: EventListenerOptions { capture },
|
parent: EventListenerOptions { capture },
|
||||||
once: false,
|
once: false,
|
||||||
passive: None,
|
passive: None,
|
||||||
|
@ -989,11 +990,11 @@ impl From<AddEventListenerOptionsOrBoolean> for AddEventListenerOptions {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<EventListenerOptionsOrBoolean> for EventListenerOptions {
|
impl Convert<EventListenerOptions> for EventListenerOptionsOrBoolean {
|
||||||
fn from(options: EventListenerOptionsOrBoolean) -> Self {
|
fn convert(self) -> EventListenerOptions {
|
||||||
match options {
|
match self {
|
||||||
EventListenerOptionsOrBoolean::EventListenerOptions(options) => options,
|
EventListenerOptionsOrBoolean::EventListenerOptions(options) => options,
|
||||||
EventListenerOptionsOrBoolean::Boolean(capture) => Self { capture },
|
EventListenerOptionsOrBoolean::Boolean(capture) => EventListenerOptions { capture },
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,7 +10,8 @@ use servo_media::audio::gain_node::GainNodeOptions;
|
||||||
use servo_media::audio::node::{AudioNodeInit, AudioNodeType};
|
use servo_media::audio::node::{AudioNodeInit, AudioNodeType};
|
||||||
use servo_media::audio::param::ParamType;
|
use servo_media::audio::param::ParamType;
|
||||||
|
|
||||||
use crate::dom::audionode::AudioNode;
|
use crate::conversions::Convert;
|
||||||
|
use crate::dom::audionode::{AudioNode, AudioNodeOptionsHelper};
|
||||||
use crate::dom::audioparam::AudioParam;
|
use crate::dom::audioparam::AudioParam;
|
||||||
use crate::dom::baseaudiocontext::BaseAudioContext;
|
use crate::dom::baseaudiocontext::BaseAudioContext;
|
||||||
use crate::dom::bindings::codegen::Bindings::AudioNodeBinding::{
|
use crate::dom::bindings::codegen::Bindings::AudioNodeBinding::{
|
||||||
|
@ -42,8 +43,9 @@ impl GainNode {
|
||||||
options
|
options
|
||||||
.parent
|
.parent
|
||||||
.unwrap_or(2, ChannelCountMode::Max, ChannelInterpretation::Speakers);
|
.unwrap_or(2, ChannelCountMode::Max, ChannelInterpretation::Speakers);
|
||||||
|
let gain = *options.gain;
|
||||||
let node = AudioNode::new_inherited(
|
let node = AudioNode::new_inherited(
|
||||||
AudioNodeInit::GainNode(options.into()),
|
AudioNodeInit::GainNode(options.convert()),
|
||||||
context,
|
context,
|
||||||
node_options,
|
node_options,
|
||||||
1, // inputs
|
1, // inputs
|
||||||
|
@ -56,9 +58,9 @@ impl GainNode {
|
||||||
AudioNodeType::GainNode,
|
AudioNodeType::GainNode,
|
||||||
ParamType::Gain,
|
ParamType::Gain,
|
||||||
AutomationRate::A_rate,
|
AutomationRate::A_rate,
|
||||||
*options.gain, // default value
|
gain, // default value
|
||||||
f32::MIN, // min value
|
f32::MIN, // min value
|
||||||
f32::MAX, // max value
|
f32::MAX, // max value
|
||||||
can_gc,
|
can_gc,
|
||||||
);
|
);
|
||||||
Ok(GainNode {
|
Ok(GainNode {
|
||||||
|
@ -112,10 +114,8 @@ impl GainNodeMethods<crate::DomTypeHolder> for GainNode {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> From<&'a GainOptions> for GainNodeOptions {
|
impl Convert<GainNodeOptions> for GainOptions {
|
||||||
fn from(options: &'a GainOptions) -> Self {
|
fn convert(self) -> GainNodeOptions {
|
||||||
Self {
|
GainNodeOptions { gain: *self.gain }
|
||||||
gain: *options.gain,
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,7 +29,9 @@ use style::attr::AttrValue;
|
||||||
|
|
||||||
use crate::canvas_context::CanvasContext as _;
|
use crate::canvas_context::CanvasContext as _;
|
||||||
pub(crate) use crate::canvas_context::*;
|
pub(crate) use crate::canvas_context::*;
|
||||||
|
use crate::conversions::Convert;
|
||||||
use crate::dom::attr::Attr;
|
use crate::dom::attr::Attr;
|
||||||
|
use crate::dom::bindings::callback::ExceptionHandling;
|
||||||
use crate::dom::bindings::cell::{DomRefCell, Ref, ref_filter_map};
|
use crate::dom::bindings::cell::{DomRefCell, Ref, ref_filter_map};
|
||||||
use crate::dom::bindings::codegen::Bindings::HTMLCanvasElementBinding::{
|
use crate::dom::bindings::codegen::Bindings::HTMLCanvasElementBinding::{
|
||||||
BlobCallback, HTMLCanvasElementMethods, RenderingContext,
|
BlobCallback, HTMLCanvasElementMethods, RenderingContext,
|
||||||
|
@ -39,7 +41,6 @@ use crate::dom::bindings::codegen::Bindings::WebGLRenderingContextBinding::WebGL
|
||||||
use crate::dom::bindings::codegen::UnionTypes::HTMLCanvasElementOrOffscreenCanvas;
|
use crate::dom::bindings::codegen::UnionTypes::HTMLCanvasElementOrOffscreenCanvas;
|
||||||
use crate::dom::bindings::conversions::ConversionResult;
|
use crate::dom::bindings::conversions::ConversionResult;
|
||||||
use crate::dom::bindings::error::{Error, Fallible};
|
use crate::dom::bindings::error::{Error, Fallible};
|
||||||
use crate::dom::bindings::import::module::ExceptionHandling;
|
|
||||||
use crate::dom::bindings::inheritance::Castable;
|
use crate::dom::bindings::inheritance::Castable;
|
||||||
use crate::dom::bindings::num::Finite;
|
use crate::dom::bindings::num::Finite;
|
||||||
use crate::dom::bindings::refcounted::Trusted;
|
use crate::dom::bindings::refcounted::Trusted;
|
||||||
|
@ -342,9 +343,9 @@ impl HTMLCanvasElement {
|
||||||
fn get_gl_attributes(cx: JSContext, options: HandleValue) -> Option<GLContextAttributes> {
|
fn get_gl_attributes(cx: JSContext, options: HandleValue) -> Option<GLContextAttributes> {
|
||||||
unsafe {
|
unsafe {
|
||||||
match WebGLContextAttributes::new(cx, options) {
|
match WebGLContextAttributes::new(cx, options) {
|
||||||
Ok(ConversionResult::Success(ref attrs)) => Some(From::from(attrs)),
|
Ok(ConversionResult::Success(attrs)) => Some(attrs.convert()),
|
||||||
Ok(ConversionResult::Failure(ref error)) => {
|
Ok(ConversionResult::Failure(error)) => {
|
||||||
throw_type_error(*cx, error);
|
throw_type_error(*cx, &error);
|
||||||
None
|
None
|
||||||
},
|
},
|
||||||
_ => {
|
_ => {
|
||||||
|
@ -702,15 +703,15 @@ impl VirtualMethods for HTMLCanvasElement {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> From<&'a WebGLContextAttributes> for GLContextAttributes {
|
impl Convert<GLContextAttributes> for WebGLContextAttributes {
|
||||||
fn from(attrs: &'a WebGLContextAttributes) -> GLContextAttributes {
|
fn convert(self) -> GLContextAttributes {
|
||||||
GLContextAttributes {
|
GLContextAttributes {
|
||||||
alpha: attrs.alpha,
|
alpha: self.alpha,
|
||||||
depth: attrs.depth,
|
depth: self.depth,
|
||||||
stencil: attrs.stencil,
|
stencil: self.stencil,
|
||||||
antialias: attrs.antialias,
|
antialias: self.antialias,
|
||||||
premultiplied_alpha: attrs.premultipliedAlpha,
|
premultiplied_alpha: self.premultipliedAlpha,
|
||||||
preserve_drawing_buffer: attrs.preserveDrawingBuffer,
|
preserve_drawing_buffer: self.preserveDrawingBuffer,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,7 +12,8 @@ use js::typedarray::Float32Array;
|
||||||
use servo_media::audio::iir_filter_node::{IIRFilterNode as IIRFilter, IIRFilterNodeOptions};
|
use servo_media::audio::iir_filter_node::{IIRFilterNode as IIRFilter, IIRFilterNodeOptions};
|
||||||
use servo_media::audio::node::AudioNodeInit;
|
use servo_media::audio::node::AudioNodeInit;
|
||||||
|
|
||||||
use crate::dom::audionode::AudioNode;
|
use crate::conversions::Convert;
|
||||||
|
use crate::dom::audionode::{AudioNode, AudioNodeOptionsHelper};
|
||||||
use crate::dom::baseaudiocontext::BaseAudioContext;
|
use crate::dom::baseaudiocontext::BaseAudioContext;
|
||||||
use crate::dom::bindings::codegen::Bindings::AudioNodeBinding::{
|
use crate::dom::bindings::codegen::Bindings::AudioNodeBinding::{
|
||||||
ChannelCountMode, ChannelInterpretation,
|
ChannelCountMode, ChannelInterpretation,
|
||||||
|
@ -53,7 +54,9 @@ impl IIRFilterNode {
|
||||||
options
|
options
|
||||||
.parent
|
.parent
|
||||||
.unwrap_or(2, ChannelCountMode::Max, ChannelInterpretation::Speakers);
|
.unwrap_or(2, ChannelCountMode::Max, ChannelInterpretation::Speakers);
|
||||||
let init_options = options.into();
|
let feedforward = (*options.feedforward).to_vec();
|
||||||
|
let feedback = (*options.feedback).to_vec();
|
||||||
|
let init_options = options.clone().convert();
|
||||||
let node = AudioNode::new_inherited(
|
let node = AudioNode::new_inherited(
|
||||||
AudioNodeInit::IIRFilterNode(init_options),
|
AudioNodeInit::IIRFilterNode(init_options),
|
||||||
context,
|
context,
|
||||||
|
@ -63,8 +66,8 @@ impl IIRFilterNode {
|
||||||
)?;
|
)?;
|
||||||
Ok(IIRFilterNode {
|
Ok(IIRFilterNode {
|
||||||
node,
|
node,
|
||||||
feedforward: (*options.feedforward).to_vec(),
|
feedforward,
|
||||||
feedback: (*options.feedback).to_vec(),
|
feedback,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -139,12 +142,11 @@ impl IIRFilterNodeMethods<crate::DomTypeHolder> for IIRFilterNode {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> From<&'a IIRFilterOptions> for IIRFilterNodeOptions {
|
impl Convert<IIRFilterNodeOptions> for IIRFilterOptions {
|
||||||
fn from(options: &'a IIRFilterOptions) -> Self {
|
fn convert(self) -> IIRFilterNodeOptions {
|
||||||
let feedforward: Vec<f64> =
|
let feedforward: Vec<f64> = (*self.feedforward.iter().map(|v| **v).collect_vec()).to_vec();
|
||||||
(*options.feedforward.iter().map(|v| **v).collect_vec()).to_vec();
|
let feedback: Vec<f64> = (*self.feedback.iter().map(|v| **v).collect_vec()).to_vec();
|
||||||
let feedback: Vec<f64> = (*options.feedback.iter().map(|v| **v).collect_vec()).to_vec();
|
IIRFilterNodeOptions {
|
||||||
Self {
|
|
||||||
feedforward: Arc::new(feedforward),
|
feedforward: Arc::new(feedforward),
|
||||||
feedback: Arc::new(feedback),
|
feedback: Arc::new(feedback),
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,8 +23,7 @@ use super::intersectionobserverrootmargin::IntersectionObserverRootMargin;
|
||||||
use crate::dom::bindings::cell::DomRefCell;
|
use crate::dom::bindings::cell::DomRefCell;
|
||||||
use crate::dom::bindings::codegen::Bindings::IntersectionObserverBinding::IntersectionObserverInit;
|
use crate::dom::bindings::codegen::Bindings::IntersectionObserverBinding::IntersectionObserverInit;
|
||||||
use crate::dom::bindings::codegen::UnionTypes::{DoubleOrDoubleSequence, ElementOrDocument};
|
use crate::dom::bindings::codegen::UnionTypes::{DoubleOrDoubleSequence, ElementOrDocument};
|
||||||
use crate::dom::bindings::error::Error;
|
use crate::dom::bindings::error::{Error, Fallible};
|
||||||
use crate::dom::bindings::import::module::Fallible;
|
|
||||||
use crate::dom::bindings::num::Finite;
|
use crate::dom::bindings::num::Finite;
|
||||||
use crate::dom::bindings::reflector::{Reflector, reflect_dom_object_with_proto};
|
use crate::dom::bindings::reflector::{Reflector, reflect_dom_object_with_proto};
|
||||||
use crate::dom::bindings::root::{Dom, DomRoot};
|
use crate::dom::bindings::root::{Dom, DomRoot};
|
||||||
|
|
|
@ -9,7 +9,7 @@ use servo_media::audio::node::AudioNodeInit;
|
||||||
use servo_media::streams::MediaStreamType;
|
use servo_media::streams::MediaStreamType;
|
||||||
|
|
||||||
use crate::dom::audiocontext::AudioContext;
|
use crate::dom::audiocontext::AudioContext;
|
||||||
use crate::dom::audionode::AudioNode;
|
use crate::dom::audionode::{AudioNode, AudioNodeOptionsHelper};
|
||||||
use crate::dom::bindings::codegen::Bindings::AudioNodeBinding::{
|
use crate::dom::bindings::codegen::Bindings::AudioNodeBinding::{
|
||||||
AudioNodeOptions, ChannelCountMode, ChannelInterpretation,
|
AudioNodeOptions, ChannelCountMode, ChannelInterpretation,
|
||||||
};
|
};
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
* 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 https://mozilla.org/MPL/2.0/. */
|
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
|
use std::rc::Rc;
|
||||||
use std::time::{SystemTime, UNIX_EPOCH};
|
use std::time::{SystemTime, UNIX_EPOCH};
|
||||||
|
|
||||||
use dom_struct::dom_struct;
|
use dom_struct::dom_struct;
|
||||||
|
@ -24,8 +25,7 @@ use crate::dom::bindings::codegen::Bindings::PermissionStatusBinding::{
|
||||||
PermissionDescriptor, PermissionName, PermissionState,
|
PermissionDescriptor, PermissionName, PermissionState,
|
||||||
};
|
};
|
||||||
use crate::dom::bindings::codegen::UnionTypes::UnsignedLongOrUnsignedLongSequence;
|
use crate::dom::bindings::codegen::UnionTypes::UnsignedLongOrUnsignedLongSequence;
|
||||||
use crate::dom::bindings::error::Error;
|
use crate::dom::bindings::error::{Error, Fallible};
|
||||||
use crate::dom::bindings::import::module::{Fallible, Rc};
|
|
||||||
use crate::dom::bindings::inheritance::Castable;
|
use crate::dom::bindings::inheritance::Castable;
|
||||||
use crate::dom::bindings::reflector::reflect_dom_object_with_proto;
|
use crate::dom::bindings::reflector::reflect_dom_object_with_proto;
|
||||||
use crate::dom::bindings::root::{Dom, DomRoot};
|
use crate::dom::bindings::root::{Dom, DomRoot};
|
||||||
|
|
|
@ -15,6 +15,7 @@ use servo_media::audio::oscillator_node::{
|
||||||
use servo_media::audio::param::ParamType;
|
use servo_media::audio::param::ParamType;
|
||||||
|
|
||||||
use crate::conversions::Convert;
|
use crate::conversions::Convert;
|
||||||
|
use crate::dom::audionode::AudioNodeOptionsHelper;
|
||||||
use crate::dom::audioparam::AudioParam;
|
use crate::dom::audioparam::AudioParam;
|
||||||
use crate::dom::audioscheduledsourcenode::AudioScheduledSourceNode;
|
use crate::dom::audioscheduledsourcenode::AudioScheduledSourceNode;
|
||||||
use crate::dom::baseaudiocontext::BaseAudioContext;
|
use crate::dom::baseaudiocontext::BaseAudioContext;
|
||||||
|
|
|
@ -14,7 +14,7 @@ use servo_media::audio::panner_node::{
|
||||||
use servo_media::audio::param::{ParamDir, ParamType};
|
use servo_media::audio::param::{ParamDir, ParamType};
|
||||||
|
|
||||||
use crate::conversions::Convert;
|
use crate::conversions::Convert;
|
||||||
use crate::dom::audionode::AudioNode;
|
use crate::dom::audionode::{AudioNode, AudioNodeOptionsHelper};
|
||||||
use crate::dom::audioparam::AudioParam;
|
use crate::dom::audioparam::AudioParam;
|
||||||
use crate::dom::baseaudiocontext::BaseAudioContext;
|
use crate::dom::baseaudiocontext::BaseAudioContext;
|
||||||
use crate::dom::bindings::codegen::Bindings::AudioNodeBinding::{
|
use crate::dom::bindings::codegen::Bindings::AudioNodeBinding::{
|
||||||
|
|
|
@ -3,7 +3,6 @@
|
||||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
use std::cell::Cell;
|
use std::cell::Cell;
|
||||||
use std::fmt::{self, Display, Formatter};
|
|
||||||
|
|
||||||
use dom_struct::dom_struct;
|
use dom_struct::dom_struct;
|
||||||
|
|
||||||
|
@ -63,9 +62,3 @@ impl PermissionStatusMethods<crate::DomTypeHolder> for PermissionStatus {
|
||||||
// https://w3c.github.io/permissions/#dom-permissionstatus-onchange
|
// https://w3c.github.io/permissions/#dom-permissionstatus-onchange
|
||||||
event_handler!(change, GetOnchange, SetOnchange);
|
event_handler!(change, GetOnchange, SetOnchange);
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Display for PermissionName {
|
|
||||||
fn fmt(&self, f: &mut Formatter) -> fmt::Result {
|
|
||||||
write!(f, "{}", self.as_str())
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
|
@ -25,9 +25,8 @@ use crate::dom::bindings::buffer_source::{
|
||||||
Constructor, byte_size, create_array_buffer_with_size, create_buffer_source_with_constructor,
|
Constructor, byte_size, create_array_buffer_with_size, create_buffer_source_with_constructor,
|
||||||
};
|
};
|
||||||
use crate::dom::bindings::codegen::Bindings::ReadableByteStreamControllerBinding::ReadableByteStreamControllerMethods;
|
use crate::dom::bindings::codegen::Bindings::ReadableByteStreamControllerBinding::ReadableByteStreamControllerMethods;
|
||||||
use crate::dom::bindings::error::ErrorToJsval;
|
use crate::dom::bindings::codegen::UnionTypes::ReadableStreamDefaultControllerOrReadableByteStreamController as Controller;
|
||||||
use crate::dom::bindings::import::module::UnionTypes::ReadableStreamDefaultControllerOrReadableByteStreamController as Controller;
|
use crate::dom::bindings::error::{Error, ErrorToJsval, Fallible};
|
||||||
use crate::dom::bindings::import::module::{Error, Fallible};
|
|
||||||
use crate::dom::bindings::reflector::{DomGlobal, Reflector};
|
use crate::dom::bindings::reflector::{DomGlobal, Reflector};
|
||||||
use crate::dom::bindings::root::{DomRoot, MutNullableDom};
|
use crate::dom::bindings::root::{DomRoot, MutNullableDom};
|
||||||
use crate::dom::bindings::trace::RootedTraceableBox;
|
use crate::dom::bindings::trace::RootedTraceableBox;
|
||||||
|
|
|
@ -24,8 +24,7 @@ use crate::dom::bindings::codegen::Bindings::ReadableStreamDefaultReaderBinding:
|
||||||
use crate::dom::bindings::codegen::Bindings::ReadableStreamDefaultControllerBinding::ReadableStreamDefaultController_Binding::ReadableStreamDefaultControllerMethods;
|
use crate::dom::bindings::codegen::Bindings::ReadableStreamDefaultControllerBinding::ReadableStreamDefaultController_Binding::ReadableStreamDefaultControllerMethods;
|
||||||
use crate::dom::bindings::codegen::Bindings::UnderlyingSourceBinding::UnderlyingSource as JsUnderlyingSource;
|
use crate::dom::bindings::codegen::Bindings::UnderlyingSourceBinding::UnderlyingSource as JsUnderlyingSource;
|
||||||
use crate::dom::bindings::conversions::{ConversionBehavior, ConversionResult};
|
use crate::dom::bindings::conversions::{ConversionBehavior, ConversionResult};
|
||||||
use crate::dom::bindings::error::{Error, ErrorToJsval};
|
use crate::dom::bindings::error::{Error, ErrorToJsval, Fallible};
|
||||||
use crate::dom::bindings::import::module::Fallible;
|
|
||||||
use crate::dom::bindings::codegen::UnionTypes::ReadableStreamDefaultReaderOrReadableStreamBYOBReader as ReadableStreamReader;
|
use crate::dom::bindings::codegen::UnionTypes::ReadableStreamDefaultReaderOrReadableStreamBYOBReader as ReadableStreamReader;
|
||||||
use crate::dom::bindings::reflector::{DomGlobal, Reflector, reflect_dom_object_with_proto};
|
use crate::dom::bindings::reflector::{DomGlobal, Reflector, reflect_dom_object_with_proto};
|
||||||
use crate::dom::bindings::root::{DomRoot, MutNullableDom, Dom};
|
use crate::dom::bindings::root::{DomRoot, MutNullableDom, Dom};
|
||||||
|
|
|
@ -21,8 +21,7 @@ use super::bindings::reflector::reflect_dom_object;
|
||||||
use super::readablestreamgenericreader::ReadableStreamGenericReader;
|
use super::readablestreamgenericreader::ReadableStreamGenericReader;
|
||||||
use crate::dom::bindings::cell::DomRefCell;
|
use crate::dom::bindings::cell::DomRefCell;
|
||||||
use crate::dom::bindings::codegen::Bindings::ReadableStreamBYOBReaderBinding::ReadableStreamBYOBReaderMethods;
|
use crate::dom::bindings::codegen::Bindings::ReadableStreamBYOBReaderBinding::ReadableStreamBYOBReaderMethods;
|
||||||
use crate::dom::bindings::error::{Error, ErrorToJsval};
|
use crate::dom::bindings::error::{Error, ErrorToJsval, Fallible};
|
||||||
use crate::dom::bindings::import::module::Fallible;
|
|
||||||
use crate::dom::bindings::reflector::{DomGlobal, Reflector, reflect_dom_object_with_proto};
|
use crate::dom::bindings::reflector::{DomGlobal, Reflector, reflect_dom_object_with_proto};
|
||||||
use crate::dom::bindings::root::{DomRoot, MutNullableDom};
|
use crate::dom::bindings::root::{DomRoot, MutNullableDom};
|
||||||
use crate::dom::bindings::trace::RootedTraceableBox;
|
use crate::dom::bindings::trace::RootedTraceableBox;
|
||||||
|
|
|
@ -11,7 +11,7 @@ use super::bindings::cell::DomRefCell;
|
||||||
use super::bindings::reflector::reflect_dom_object;
|
use super::bindings::reflector::reflect_dom_object;
|
||||||
use super::bindings::root::DomRoot;
|
use super::bindings::root::DomRoot;
|
||||||
use crate::dom::bindings::codegen::Bindings::ReadableStreamBYOBRequestBinding::ReadableStreamBYOBRequestMethods;
|
use crate::dom::bindings::codegen::Bindings::ReadableStreamBYOBRequestBinding::ReadableStreamBYOBRequestMethods;
|
||||||
use crate::dom::bindings::import::module::{Error, Fallible};
|
use crate::dom::bindings::error::{Error, Fallible};
|
||||||
use crate::dom::bindings::reflector::Reflector;
|
use crate::dom::bindings::reflector::Reflector;
|
||||||
use crate::dom::bindings::root::MutNullableDom;
|
use crate::dom::bindings::root::MutNullableDom;
|
||||||
use crate::dom::readablebytestreamcontroller::ReadableByteStreamController;
|
use crate::dom::readablebytestreamcontroller::ReadableByteStreamController;
|
||||||
|
|
|
@ -20,8 +20,7 @@ use crate::dom::bindings::cell::DomRefCell;
|
||||||
use crate::dom::bindings::codegen::Bindings::ReadableStreamDefaultReaderBinding::{
|
use crate::dom::bindings::codegen::Bindings::ReadableStreamDefaultReaderBinding::{
|
||||||
ReadableStreamDefaultReaderMethods, ReadableStreamReadResult,
|
ReadableStreamDefaultReaderMethods, ReadableStreamReadResult,
|
||||||
};
|
};
|
||||||
use crate::dom::bindings::error::{Error, ErrorToJsval};
|
use crate::dom::bindings::error::{Error, ErrorToJsval, Fallible};
|
||||||
use crate::dom::bindings::import::module::Fallible;
|
|
||||||
use crate::dom::bindings::reflector::{DomGlobal, Reflector, reflect_dom_object_with_proto};
|
use crate::dom::bindings::reflector::{DomGlobal, Reflector, reflect_dom_object_with_proto};
|
||||||
use crate::dom::bindings::root::{Dom, DomRoot};
|
use crate::dom::bindings::root::{Dom, DomRoot};
|
||||||
use crate::dom::bindings::trace::RootedTraceableBox;
|
use crate::dom::bindings::trace::RootedTraceableBox;
|
||||||
|
|
|
@ -9,8 +9,7 @@ use js::rust::HandleValue as SafeHandleValue;
|
||||||
|
|
||||||
use super::readablestream::ReaderType;
|
use super::readablestream::ReaderType;
|
||||||
use super::types::ReadableStream;
|
use super::types::ReadableStream;
|
||||||
use crate::dom::bindings::error::{Error, ErrorToJsval};
|
use crate::dom::bindings::error::{Error, ErrorToJsval, Fallible};
|
||||||
use crate::dom::bindings::import::module::Fallible;
|
|
||||||
use crate::dom::bindings::reflector::DomGlobal;
|
use crate::dom::bindings::reflector::DomGlobal;
|
||||||
use crate::dom::bindings::root::{DomRoot, MutNullableDom};
|
use crate::dom::bindings::root::{DomRoot, MutNullableDom};
|
||||||
use crate::dom::globalscope::GlobalScope;
|
use crate::dom::globalscope::GlobalScope;
|
||||||
|
|
|
@ -8,6 +8,8 @@ use servo_media::audio::node::{AudioNodeInit, AudioNodeType};
|
||||||
use servo_media::audio::param::ParamType;
|
use servo_media::audio::param::ParamType;
|
||||||
use servo_media::audio::stereo_panner::StereoPannerOptions as ServoMediaStereoPannerOptions;
|
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::audioparam::AudioParam;
|
||||||
use crate::dom::audioscheduledsourcenode::AudioScheduledSourceNode;
|
use crate::dom::audioscheduledsourcenode::AudioScheduledSourceNode;
|
||||||
use crate::dom::baseaudiocontext::BaseAudioContext;
|
use crate::dom::baseaudiocontext::BaseAudioContext;
|
||||||
|
@ -48,8 +50,9 @@ impl StereoPannerNode {
|
||||||
if node_options.count > 2 || node_options.count == 0 {
|
if node_options.count > 2 || node_options.count == 0 {
|
||||||
return Err(Error::NotSupported);
|
return Err(Error::NotSupported);
|
||||||
}
|
}
|
||||||
|
let pan = *options.pan;
|
||||||
let source_node = AudioScheduledSourceNode::new_inherited(
|
let source_node = AudioScheduledSourceNode::new_inherited(
|
||||||
AudioNodeInit::StereoPannerNode(options.into()),
|
AudioNodeInit::StereoPannerNode(options.convert()),
|
||||||
context,
|
context,
|
||||||
node_options,
|
node_options,
|
||||||
1, /* inputs */
|
1, /* inputs */
|
||||||
|
@ -63,7 +66,7 @@ impl StereoPannerNode {
|
||||||
AudioNodeType::StereoPannerNode,
|
AudioNodeType::StereoPannerNode,
|
||||||
ParamType::Pan,
|
ParamType::Pan,
|
||||||
AutomationRate::A_rate,
|
AutomationRate::A_rate,
|
||||||
*options.pan,
|
pan,
|
||||||
-1.,
|
-1.,
|
||||||
1.,
|
1.,
|
||||||
CanGc::note(),
|
CanGc::note(),
|
||||||
|
@ -120,8 +123,8 @@ impl StereoPannerNodeMethods<crate::DomTypeHolder> for StereoPannerNode {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> From<&'a StereoPannerOptions> for ServoMediaStereoPannerOptions {
|
impl Convert<ServoMediaStereoPannerOptions> for StereoPannerOptions {
|
||||||
fn from(options: &'a StereoPannerOptions) -> Self {
|
fn convert(self) -> ServoMediaStereoPannerOptions {
|
||||||
Self { pan: *options.pan }
|
ServoMediaStereoPannerOptions { pan: *self.pan }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,7 +38,6 @@ use crate::dom::bindings::codegen::UnionTypes::{
|
||||||
ArrayBufferViewOrArrayBuffer, ArrayBufferViewOrArrayBufferOrJsonWebKey,
|
ArrayBufferViewOrArrayBuffer, ArrayBufferViewOrArrayBufferOrJsonWebKey,
|
||||||
};
|
};
|
||||||
use crate::dom::bindings::error::{Error, Fallible};
|
use crate::dom::bindings::error::{Error, Fallible};
|
||||||
use crate::dom::bindings::import::module::SafeJSContext;
|
|
||||||
use crate::dom::bindings::refcounted::{Trusted, TrustedPromise};
|
use crate::dom::bindings::refcounted::{Trusted, TrustedPromise};
|
||||||
use crate::dom::bindings::reflector::{DomGlobal, Reflector, reflect_dom_object};
|
use crate::dom::bindings::reflector::{DomGlobal, Reflector, reflect_dom_object};
|
||||||
use crate::dom::bindings::root::DomRoot;
|
use crate::dom::bindings::root::DomRoot;
|
||||||
|
@ -258,7 +257,7 @@ impl SubtleCryptoMethods<crate::DomTypeHolder> for SubtleCrypto {
|
||||||
/// <https://w3c.github.io/webcrypto/#SubtleCrypto-method-sign>
|
/// <https://w3c.github.io/webcrypto/#SubtleCrypto-method-sign>
|
||||||
fn Sign(
|
fn Sign(
|
||||||
&self,
|
&self,
|
||||||
cx: SafeJSContext,
|
cx: JSContext,
|
||||||
algorithm: AlgorithmIdentifier,
|
algorithm: AlgorithmIdentifier,
|
||||||
key: &CryptoKey,
|
key: &CryptoKey,
|
||||||
data: ArrayBufferViewOrArrayBuffer,
|
data: ArrayBufferViewOrArrayBuffer,
|
||||||
|
@ -341,7 +340,7 @@ impl SubtleCryptoMethods<crate::DomTypeHolder> for SubtleCrypto {
|
||||||
/// <https://w3c.github.io/webcrypto/#SubtleCrypto-method-verify>
|
/// <https://w3c.github.io/webcrypto/#SubtleCrypto-method-verify>
|
||||||
fn Verify(
|
fn Verify(
|
||||||
&self,
|
&self,
|
||||||
cx: SafeJSContext,
|
cx: JSContext,
|
||||||
algorithm: AlgorithmIdentifier,
|
algorithm: AlgorithmIdentifier,
|
||||||
key: &CryptoKey,
|
key: &CryptoKey,
|
||||||
signature: ArrayBufferViewOrArrayBuffer,
|
signature: ArrayBufferViewOrArrayBuffer,
|
||||||
|
@ -429,7 +428,7 @@ impl SubtleCryptoMethods<crate::DomTypeHolder> for SubtleCrypto {
|
||||||
/// <https://w3c.github.io/webcrypto/#SubtleCrypto-method-digest>
|
/// <https://w3c.github.io/webcrypto/#SubtleCrypto-method-digest>
|
||||||
fn Digest(
|
fn Digest(
|
||||||
&self,
|
&self,
|
||||||
cx: SafeJSContext,
|
cx: JSContext,
|
||||||
algorithm: AlgorithmIdentifier,
|
algorithm: AlgorithmIdentifier,
|
||||||
data: ArrayBufferViewOrArrayBuffer,
|
data: ArrayBufferViewOrArrayBuffer,
|
||||||
comp: InRealm,
|
comp: InRealm,
|
||||||
|
@ -533,7 +532,7 @@ impl SubtleCryptoMethods<crate::DomTypeHolder> for SubtleCrypto {
|
||||||
/// <https://w3c.github.io/webcrypto/#SubtleCrypto-method-deriveKey>
|
/// <https://w3c.github.io/webcrypto/#SubtleCrypto-method-deriveKey>
|
||||||
fn DeriveKey(
|
fn DeriveKey(
|
||||||
&self,
|
&self,
|
||||||
cx: SafeJSContext,
|
cx: JSContext,
|
||||||
algorithm: AlgorithmIdentifier,
|
algorithm: AlgorithmIdentifier,
|
||||||
base_key: &CryptoKey,
|
base_key: &CryptoKey,
|
||||||
derived_key_type: AlgorithmIdentifier,
|
derived_key_type: AlgorithmIdentifier,
|
||||||
|
@ -663,7 +662,7 @@ impl SubtleCryptoMethods<crate::DomTypeHolder> for SubtleCrypto {
|
||||||
/// <https://w3c.github.io/webcrypto/#dfn-SubtleCrypto-method-deriveBits>
|
/// <https://w3c.github.io/webcrypto/#dfn-SubtleCrypto-method-deriveBits>
|
||||||
fn DeriveBits(
|
fn DeriveBits(
|
||||||
&self,
|
&self,
|
||||||
cx: SafeJSContext,
|
cx: JSContext,
|
||||||
algorithm: AlgorithmIdentifier,
|
algorithm: AlgorithmIdentifier,
|
||||||
base_key: &CryptoKey,
|
base_key: &CryptoKey,
|
||||||
length: Option<u32>,
|
length: Option<u32>,
|
||||||
|
@ -2631,7 +2630,11 @@ fn data_to_jwk_params(alg: &str, size: &str, key: &[u8]) -> (DOMString, DOMStrin
|
||||||
(jwk_alg, DOMString::from(data))
|
(jwk_alg, DOMString::from(data))
|
||||||
}
|
}
|
||||||
|
|
||||||
impl KeyAlgorithm {
|
trait AlgorithmFromName {
|
||||||
|
fn from_name(name: DOMString, out: MutableHandleObject, cx: JSContext);
|
||||||
|
}
|
||||||
|
|
||||||
|
impl AlgorithmFromName for KeyAlgorithm {
|
||||||
/// Fill the object referenced by `out` with an [KeyAlgorithm]
|
/// Fill the object referenced by `out` with an [KeyAlgorithm]
|
||||||
/// of the specified name and size.
|
/// of the specified name and size.
|
||||||
#[allow(unsafe_code)]
|
#[allow(unsafe_code)]
|
||||||
|
@ -2644,7 +2647,16 @@ impl KeyAlgorithm {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl HmacKeyAlgorithm {
|
trait AlgorithmFromLengthAndHash {
|
||||||
|
fn from_length_and_hash(
|
||||||
|
length: u32,
|
||||||
|
hash: DigestAlgorithm,
|
||||||
|
out: MutableHandleObject,
|
||||||
|
cx: JSContext,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
impl AlgorithmFromLengthAndHash for HmacKeyAlgorithm {
|
||||||
#[allow(unsafe_code)]
|
#[allow(unsafe_code)]
|
||||||
fn from_length_and_hash(
|
fn from_length_and_hash(
|
||||||
length: u32,
|
length: u32,
|
||||||
|
@ -2666,7 +2678,11 @@ impl HmacKeyAlgorithm {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl AesKeyAlgorithm {
|
trait AlgorithmFromNameAndSize {
|
||||||
|
fn from_name_and_size(name: DOMString, size: u16, out: MutableHandleObject, cx: JSContext);
|
||||||
|
}
|
||||||
|
|
||||||
|
impl AlgorithmFromNameAndSize for AesKeyAlgorithm {
|
||||||
/// Fill the object referenced by `out` with an [AesKeyAlgorithm]
|
/// Fill the object referenced by `out` with an [AesKeyAlgorithm]
|
||||||
/// of the specified name and size.
|
/// of the specified name and size.
|
||||||
#[allow(unsafe_code)]
|
#[allow(unsafe_code)]
|
||||||
|
|
|
@ -12,8 +12,8 @@ use js::rust::{Handle as SafeHandle, HandleObject, HandleValue as SafeHandleValu
|
||||||
|
|
||||||
use crate::dom::bindings::callback::ExceptionHandling;
|
use crate::dom::bindings::callback::ExceptionHandling;
|
||||||
use crate::dom::bindings::codegen::Bindings::UnderlyingSourceBinding::UnderlyingSource as JsUnderlyingSource;
|
use crate::dom::bindings::codegen::Bindings::UnderlyingSourceBinding::UnderlyingSource as JsUnderlyingSource;
|
||||||
use crate::dom::bindings::import::module::Error;
|
use crate::dom::bindings::codegen::UnionTypes::ReadableStreamDefaultControllerOrReadableByteStreamController as Controller;
|
||||||
use crate::dom::bindings::import::module::UnionTypes::ReadableStreamDefaultControllerOrReadableByteStreamController as Controller;
|
use crate::dom::bindings::error::Error;
|
||||||
use crate::dom::bindings::reflector::{DomGlobal, Reflector, reflect_dom_object_with_proto};
|
use crate::dom::bindings::reflector::{DomGlobal, Reflector, reflect_dom_object_with_proto};
|
||||||
use crate::dom::bindings::root::{Dom, DomRoot};
|
use crate::dom::bindings::root::{Dom, DomRoot};
|
||||||
use crate::dom::defaultteeunderlyingsource::DefaultTeeUnderlyingSource;
|
use crate::dom::defaultteeunderlyingsource::DefaultTeeUnderlyingSource;
|
||||||
|
|
|
@ -19,7 +19,7 @@ use webrender_api::units::DeviceIntSize;
|
||||||
|
|
||||||
use super::gpuconvert::convert_texture_descriptor;
|
use super::gpuconvert::convert_texture_descriptor;
|
||||||
use super::gputexture::GPUTexture;
|
use super::gputexture::GPUTexture;
|
||||||
use crate::canvas_context::CanvasContext;
|
use crate::canvas_context::{CanvasContext, CanvasHelpers};
|
||||||
use crate::conversions::Convert;
|
use crate::conversions::Convert;
|
||||||
use crate::dom::bindings::codegen::Bindings::GPUCanvasContextBinding::GPUCanvasContextMethods;
|
use crate::dom::bindings::codegen::Bindings::GPUCanvasContextBinding::GPUCanvasContextMethods;
|
||||||
use crate::dom::bindings::codegen::Bindings::WebGPUBinding::GPUTexture_Binding::GPUTextureMethods;
|
use crate::dom::bindings::codegen::Bindings::WebGPUBinding::GPUTexture_Binding::GPUTextureMethods;
|
||||||
|
|
|
@ -7,8 +7,8 @@ use js::rust::MutableHandleValue;
|
||||||
use webgpu::ShaderCompilationInfo;
|
use webgpu::ShaderCompilationInfo;
|
||||||
|
|
||||||
use crate::dom::bindings::codegen::Bindings::WebGPUBinding::GPUCompilationInfoMethods;
|
use crate::dom::bindings::codegen::Bindings::WebGPUBinding::GPUCompilationInfoMethods;
|
||||||
use crate::dom::bindings::import::module::DomRoot;
|
|
||||||
use crate::dom::bindings::reflector::{Reflector, reflect_dom_object_with_proto};
|
use crate::dom::bindings::reflector::{Reflector, reflect_dom_object_with_proto};
|
||||||
|
use crate::dom::bindings::root::DomRoot;
|
||||||
use crate::dom::bindings::utils::to_frozen_array;
|
use crate::dom::bindings::utils::to_frozen_array;
|
||||||
use crate::dom::globalscope::GlobalScope;
|
use crate::dom::globalscope::GlobalScope;
|
||||||
use crate::dom::types::GPUCompilationMessage;
|
use crate::dom::types::GPUCompilationMessage;
|
||||||
|
|
|
@ -21,6 +21,7 @@ use webgpu::{
|
||||||
|
|
||||||
use super::gpu::AsyncWGPUListener;
|
use super::gpu::AsyncWGPUListener;
|
||||||
use super::gpudevicelostinfo::GPUDeviceLostInfo;
|
use super::gpudevicelostinfo::GPUDeviceLostInfo;
|
||||||
|
use super::gpuerror::AsWebGpu;
|
||||||
use super::gpupipelineerror::GPUPipelineError;
|
use super::gpupipelineerror::GPUPipelineError;
|
||||||
use super::gpusupportedlimits::GPUSupportedLimits;
|
use super::gpusupportedlimits::GPUSupportedLimits;
|
||||||
use crate::conversions::Convert;
|
use crate::conversions::Convert;
|
||||||
|
|
|
@ -90,8 +90,12 @@ impl Convert<GPUErrorFilter> for ErrorFilter {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl GPUErrorFilter {
|
pub(crate) trait AsWebGpu {
|
||||||
pub(crate) fn as_webgpu(&self) -> ErrorFilter {
|
fn as_webgpu(&self) -> ErrorFilter;
|
||||||
|
}
|
||||||
|
|
||||||
|
impl AsWebGpu for GPUErrorFilter {
|
||||||
|
fn as_webgpu(&self) -> ErrorFilter {
|
||||||
match self {
|
match self {
|
||||||
GPUErrorFilter::Validation => ErrorFilter::Validation,
|
GPUErrorFilter::Validation => ErrorFilter::Validation,
|
||||||
GPUErrorFilter::Out_of_memory => ErrorFilter::OutOfMemory,
|
GPUErrorFilter::Out_of_memory => ErrorFilter::OutOfMemory,
|
||||||
|
|
|
@ -16,7 +16,7 @@ use crate::dom::bindings::codegen::Bindings::WebGPUBinding::{
|
||||||
GPUIndexFormat, GPURenderBundleDescriptor, GPURenderBundleEncoderDescriptor,
|
GPUIndexFormat, GPURenderBundleDescriptor, GPURenderBundleEncoderDescriptor,
|
||||||
GPURenderBundleEncoderMethods,
|
GPURenderBundleEncoderMethods,
|
||||||
};
|
};
|
||||||
use crate::dom::bindings::import::module::Fallible;
|
use crate::dom::bindings::error::Fallible;
|
||||||
use crate::dom::bindings::reflector::{DomGlobal, Reflector, reflect_dom_object};
|
use crate::dom::bindings::reflector::{DomGlobal, Reflector, reflect_dom_object};
|
||||||
use crate::dom::bindings::root::{Dom, DomRoot};
|
use crate::dom::bindings::root::{Dom, DomRoot};
|
||||||
use crate::dom::bindings::str::USVString;
|
use crate::dom::bindings::str::USVString;
|
||||||
|
|
|
@ -11,6 +11,7 @@ use js::rust::HandleObject;
|
||||||
use webxr_api::{ContextId as WebXRContextId, LayerId, LayerInit, Viewport};
|
use webxr_api::{ContextId as WebXRContextId, LayerId, LayerInit, Viewport};
|
||||||
|
|
||||||
use crate::canvas_context::CanvasContext as _;
|
use crate::canvas_context::CanvasContext as _;
|
||||||
|
use crate::conversions::Convert;
|
||||||
use crate::dom::bindings::codegen::Bindings::WebGL2RenderingContextBinding::WebGL2RenderingContextConstants as constants;
|
use crate::dom::bindings::codegen::Bindings::WebGL2RenderingContextBinding::WebGL2RenderingContextConstants as constants;
|
||||||
use crate::dom::bindings::codegen::Bindings::WebGLRenderingContextBinding::WebGLRenderingContextMethods;
|
use crate::dom::bindings::codegen::Bindings::WebGLRenderingContextBinding::WebGLRenderingContextMethods;
|
||||||
use crate::dom::bindings::codegen::Bindings::XRWebGLLayerBinding::{
|
use crate::dom::bindings::codegen::Bindings::XRWebGLLayerBinding::{
|
||||||
|
@ -35,15 +36,15 @@ use crate::dom::xrview::XRView;
|
||||||
use crate::dom::xrviewport::XRViewport;
|
use crate::dom::xrviewport::XRViewport;
|
||||||
use crate::script_runtime::CanGc;
|
use crate::script_runtime::CanGc;
|
||||||
|
|
||||||
impl<'a> From<&'a XRWebGLLayerInit> for LayerInit {
|
impl Convert<LayerInit> for XRWebGLLayerInit {
|
||||||
fn from(init: &'a XRWebGLLayerInit) -> LayerInit {
|
fn convert(self) -> LayerInit {
|
||||||
LayerInit::WebGLLayer {
|
LayerInit::WebGLLayer {
|
||||||
alpha: init.alpha,
|
alpha: self.alpha,
|
||||||
antialias: init.antialias,
|
antialias: self.antialias,
|
||||||
depth: init.depth,
|
depth: self.depth,
|
||||||
stencil: init.stencil,
|
stencil: self.stencil,
|
||||||
framebuffer_scale_factor: *init.framebufferScaleFactor as f32,
|
framebuffer_scale_factor: *self.framebufferScaleFactor as f32,
|
||||||
ignore_depth_values: init.ignoreDepthValues,
|
ignore_depth_values: self.ignoreDepthValues,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -271,7 +272,7 @@ impl XRWebGLLayerMethods<crate::DomTypeHolder> for XRWebGLLayer {
|
||||||
// Step 9.3. "Allocate and initialize resources compatible with session’s XR device,
|
// Step 9.3. "Allocate and initialize resources compatible with session’s XR device,
|
||||||
// including GPU accessible memory buffers, as required to support the compositing of layer."
|
// including GPU accessible memory buffers, as required to support the compositing of layer."
|
||||||
let context_id = WebXRContextId::from(context.context_id());
|
let context_id = WebXRContextId::from(context.context_id());
|
||||||
let layer_init = LayerInit::from(init);
|
let layer_init: LayerInit = init.convert();
|
||||||
let layer_id = session
|
let layer_id = session
|
||||||
.with_session(|session| session.create_layer(context_id, layer_init))
|
.with_session(|session| session.create_layer(context_id, layer_init))
|
||||||
.map_err(|_| Error::Operation)?;
|
.map_err(|_| Error::Operation)?;
|
||||||
|
|
|
@ -21,8 +21,7 @@ use crate::dom::bindings::codegen::Bindings::QueuingStrategyBinding::QueuingStra
|
||||||
use crate::dom::bindings::codegen::Bindings::UnderlyingSinkBinding::UnderlyingSink;
|
use crate::dom::bindings::codegen::Bindings::UnderlyingSinkBinding::UnderlyingSink;
|
||||||
use crate::dom::bindings::codegen::Bindings::WritableStreamBinding::WritableStreamMethods;
|
use crate::dom::bindings::codegen::Bindings::WritableStreamBinding::WritableStreamMethods;
|
||||||
use crate::dom::bindings::conversions::ConversionResult;
|
use crate::dom::bindings::conversions::ConversionResult;
|
||||||
use crate::dom::bindings::error::Error;
|
use crate::dom::bindings::error::{Error, Fallible};
|
||||||
use crate::dom::bindings::import::module::Fallible;
|
|
||||||
use crate::dom::bindings::reflector::{Reflector, reflect_dom_object_with_proto};
|
use crate::dom::bindings::reflector::{Reflector, reflect_dom_object_with_proto};
|
||||||
use crate::dom::bindings::root::{Dom, DomRoot, MutNullableDom};
|
use crate::dom::bindings::root::{Dom, DomRoot, MutNullableDom};
|
||||||
use crate::dom::countqueuingstrategy::{extract_high_water_mark, extract_size_algorithm};
|
use crate::dom::countqueuingstrategy::{extract_high_water_mark, extract_size_algorithm};
|
||||||
|
|
|
@ -49,6 +49,7 @@ pub(crate) struct SecurityPolicyViolationReport {
|
||||||
line_number: u32,
|
line_number: u32,
|
||||||
column_number: u32,
|
column_number: u32,
|
||||||
original_policy: String,
|
original_policy: String,
|
||||||
|
#[serde(serialize_with = "serialize_disposition")]
|
||||||
disposition: SecurityPolicyViolationEventDisposition,
|
disposition: SecurityPolicyViolationEventDisposition,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -170,11 +171,12 @@ impl Convert<SecurityPolicyViolationEventInit> for SecurityPolicyViolationReport
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Serialize for SecurityPolicyViolationEventDisposition {
|
fn serialize_disposition<S: serde::Serializer>(
|
||||||
fn serialize<S: serde::Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {
|
val: &SecurityPolicyViolationEventDisposition,
|
||||||
match self {
|
serializer: S,
|
||||||
Self::Report => serializer.serialize_str("report"),
|
) -> Result<S::Ok, S::Error> {
|
||||||
Self::Enforce => serializer.serialize_str("enforce"),
|
match val {
|
||||||
}
|
SecurityPolicyViolationEventDisposition::Report => serializer.serialize_str("report"),
|
||||||
|
SecurityPolicyViolationEventDisposition::Enforce => serializer.serialize_str("enforce"),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -673,10 +673,26 @@ DOMInterfaces = {
|
||||||
}
|
}
|
||||||
|
|
||||||
Dictionaries = {
|
Dictionaries = {
|
||||||
|
'AudioNodeOptions': {
|
||||||
|
'derives': ['Clone', 'Copy'],
|
||||||
|
},
|
||||||
|
|
||||||
|
'ChannelMergerOptions': {
|
||||||
|
'derives': ['Clone', 'Copy'],
|
||||||
|
},
|
||||||
|
|
||||||
|
'ConstantSourceOptions': {
|
||||||
|
'derives': ['Clone', 'Copy'],
|
||||||
|
},
|
||||||
|
|
||||||
'FontFaceDescriptors': {
|
'FontFaceDescriptors': {
|
||||||
'derives': ['Clone', 'MallocSizeOf']
|
'derives': ['Clone', 'MallocSizeOf']
|
||||||
},
|
},
|
||||||
|
|
||||||
|
'GainOptions': {
|
||||||
|
'derives': ['Clone', 'Copy'],
|
||||||
|
},
|
||||||
|
|
||||||
'GPUCanvasConfiguration': {
|
'GPUCanvasConfiguration': {
|
||||||
'derives': ['Clone']
|
'derives': ['Clone']
|
||||||
},
|
},
|
||||||
|
@ -696,6 +712,18 @@ Dictionaries = {
|
||||||
'HeadersInit': {
|
'HeadersInit': {
|
||||||
'derives': ["Clone"],
|
'derives': ["Clone"],
|
||||||
},
|
},
|
||||||
|
|
||||||
|
'IIRFilterOptions': {
|
||||||
|
'derives': ['Clone'],
|
||||||
|
},
|
||||||
|
|
||||||
|
'StereoPannerOptions': {
|
||||||
|
'derives': ['Clone', 'Copy'],
|
||||||
|
},
|
||||||
|
|
||||||
|
'XRWebGLLayerInit': {
|
||||||
|
'derives': ['Clone', 'Copy'],
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
Enums = {
|
Enums = {
|
||||||
|
|
|
@ -7334,6 +7334,7 @@ impl{self.generic} Clone for {self.makeClassName(self.dictionary)}{self.genericS
|
||||||
"}\n"
|
"}\n"
|
||||||
"\n"
|
"\n"
|
||||||
f"impl{self.generic} {selfName}{self.genericSuffix} {{\n"
|
f"impl{self.generic} {selfName}{self.genericSuffix} {{\n"
|
||||||
|
" #[allow(clippy::wrong_self_convention)]\n"
|
||||||
" pub(crate) unsafe fn to_jsobject(&self, cx: *mut JSContext, mut obj: MutableHandleObject) {\n"
|
" pub(crate) unsafe fn to_jsobject(&self, cx: *mut JSContext, mut obj: MutableHandleObject) {\n"
|
||||||
f"{CGIndenter(CGList(memberInserts), indentLevel=8).define()} }}\n"
|
f"{CGIndenter(CGList(memberInserts), indentLevel=8).define()} }}\n"
|
||||||
"}\n"
|
"}\n"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue